0
\$\begingroup\$

Recently I have been trying to learn how to program Arduino in Code::Blocks. I used the AVR project wizard to create my project. The program compiles flawlessly into a .hex file that I want to upload using avrdude. I've already looked for about an hour for a solution, but none of them that I find actually work. I am running on Ubuntu, if that is important. Here is what I get in the command line:

me@mePC:~/Desktop/C++/AVRTest$ sudo avrdude -c avrisp -p m168 -P /dev/ttyUSB0/ -U flash:w:AVRTest.hex
avrdude: ser_open(): can't open device "/dev/ttyUSB0/": Not a directory
ioctl("TIOCMGET"): Invalid argument

avrdude done.  Thank you.

I am running avrdude in the directory that the .hex file is located. I looked in the Arduino IDE and the programmer is AVR ISP, the chip is ATmega168, and the port used is /dev/ttyUSB0/. I've already tried the arduino programmer option in avrdude. This is the Duemilanove board that I am using and it has an FTDI chip on it.

I am quite puzzled by this and any help would be appreciated. Thanks.

\$\endgroup\$
  • \$\begingroup\$ You shouldn't need sudo for this. If you add your user to the dialout group, which owns /dev/ttyUSB0, logout and log back in, you can do this without sudo (and you always try to use sudo as little as possible). \$\endgroup\$ – Keelan Mar 23 '15 at 15:19
3
\$\begingroup\$

I think the problem is that your port is /dev/ttyUSB0 and not /dev/ttyUSB0/

\$\endgroup\$
1
\$\begingroup\$

This message means your operating system can't open the (virtual) serial port /dev/ttyUSB0. There are a few things to check:

  • Is the Arduino connected to your computer?
  • Do a ls /dev/ttyUSB*. Sometimes, when you disconnect and reconnect the Arduino, it gets a different name, like ttyUSB1.
\$\endgroup\$
0
\$\begingroup\$

After a bit more trouble shooting, I found that avrdude needed the baud rate. I found this by looking at the terminal that the Arduino IDE uses while it was uploading. The baud rate needs to be set with -b 19200.

\$\endgroup\$
  • \$\begingroup\$ Error message in question clearly indicates that the trailing "/" in the serial port name (/dev/ttyUSB0/) is the problem. \$\endgroup\$ – Turbo J Nov 13 '15 at 12:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.