Pages: [1]   Go Down
Author Topic: Trouble programming ATMEGA328 via FTDI cable  (Read 2169 times)
0 Members and 1 Guest are viewing this topic.
Zürich, Switzerland
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I'm trying to program an ATMEGA328-PU-ND chip using an FTDI cable but i'm getting a "programmer not responding" error.  I'm hoping someone can help, it's driving me a little crazy.  I've attached basic setup, arduino and error details at the bottom of the post. (I also have verbose console output if anyone thinks that may be useful)

As for how i'm going about trying to program the chip - I've set up a breadboard arduino, according to the layout below and followed the assembly guide here http://bit.ly/R6bq1o. It shows a ATMEGA168 in the picture, but the website i got it from (oomlout.co.uk) sells a kit with a ATMEGA328 chip and gives this layout as instructions, so i guess the chip should work in this setup.

The chip I have didn't come with a bootloader, but after quite a lot of messing around I think I have successfully installed a bootloader on it - When i press the reset button, the pin-13 LED flashes a couple of times, so i think that means the bootloader is probably installed ok?

When trying to upload a sketch, I've tried pushing the reset button, and leaving a delay of bewteen 0 and 10 seconds before clicking upload in the IDE, but that doesn't make any difference.

One thing about my FTDI cable - most seem to come with 6 wires, and the picture of mine had 6 wires when I ordered it.  However, mine has 7 wires, so i connected up 6 according to the colors in the diagram, and left the blue one free.  Maybe that's a problem?

Cheers
Dave



SETUP
OS: OSX 10.6.8  with FTDI Driver Installed
IDE: Arduino IDE 1.0.1
Chip: ATMEGA328-PU-ND (not the low power version) http://bit.ly/S0avPL
Cable: FTDI TTL-232R-3V3 http://bit.ly/S0apYp

ARDUINO IDE OPTIONS
Board: Tried with Arduino UNO and Duemilanove w/ ATMega328
Serial Port: /dev/tty.usbserial-FTGA2V29
Programmer: AVRISP mkII

CONSOLE OUTPUT
avrdude: Version 5.11, compiled on Sep  2 2011 at 18:52:52
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf"
         User configuration file is "/Users/gabbymoore/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/tty.usbserial-FTGA2V29
         Using Programmer              : arduino
         Overriding Baud Rate          : 115200
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
Logged

Norfolk UK
Offline Offline
Edison Member
*
Karma: 52
Posts: 2214
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
The chip I have didn't come with a bootloader, but after quite a lot of messing around I think I have successfully installed a bootloader on it - When i press the reset button, the pin-13 LED flashes a couple of times, so i think that means the bootloader is probably installed ok?
Did you install the correct bootloader. Have a look at this article http://arduino.cc/en/Tutorial/ArduinoISP it may help (assuming you have not already used it)
Quote
When trying to upload a sketch, I've tried pushing the reset button, and leaving a delay of bewteen 0 and 10 seconds before clicking upload in the IDE, but that doesn't make any difference.
If you have installed a more modern bootloader that expects auto reset from the programmer then timing might be an issue. Old bootloaders would wait upto 8 seconds for serial programming data but the newer ones only a second or two.
Quote
One thing about my FTDI cable - most seem to come with 6 wires, and the picture of mine had 6 wires when I ordered it.  However, mine has 7 wires, so i connected up 6 according to the colors in the diagram, and left the blue one free.  Maybe that's a problem?
Do you have a link to the FTDI device, a picture of what you have or a list of what the pins are named? (I.E. Tx,Rx,Vcc,Gnd,RTS,DTR)
Logged

Handle every stressful situation like a dog. If you can't eat it or hump it. Piss on it and walk away.

Zürich, Switzerland
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the response Riva,

Firstly, I've attached the breadboard layout I'm using, as it didn't appear correctly in my original post.

What I have is a FTDI USB Cable, a bit like the one below, but it came with a 8-pin header rather than a standard 6-pin one. I've since removed the header to get it to fit my breadboard (I'll attach a photo of the original header) and am using the black, brown, red, orage, yellow and green wires as shown in the breadboard layout.  I'm totally unsure if that should work - the cables may well be completely incompatible.

 


