I programming atmega328P bootloaded with an FTDI.
Some tutorial mentions that you have to connect the DTR to the reset pin:
http://electronics-diy.com/FT232RL_USB_to_Serial_Adapter_for_PIC_AVR_ATMEGA_ARDUINO_MCUs.php
Is that so? Because some don't, they just say rx,tx is enough. I still can't program the chip with the error:
avrdude -p m328p -P /dev/ttyUSB0 -c avrisp -b 9600 -n -v -v -v
avrdude: Version 5.11.1, compiled on Oct 18 2011 at 21:17:35
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch
System wide configuration file is "/etc/avrdude.conf"
User configuration file is "/root/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
Using Port : /dev/ttyUSB0
Using Programmer : avrisp
Overriding Baud Rate : 9600
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude done. Thank you.
I tried different baud rates, no matter what it's not responding. Linux recognizes the FTDI as:
Sat Feb 13 22:52:14 2016] ftdi_sio ttyUSB0: FTDI USB Serial Device converter now disconnected from ttyUSB0
[Sat Feb 13 22:52:14 2016] ftdi_sio 1-2.1:1.0: device disconnected
[Sat Feb 13 22:52:19 2016] usb 1-2.1: new full-speed USB device number 73 using uhci_hcd
[Sat Feb 13 22:52:20 2016] usb 1-2.1: New USB device found, idVendor=0403, idProduct=6001
[Sat Feb 13 22:52:20 2016] usb 1-2.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[Sat Feb 13 22:52:20 2016] usb 1-2.1: Product: FT232R USB UART
[Sat Feb 13 22:52:20 2016] usb 1-2.1: Manufacturer: FTDI
[Sat Feb 13 22:52:20 2016] usb 1-2.1: SerialNumber: A6004mhS
[Sat Feb 13 22:52:20 2016] ftdi_sio 1-2.1:1.0: FTDI USB Serial Device converter detected
[Sat Feb 13 22:52:20 2016] usb 1-2.1: Detected FT232RL
[Sat Feb 13 22:52:20 2016] usb 1-2.1: FTDI USB Serial Device converter now attached to ttyUSB0
[Sat Feb 13 22:56:25 2016] usb 1-2.1: USB disconnect, device number 73
[Sat Feb 13 22:56:25 2016] ftdi_sio ttyUSB0: FTDI USB Serial Device converter now disconnected from ttyUSB0
[Sat Feb 13 22:56:25 2016] ftdi_sio 1-2.1:1.0: device disconnected
Well my questions now are:
1, When I use the Arduino IDE to program a barebone 328P with this FTDI what should be the BOARD and what should be the PROGRAMMER?
Right now I have it on Arduino Nano/Atmega328 + AVRISP mkII
Although I tried almost all... I think something else is wrong.
2, Should I be able to get any result with doing the previous:
avrdude -p m328p -P /dev/ttyUSB0 -c avrisp -b 9600 -n -v -v -v
command WITHOUT connecting the barebone chip? I think not, since this doesn't act like a fully fledged MCU just like a serial converter.
Thanks
2 Answers 2
Right now I have it on Arduino Nano/Atmega328 + AVRISP mkII
Tha AVRISP is not an FTDI programmer. How do you have it wired up?
See: How to make an Arduino-compatible minimal board
From that page, this is how I hooked up my FTDI cable:
And a close-up:
You need RTS, via a 0.1 μF capacitor (in series) in order to trigger a reset.
You need to connect DTR to the reset pin because the Arduino IDE (really avrdude) needs to be able to reset the processor in order to return control to the bootloader, which will then receive the new program. When an Arduino board is running your sketch, the serial port is available for use by the sketch; it can't be used to upload a new program.
To answer your first question, you should set the board to whatever your board actually is. You don't have to worry about the programmer. It's only used if you use the "upload with programmer" function. The normal "upload" function uses the serial port to send the sketch to the board via the bootloader. That's what you want. Note that while you don't have to set the programmer, you do have to set the port.
You can use avrdude to program the Arduino through the serial port via the bootloader. That's exactly what the IDE does. You have to specify the port just as you do in the IDE. To determine the other settings, look up your board in the Arduino IDE's boards.txt file. Most of what boards.txt does is tell the IDE how to invoke avrdude.
I suspect that one reason why avrdude isn't working for you is that you've set the baud rate to 9600. According to boards.txt the upload speed for the Nano with the ATmega328P is 57600.
arduino
for the programmer type. You may have to fiddle with baudrate, not sure what the default baudrate is.mcu=atmega1280
,freq=16000000L
,baud=57600
,port=/dev/ttyUSB002
,avrdude -p$mcu -carduino -P$port -b$baud -D -Uflash:w:./project.hex:i