Difference between revisions of "Userspace Arduino"
(→Emulating the Arduino bootloader) |
|||
Line 20: | Line 20: | ||
* sshpass is slightly less complicated than expect. But some issues are there with using sshpass and sftp to upload the binary to the bone. Executing the binary encountered no issues. | * sshpass is slightly less complicated than expect. But some issues are there with using sshpass and sftp to upload the binary to the bone. Executing the binary encountered no issues. | ||
* In case the user has set his own password and/or username, the IDE can contain a simple form to accept the same. | * In case the user has set his own password and/or username, the IDE can contain a simple form to accept the same. | ||
+ | |||
== Emulating the Arduino bootloader == | == Emulating the Arduino bootloader == | ||
Line 27: | Line 28: | ||
* However this would be cumbersome, since the protocol was designed to write bytes to flash memory, not copy files. Energia uses msp430flasher to flash the MSP430 using an in-built (ROM or Flash based) Bootstarp Loader (BSL). | * However this would be cumbersome, since the protocol was designed to write bytes to flash memory, not copy files. Energia uses msp430flasher to flash the MSP430 using an in-built (ROM or Flash based) Bootstarp Loader (BSL). | ||
* File transfer protocols over serial like XMODEM and ZMODEM could be explored for an easier and more compatible option to Upload the binaries. | * File transfer protocols over serial like XMODEM and ZMODEM could be explored for an easier and more compatible option to Upload the binaries. | ||
+ | * Install the lrzsz package: | ||
+ | apt-get install lrzsz | ||
+ | * Connect the Beaglebone via USB and determine the port (for e.g. /dev/ttyUSB1). To start the transfer: | ||
+ | sz -vv -b filename.bin < /dev/ttyUSB1 > /dev/ttyUSB1 |
Revision as of 10:29, 20 May 2013
this page is to document some research on creating a userspace executable using the wiring and processing language used with Arduino.
Transfer Options
Netcat
- GNU Netcat networking tool http://netcat.sourceforge.net/
- Can create a connection using nc -w 1 192.168.7.2 1114 < new.zip on the server (in this case the machine running the Energia IDE), and nc -lp 1114 > n.zip on the Beaglebone. 1114 is a random port number which has to be the same on client as well as server side.
- Some issue with sending .bin files directly. Mostly it was with how the file ends, not sure. So need to zip the file.
- Requires no authentication
- A script will be needed to listen on a particular port on the BBB for any incoming connections which will receive, unzip and execute the code.
ssh/scp/sftp
- Needs authentication.
- scp/sftp is built over ssh i.e. they use ssh for authentication and copying
- To enter the password and execute the program after copying one will have to use a tool like expect (http://www.nist.gov/el/msid/expect.cfm)or sshpass (http://www.debianadmin.com/sshpass-non-interactive-ssh-password-authentication.html). Both of these tools usually don't ship with any Linux distribution.
- sshpass is slightly less complicated than expect. But some issues are there with using sshpass and sftp to upload the binary to the bone. Executing the binary encountered no issues.
- In case the user has set his own password and/or username, the IDE can contain a simple form to accept the same.
Emulating the Arduino bootloader
- The Arduino Bootloader uses a protocol similar to STK500v1 (over UART, though)
- One way to program (copy) the binaries would be to emulate the protocol on the bone over USB gadget and use AVRDude on the IDE side
- However this would be cumbersome, since the protocol was designed to write bytes to flash memory, not copy files. Energia uses msp430flasher to flash the MSP430 using an in-built (ROM or Flash based) Bootstarp Loader (BSL).
- File transfer protocols over serial like XMODEM and ZMODEM could be explored for an easier and more compatible option to Upload the binaries.
- Install the lrzsz package:
apt-get install lrzsz
- Connect the Beaglebone via USB and determine the port (for e.g. /dev/ttyUSB1). To start the transfer:
sz -vv -b filename.bin < /dev/ttyUSB1 > /dev/ttyUSB1