0
\$\begingroup\$

I bought a ftdi cable with the following pins.

  1. Vcc
  2. GND
  3. RX
  4. TX
  5. RTS
  6. CTS

It's possible to use this device to upload code to an ATmega328p using the avrdude utility?

When I run this line on linux terminal:

sudo avrdude -c ft232r -p ATMEGA328P -P "/dev/ttyUSB0" -b 57600 -U flash:w:led.hex

I get this output:

avrdude: invalid portname '/dev/ttyUSB0': use 'ft[0-9]+'

I know that some ft232r boards can be used for this purpose, but all of them that I've seen until now rely on the DTR pin, which I don't have access.

\$\endgroup\$
  • \$\begingroup\$ Are you trying to do ISP, or to talk to a bootloader? Your current command is an unworkable mix of the two, and you will need to make it definitively one or the other. \$\endgroup\$ – Chris Stratton Feb 4 '18 at 0:01
  • \$\begingroup\$ I'm trying to do a ISP, could please explain better how I'm making a mix of the two? \$\endgroup\$ – Oshio Feb 4 '18 at 5:06
  • \$\begingroup\$ You're using a USB serial address only suitable for bootloader and other runtime communication, mixed up with an ISP command. \$\endgroup\$ – Chris Stratton Feb 4 '18 at 5:14
  • \$\begingroup\$ Yes I see that, @C_Elegans and Janka have already alerted me about that problem. I'm working on this, please see the C_Elegans answer and comments to understand what I've done so far. I appreciate your time. \$\endgroup\$ – Oshio Feb 4 '18 at 5:23
1
\$\begingroup\$

According to this guide, you can modify your avrdude.conf to use a different pin for the reset signal than normal. So you would want to add the following to your avrdude.conf

programmer
  id    = "ft232r_mod";
  desc  = "FT232R Synchronous BitBang";
  type  = "ftdi_syncbb";
  connection_type = usb;
  miso  = 1;  # RxD
  sck   = 0;  # RTS
  mosi  = 2;  # TxD
  reset = 3;  # CTS
;

and invoke avrdude as avrdude -c ft232r_mod -p m328p -P ft0 -U flash:w:led.hex (making sure to use ft0 instead of the serial port name). Alternatively, if you post what your FTDI board is, there may be an exposed pad for the DTR signal, like on Adafruit's FTDI Friend. Finally if neither of those work, and you have a working arduino, you can use it as an isp.

\$\endgroup\$
  • \$\begingroup\$ Hello @C_Elegans I did what you suggest: sudo avrdude -c ft232r_mod -p ATMEGA328P -P ft0 -b 57600 -U flash:w:led.hex But when I hit enter, nothing happens. It's like the avrdude has entered in an infinite loop. I suspected it could be a connection issue and try to swap the MOSI and MISO wires but avrdude didn't change this odd behavior. \$\endgroup\$ – Oshio Feb 3 '18 at 22:04
  • \$\begingroup\$ I also have already uploaded a blinky code in the chip and expected the device to be reseted before the burning process started, but it continues to run like nothing its happening. I manually grounded 328p's resest pin, but didn't work either. \$\endgroup\$ – Oshio Feb 3 '18 at 22:09
  • \$\begingroup\$ Hmm. What happens if you remove the -U flash:w:led.hex? \$\endgroup\$ – C_Elegans Feb 3 '18 at 23:09
  • \$\begingroup\$ Still the same. \$\endgroup\$ – Oshio Feb 4 '18 at 1:19
  • \$\begingroup\$ So what is the current output of avrdude? \$\endgroup\$ – Chris Stratton Feb 4 '18 at 5:25
0
\$\begingroup\$

Avrdude needs to employ libftdi to get better control on the individual port lines of the adapter. Instead of /dev/ttyUSB0, it wants to read ft0 for the first FTDI interface.

\$\endgroup\$

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.