Uploading a sketch from CLI? I'm ssh'd in.

Discussion in 'Arduino IDE' started by jayfehr, Dec 28, 2013.

  1. jayfehr

    jayfehr New Member

    Joined:
    Oct 26, 2013
    Messages:
    13
    Likes Received:
    0
    Just curious how I would go about uploading a sketch to the due while I'm ssh'd into the Ubuntu installation. I currently have my udoo in another room taking sensor readings and would like to make some changes without having to tear down and setup again.
     
  2. firehopper

    firehopper Member

    Joined:
    Jun 10, 2013
    Messages:
    154
    Likes Received:
    1
    copy bossac from your arduino dir to say /usr/bin
    that way you can run bossac from anywhere..

    then give a bossac -e -w -v -b -R yourbinfilehere.bin
    that should work..
    if not you may have to fiddle with the option switches.. add the force usb one first.
     
  3. jayfehr

    jayfehr New Member

    Joined:
    Oct 26, 2013
    Messages:
    13
    Likes Received:
    0
    I couldn't find the location of bossac on the UDOO so I used the Linux 32 version from the downloads page (http://www.udoo.org/downloads/). When running it though I get the following error:

    Code:
    /usr/bin/bossac: cannot execute binary file
    Any suggestions, or links to how bossac works? I'm new to Ardunio's and am willing to read up on how to do things. Sometimes I just need to be pointed in the right direction though.

    On another note, I can compile my sketches on my PC and copy them over the ssh connection (I have it setup for the Udoo and have tested it through USB). But I'm wondering if there is an easy way to compile on the command line as well? This isn't as big of a deal as uploading the sketches though as I can already compile locally.
     
  4. jayfehr

    jayfehr New Member

    Joined:
    Oct 26, 2013
    Messages:
    13
    Likes Received:
    0
    Silly me, I forgot about the find command. I copied the UDOO bossac file over to /usr/bin, and received this error:
    Code:
    Auto scan for device failed
    Try specifying a serial port with the '-p' option
    
    so I modified the command to:
    Code:
    bossac -e -w -v -b -R -p /dev/ttymxc3 garden_sketch.cpp.bin
    and got the following error:
    Code:
    Inner erase and reset routine:  successiful!!
    No device found on /dev/ttymxc3
    
    I've also tried specifying the USB flag set as both true and false. Both flags gave the same no device found error. I'm thinking it may be possible that the serial port is talking on two different baud rates, but I'm not sure how to check or switch them.
     
  5. jayfehr

    jayfehr New Member

    Joined:
    Oct 26, 2013
    Messages:
    13
    Likes Received:
    0
    Discovered that you can change the baud rate with the following command:

    Code:
    stty -F /dev/ttymxc3 ispeed 9600 ospeed 9600
    and verify it with

    Code:
    stty -F /dev/ttymxc3 -a
    however I'm still getting the no device found error, so I don't believe that the baud rate is the issue.
     
  6. firehopper

    firehopper Member

    Joined:
    Jun 10, 2013
    Messages:
    154
    Likes Received:
    1
    if you issue this command

    bossac -i -d --port=ttymxc3 -U false -e -w -v -b nameofyourprogram.bin -R
    it should upload

    once it does that, you can remove the -d and -i switches.
    the -U false may or may not be needed. the really important ones are the --port and -e -w -b and -R

    viewtopic.php?f=15&t=425 < this post explains some of the switches, and my experiments on how to get it to work from the command line.
     
  7. jayfehr

    jayfehr New Member

    Joined:
    Oct 26, 2013
    Messages:
    13
    Likes Received:
    0
    That works! Thank you!

    The issue is the /dev/ isn't needed.
     
  8. firehopper

    firehopper Member

    Joined:
    Jun 10, 2013
    Messages:
    154
    Likes Received:
    1
    welcome. Like I said, I had to figure this out a while ago to upload the firmware for my 3d printer :)
     

Share This Page