вторник, 11 ноября 2014 г.

Uploading Arduino .hex from Netgear Stora

AAAAAAAAA

I've done it. After so much pain. I even do not remmeber all the steps. However:


  • I've compiled usb drivers and ftdi drivers. I have a post about it 
  • I've compiled avrdude 6 on my Netgear Stora. Don't ask how. There was also a lot of pain. But for some reason avrdude 6 worked while v5 still cannot be compiled.
  • I have a daemon which talks to arduino, so to program I have to switch it off
  • Then I faced an issue whatever I tried I receive "avrdude: stk500_getsync(): not in sync". Looks like the issue was with my usb and ftdi drivers - for some reasons they can't help avrdude to negotiate a correct baudrate for my arduino. I tried several and looks like 57600 worked for me. I tried terminal mode like this
/root/avrdude-6.0.1/avrdude -t -v -v -v -v -c arduino -p m328p -b 57600 -P /dev/ttyUSB0

  • But then another issue arised - looks like core version of avrdude cannot properly reset the arduino. There are several tricks on how to do that manually - I'll try them later. Also I think Arduino's version of avrdude can do that, but I have issues compiling it on my Netgear (some Perl issues - nothing too serious can be solved in the future). So I went with another solution - I just reset my USB subsystem and then attach to arduino to upload a sketch. To reset the usb subsistem I'm doing the following:

echo -n "1-0:1.0" > /sys/bus/usb/drivers/hub/unbind
echo -n "1-0:1.0" > /sys/bus/usb/drivers/hub/bind

  •  In the above code IDs of your USB hub could be different, so check them in the folder /sys/bus/usb/drivers/hub/, but I guess on all Storas they should be the same.
  • Then upload the sketch, like that:
/root/avrdude-6.0.1/avrdude -v -v -v -v -c arduino -p m328p -b 57600 -P /dev/ttyUSB0 -D -Uflash:w:/home/arduino/Firmw4_4.cpp.hex
Have a good time with your IoT ;)