Communication

Discussion in 'UDOO X86' started by nightoftheelfe, Mar 23, 2018.

  1. nightoftheelfe

    nightoftheelfe New Member

    Joined:
    Mar 23, 2018
    Messages:
    17
    Likes Received:
    0
    Hello,

    I would like to know if it's possible to automate a communication between the Braswell and arduino 101 without using the serie monitor. I would like them to send data to each other continuously.


    Another question is it possible to send sh file to change some parameters of the arduino's sketch or even entire sketch without using the arduino IDE on Linux ?

    I have found this : https://github.com/UDOOboard/serial_libraries_examples/tree/udoo-x86
    There are C examples to communicate to the arduino but without the librairies used.
     
    Last edited: Mar 23, 2018
  2. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    Arduino has its own command line interface that you can use in a sh. https://github.com/arduino/Arduino/blob/master/build/shared/manpage.adoc

    Edit ( I did not read correctly).
    You can monitor the serial device on the Braswell side with any program like on the examples you mentioned. I am no c programmer but serial device library is a very commonly used addition so it should not be hard to find examples and downloads.
     
    Last edited: Mar 23, 2018
  3. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
  4. nightoftheelfe

    nightoftheelfe New Member

    Joined:
    Mar 23, 2018
    Messages:
    17
    Likes Received:
    0
    Actually I thought about it and I am okay with using the arduino command lines, thanks for the link !
    First I tried to install the arduino 101 board with the command : arduino --install-boards Intel:arc32
    However it runs arduino IDE and don't install the intel curie boards.
    This arduino IDE doesn't contain the board manager.

    To use the command :
    arduino --board arduino:avr:nano:cpu=atmega168 --port /dev/ttyACM0 --upload /path/to/sketch/sketch.ino
    What should i write for the cpu and instead of nano ?

    I am so confuse cause I watched this : http://www.linuxcircle.com/2013/05/15/programming-and-uploading-arduino-sketch-without-ide/
    It would be to upload sketch with a makefile but it didn't work. At the end I have the error :
    avrdude: stk500_recv(): programmer is not responding
    avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
    avrdude: stk500_recv(): programmer is not responding


    i have found this script in the guide :
    sudo ~/.arduino15/packages/Intel/hardware/arc32/2.0.2/scripts/create_dfu_udev_rule
    I tried to use it but I have the error command not found.

    I am getting errors everywhere :confused:
    I just want to be able to upload sketches and makefile
     
    Last edited: Mar 26, 2018
  5. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    I think the easies way to get communication working is just to install the Arduino IDE including the Board manager as instructed on the Arduino 101 install pages. Try and upload the blink example to see if the uploading succeeds. This is known to be troublesome the very first time because of a driver update within the Arduino 101 module itself. See also https://www.udoo.org/forum/threads/cant-upload-sketches-the-udoo-x86-curie.8805/
    After that you can just use the CLI to send the sketches to Arduino 101.
     
  6. nightoftheelfe

    nightoftheelfe New Member

    Joined:
    Mar 23, 2018
    Messages:
    17
    Likes Received:
    0
    If I run directly my arduino IDE with the curie core installed I can upload sketches easily.
    However when I try to upload sketches with CLI it doesn't work.
    The CLI opens like another Arduino IDE without the curie core(arduino 101 library) installed and without board manager.
     
  7. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    That is strange as it should be just the same.
    I used the following command to upload the sketch "MyProgram.ino" without any problems:
    arduino --board Intel:arc32:arduino_101 --port /dev/ttyACM0 --upload MyProgram.ino
     
  8. nightoftheelfe

    nightoftheelfe New Member

    Joined:
    Mar 23, 2018
    Messages:
    17
    Likes Received:
    0
    It's because I used a portable arduino IDE where I installed the Curie Core boards.
    And I also used the command : "apt-get install arduino " which installed another old arduino version without the board manager.
    I uninstalled both of them but now I would like to have a clean installation of arduino.
    Because If I only use the portable arduino IDE the CLI tell me the arduino sofware isn't installed.


    I did this to install the new version :
    cd ..
    sudo mv arduino-1.8.5 /opt
    cd /opt/arduino-1.8.5/

    Make install.sh executable:

    chmod +x install.sh

    and then run the script:

    ./install.sh

    One problem solved :

    The first one is that when I use CLI like : "arduino --install-boards Intel:arc32" in the terminal it tells me that arduino isn't installed and to use the command "sudo apt install arduino"
    I solved this issue I am not sure how but I think it was by using "sudo apt full-upgrade" then restarting


    My last problem :
    An error in the board manager, it says it can't download from the url http://www.downloads.arduino.cc/packages/package_index.json

    This error is solved if I run arduino as administrator with the command : "sudo ./arduino"
    However I can't use "sudo arduino --install-boards Intel:arc32", this command doesn't exist
    How can I use the CLI as administrator ? it would solve the problem
     
    Last edited: Mar 27, 2018
  9. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    You can try to locate the create_dfu_udev_rule that normally is around here ~/.arduino15/packages/Intel/hardware/arc32/2.0.2/scripts/create_dfu_udev_rule
    But you use another way of installing so it can be on another location.
    chmod +x ~/.arduino15/packages/Intel/hardware/arc32/2.0.2/scripts/create_dfu_udev_rule
    sudo ~/.arduino15/packages/Intel/hardware/arc32/2.0.2/scripts/create_dfu_udev_rule

    But why all this trouble? Why not install it according the manual? It will do all of this for you.......
    https://www.arduino.cc/en/Guide/Arduino101
     
  10. nightoftheelfe

    nightoftheelfe New Member

    Joined:
    Mar 23, 2018
    Messages:
    17
    Likes Received:
    0
    I have solved the first issue, by doing the installation with ./install.sh and rebooting with installation manager, now the computer thinks arduino is installed and i can use the CLI

    For the second issue, the library were downloaded using a "sudo ./arduino" which means i can only access them with sudo, so I deleted the folder where is package_index.json and I could redownload it

    It's because I will be using the udoo x86 on debian without the graphical interface and only the terminal.

    Now I can run arduino without using sudo, i have access the intel curie core library.

    Do you know if there is a way of using makefile with the arduino 101 ?
    I found this : https://mithatkonar.com/blog/2015/02/22/battle-of-the-arduino-makefiles/
    But it's only for others boards than 101
     
    Last edited: Mar 28, 2018
  11. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    makefile is the same as building a compiled version of the arduino sketch, isnt it?
    Then it is part of the Arduino cli see the various options of the tool: https://github.com/arduino/Arduino/blob/master/build/shared/manpage.adoc
    Code:
    --verify
        Build the sketch.
    --upload
        Build and upload the sketch.
    --verbose-build
        Enable verbose mode during build. If this option is not given, verbose mode during build is disabled regardless of the current preferences.
    --preserve-temp-files
        Keep temporary files (preprocessed sketch, object files…) after termination. If omitted, temporary files are deleted.
        This option is only valid together with --verify or --upload.
    --useprogrammer
        Upload using a programmer. Set if you’re using an external programmer, or using the Arduino as ISP.
    --verbose-upload
        Enable verbose mode during upload. If this option is not given, verbose mode during upload is disabled regardless of the current preferences.
        This option is only valid together with --verify or --upload.
    
     
  12. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
  13. nightoftheelfe

    nightoftheelfe New Member

    Joined:
    Mar 23, 2018
    Messages:
    17
    Likes Received:
    0
    Sometimes the command line interface doesn't work, I think it's a DFU issue and I don't want to need to press the Master_reset button everytime.
    However I did the two commands :
    chmod +x ~/.arduino15/packages/Intel/hardware/arc32/2.0.2/scripts/create_dfu_udev_rule
    sudo ~/.arduino15/packages/Intel/hardware/arc32/2.0.2/scripts/create_dfu_udev_rule

    I think I solved this issue with the file create_dfu_udev_rule, I erased the need to be administrator.

    UDOO-x86:~/Documents/arduino/test$ arduino --board Intel:arc32:arduino_101 --port /dev/ttyACM0 --upload test.ino
    Picked up JAVA_TOOL_OPTIONS:
    Chargement de la configuration
    Initialisation des paquets...
    Préparation des cartes
    Vérification...
    Archiving built core (caching) in: /tmp/arduino_cache_789227/core/core_Intel_arc32_arduino_101_7e2e1954679006062ebe37fefe36f006.a
    Le croquis utilise 48716 octets (31%) de l'espace de stockage de programmes. Le maximum est de 155648 octets.
    Téléversement...
    Starting download script...
    Flashing is taking longer than expected
    Try pressing MASTER_RESET button
    ERROR: Timed out waiting for Arduino 101 on /dev/ttyACM0
    Une erreur est survenue lors du transfert du croquis


    the command line interface works (when I reset the board), we can upload sketches (file.ino), however I would be able to configure the connexion such as the baudrate.
    More over I would like to be able to upload pre-compiled files, is it possible?
     
    Last edited: Mar 29, 2018
  14. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580

Share This Page