I think I did install the correct bootloader.  I followed the instructions on the same page you linked to, using the setup pictured on the right at the bottom of the page.  I had to make a change in the avrdude.conf file as i'm using the Non-P version of the ATMEGA 328 chip, but it seemed to work correctly.  Also, i was using the latest version of the IDE, and had Arduino UNO selected, so i think it should be the correct bootloader.  I've run the Chip Detector sketch supplied by Nick Gammon and i get the results below, so it looks like the bootloader is on there - Well, it looks like a bunch of numbers are on there  smiley-lol . The results are below:

Code:
Atmega chip detector.
Entered programming mode OK.
Signature = 1E 95 14
Processor = ATmega328
Flash memory size = 32768
LFuse = FF
HFuse = DE
EFuse = FD
Lock byte = CF
Clock calibration = 9A
Bootloader in use: Yes
EEPROM preserved through erase: No
Watchdog timer always on: No
Bootloader is 512 bytes starting at 7E00

Bootloader:

7E00: 11 24 84 B7 14 BE 81 FF F0 D0 85 E0 80 93 81 00
7E10: 82 E0 80 93 C0 00 88 E1 80 93 C1 00 86 E0 80 93
7E20: C2 00 80 E1 80 93 C4 00 8E E0 C9 D0 25 9A 86 E0
7E30: 20 E3 3C EF 91 E0 30 93 85 00 20 93 84 00 96 BB
7E40: B0 9B FE CF 1D 9A A8 95 81 50 A9 F7 CC 24 DD 24
7E50: 88 24 83 94 B5 E0 AB 2E A1 E1 9A 2E F3 E0 BF 2E
7E60: A2 D0 81 34 61 F4 9F D0 08 2F AF D0 02 38 11 F0
7E70: 01 38 11 F4 84 E0 01 C0 83 E0 8D D0 89 C0 82 34
7E80: 11 F4 84 E1 03 C0 85 34 19 F4 85 E0 A6 D0 80 C0
7E90: 85 35 79 F4 88 D0 E8 2E FF 24 85 D0 08 2F 10 E0
7EA0: 10 2F 00 27 0E 29 1F 29 00 0F 11 1F 8E D0 68 01
7EB0: 6F C0 86 35 21 F4 84 E0 90 D0 80 E0 DE CF 84 36
7EC0: 09 F0 40 C0 70 D0 6F D0 08 2F 6D D0 80 E0 C8 16
7ED0: 80 E7 D8 06 18 F4 F6 01 B7 BE E8 95 C0 E0 D1 E0
7EE0: 62 D0 89 93 0C 17 E1 F7 F0 E0 CF 16 F0 E7 DF 06
7EF0: 18 F0 F6 01 B7 BE E8 95 68 D0 07 B6 00 FC FD CF
7F00: A6 01 A0 E0 B1 E0 2C 91 30 E0 11 96 8C 91 11 97
7F10: 90 E0 98 2F 88 27 82 2B 93 2B 12 96 FA 01 0C 01
7F20: 87 BE E8 95 11 24 4E 5F 5F 4F F1 E0 A0 38 BF 07
7F30: 51 F7 F6 01 A7 BE E8 95 07 B6 00 FC FD CF 97 BE
7F40: E8 95 26 C0 84 37 B1 F4 2E D0 2D D0 F8 2E 2B D0
7F50: 3C D0 F6 01 EF 2C 8F 01 0F 5F 1F 4F 84 91 1B D0
7F60: EA 94 F8 01 C1 F7 08 94 C1 1C D1 1C FA 94 CF 0C
7F70: D1 1C 0E C0 85 37 39 F4 28 D0 8E E1 0C D0 85 E9
7F80: 0A D0 8F E0 7A CF 81 35 11 F4 88 E0 18 D0 1D D0
7F90: 80 E1 01 D0 65 CF 98 2F 80 91 C0 00 85 FF FC CF
7FA0: 90 93 C6 00 08 95 80 91 C0 00 87 FF FC CF 80 91
7FB0: C0 00 84 FD 01 C0 A8 95 80 91 C6 00 08 95 E0 E6
7FC0: F0 E0 98 E1 90 83 80 83 08 95 ED DF 80 32 19 F0
7FD0: 88 E0 F5 DF FF CF 84 E1 DE CF 1F 93 18 2F E3 DF
7FE0: 11 50 E9 F7 F2 DF 1F 91 08 95 80 E0 E8 DF EE 27
7FF0: FF 27 09 94 FF FF FF FF FF FF FF FF FF FF 04 04

