Arduino Debugging
Usually not everything goes as planned with Arduino; here are some bugs and (possible) workarounds we found.
Serial Programmer
Sometimes the bootloader on the ATMEGA can get corrupted and has to be re-burned or your program just doesn't fit on the flash of the Arduino with the bootloader present.
Linux
On some distributions the IDE exits with following exeption when trying to write a program via the serial interface (using the USBasp programmer for example):
avrdude: Warning: cannot open USB device: Permission denied
avrdude: error: could not find USB device with vid=0x16c0 pid=0x5dc vendor='www.fischl.de' product='USBasp'
This happens if the USB device is not loaded with the right permissions. A quick fix is to look for the programmer via lsusb
. This is a typical return value:
Bus 002 Device 006: ID 16c0:05dc Van Ooijen Technische Informatica shared ID for use with libusb
In this example you have to grand permission to the USB device with: sudo chmod 666 /dev/bus/usb/002/006
However after the programmer is reconnected the procedure has to be repeated. A more permanent fix is to create a .rules file in /etc/udev/rules.d/
and always grand permission for the programmer device (here for USBasp):
SUBSYSTEM=="usb", ATTR{product}=="USBasp", ATTR{idProduct}=="05dc", ATTRS{idVendor}=="16c0", MODE="0666"
A more refined way would be to set the device permission to a specific user group with access to the USB devices (e.g. "dialout" on Ubuntu). So instead if MODE="0666"
set GROUP="dialout"
. Don't forget to add your user to this group as well. Didn't work on Fedora 25, but should under Ubuntu.
Credit to this blog.