I've been working with the Arduino Due for a project, we have been setting up these Arduinos with an ARM Board that hosts a Linux System with Busybox that connects to the Arduino. Recently I got assigned the job of making it possible for the Arduino Due to be updated with the new code remotely so we don't have to travel to each location every time we need to update anything.
At first it seemed easy, crosscompile bossac for Arduino Due and use it in the ARM Linux Board, needing to open the port at 1200 bauds so the Arduino is available for a new upload.
The problem is, i've tested bossac and it works perfectly on Windows same as the Arduino IDE, it always uploads the sketch without a single problem. On Linux, however it doesn't seem to be working properly, not even the full Arduino IDE in AMD64, we have already tested it in 2 Vbox with Linux and in 2 native Linux installations, testing 32b and 64b, ARM and x86, i've tested everything I've seen on the web: up the permissions, add the user to the dialout group, reset the board manually...
I'm sure i'm missing something stupid but I don't know what and it's driving me crazy because the Arduino IDE is supposed to work properly on Linux. Just in case, these are the steps I've followed:
- Download the latest version of the Arduino Due, untar it and sudo ./install.sh
- Add my user to the dialout group, and log out.
- In the Arduino IDE go to the Board Manager and install the SAM support for Arduino Due
- Select Arduino Due (programming port) and /dev/ttyACM0
- Upload any sketch (also tried with example sketches), it compiles but when uploading the next message appears
SAM-BA operation failed
And if using the verbose output this always happens after the next output,it seems to fail the last write and tries to overwrite it again (this is not the full output, there are writes and reads before this)
Chip ID : 285e0a60 version()=v1.1 Dec 15 2010 19:25:04 Version : v1.1 Dec 15 2010 19:25:04 Address : 524288 Pages : 2048 Page Size : 256 bytes Total Size : 512KB Planes : 2 Lock Regions : 32 Locked : readWord(addr=0x400e0a08)=0x1 readWord(addr=0x400e0c08)=0x1 writeWord(addr=0x400e0a04,value=0x5a00000a) readWord(addr=0x400e0a08)=0x1 readWord(addr=0x400e0c08)=0x1 readWord(addr=0x400e0a0c)=0 readWord(addr=0x400e0a08)=0x1 readWord(addr=0x400e0c08)=0x1 writeWord(addr=0x400e0a04,value=0x5a00000a) readWord(addr=0x400e0a08)=0x1 readWord(addr=0x400e0c08)=0x1
Almost every time it crashes it's like that but sometimes it even starts uploading and showing the percentage of upload but again "SAM-BA operation failed" before finishing the upload.
What irks me is that in Windows it works flawlessly so the board is all good and even compiling bossac from the sources produces the same error in Linux, I've also tested an Arduino Duemilanove and it works perfectly on Linux however it uses avr, not bossac. As i've said i've tested it in 4 machines and it's always the same, even in the ARM version.
What is it that I'm missing?
Thanks in advance.