MD5 sum of bootloader = FB F4 9B 7B 59 73 7F 65 E8 D0 F8 A5 08 12 E7 9F

First 256 bytes of program memory:

0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
10: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
20: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
30: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
40: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
50: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
60: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
70: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
80: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
90: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
A0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
B0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
C0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
D0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
E0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
F0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF


As regards the delay, I've tried with a whole range of delays and it doesn't seem to make any difference, so i don't think it is that.


* Breadboard Layout.png (416.48 KB, 379x585 - viewed 129 times.)

* Detatched Header.jpg (160.89 KB, 1054x893 - viewed 17 times.)
Logged

Zürich, Switzerland
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Just confirmed on Nick Gammons website that the bootloader checksum on the chip matches what is expected for arduino UNO programmed via Adruino IDE 1.0 i.e. FB F4 9B 7B 59 73 7F 65 E8 D0 F8 A5 08 12 E7 9F.  So, I think it is safe to assume the bootloader is good.

More details regarding the cable I am using:  Based on the datasheet from the FTDI website, the cable looks to have the necessary wires i.e. Black - GND, Brown - CTS, Red - VCC, Orange - TXD, Yellow - RXD, Green - RTS.  The only difference to the standard 6-pin cable is that I have an additional blue wire, which the datasheet says is RI (Ring Indicator Control Input), which isn't connected to anything. 

So, I'm worried that having that blue wire dangling could be causing a problem.

My other worry is that the cable I'm using is 3.3V, whereas some i see are 5V.  Maybe this could be causing an issue?
Logged

0
Offline Offline
Shannon Member
****
Karma: 162
Posts: 10496
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Are you powering the board via the FTDI lead and what frequency crystal do you have?  If the board is running at 5V and you plug the 3.3V FTDI cable into it you should have ~10k resistors in the signal lines to protect the FTDI chip, or some level-shifting circuit - also the DTS reset generation probably won't work from a lower voltage.

If the board is running at 3.3V then a 16MHz crystal is pushing the limits for that voltage (but usually works in practice).
Logged

[ I won't respond to messages, use the forum please ]

Zürich, Switzerland
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Mark,

Yes, the board is being powered from the FTDI cable. 

I've followed the layout i downloaded for a breadboard arduino, which has a 10K resistor between the RX pin on the chip and the TXD wire (Orange).  However, there's no resistor between the TX pin on the chip and the RXD wire.  Do you think that could be an issue?
Logged

0
Offline Offline
Shannon Member
****
Karma: 162
Posts: 10496
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No that should be fine - so assuming the xtal is running ok on 3.3V it should work - but reset is an issue with modern bootloader you have 1/2 a second or so to press the button if auto-reset isn't working.

That Oomlout circuit seems to be wrong - CTS isn't grounded so it'll float leading to intermittent operation - it should be at logic 0 to allow the FTDI chip to send serial to the 328.  Connect a 100nF cap between RTS pin and the reset pin and you should get auto-reset too...
Logged

[ I won't respond to messages, use the forum please ]

Zürich, Switzerland
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Woopwoop!!!  It works!!  The capacitor between the RTS and reset pin did the trick   smiley smiley

Thanks a lot Mark, I'm really grateful for your help.  I'm just starting to get into this stuff and i've got a lot to learn, so it's really great to have a forum like this with kind, helpful people to help point newbs like me in the right direction
Logged

Pages: [1]   Go Up
Jump to: