1284p Bootloader w/Arduino as ISP

Hello,

I'm trying to upload a bootloader to a 1284p TQFP44 with a standard layout. I'm using as my guideline this post here: Mighty-1284p repo updated for IDE 1.6.x - Microcontrollers - Arduino Forum. I'm using Arduino IDE v1.6.3 and Arduino as ISP. I chose "avr-developers.com pinout 16MHz using Optiboot" for my board selection.

A picture of my hardware setup is attached. I have a green wire soldered to my reset pin because I realized my FTDI header reset port will be going through a 0.1uF capacitor, so I bypassed it by just soldering the wire from the Arduino straight to the reset switch leg (which is directly connected to the reset pin of the 1284p). Also, I lost one of the 22pF SMT capacitors for the oscillator, so that is why I have a THT one soldered there instead.

A .txt file of my error message in the Arduino IDE is attached.

Alternatively, I also tried this guideline: GitHub - MCUdude/MightyCore: Arduino hardware package for ATmega1284, ATmega644, ATmega324, ATmega324PB, ATmega164, ATmega32, ATmega16 and ATmega8535. I used Arduino IDE v1.6.11 for that version instead. I was getting the same sync issue.

The 1284p is getting 5V at VCC, and there no signs of any faulty wiring connections. The Arduino Uno that I am using is uploading other sketches no problem.

Any idea what my issue is?

Thank you,

1284p programming with Arduino as ISP.JPG

1284p Bootloader Error.txt (1.99 KB)

Did you upload File > Examples > 11.ArduinoISP > ArduinoISP to your Uno?

You have not uploaded Arduino as ISP to the arduino being used as a programmer, or you have not disabled reset on the Arduino (the easy way is to put 10uF cap between reset and ground on the programmer.). This sometimes seems to be necessary, and sometimes not; I've been told the behavior here was improved in a somewhat-recent version of the IDE. (I recommend MightyCore with 1.8.5 of the IDE - current release is excellent; the whole 1.8.x series has been solid, unlike 1.6.x which had a lot of bad releases)

FedorAdarichev:
I have a green wire soldered to my reset pin because I realized my FTDI header reset port will be going through a 0.1uF capacitor, so I bypassed it by just soldering the wire from the Arduino straight to the reset switch leg (which is directly connected to the reset pin of the 1284p).

NO! It sounds like you had it wired correctly, and then went out of your way to break it.

There is no reset pin on an FTDI adapter.

The DTR (or RTS) output of the FTDI (or other USB-serial) adapter goes to one side of a 0.1uF cap, and the other side of the cap goes to the reset pin of the AVR. You MUST have the 10k pullup resistor from the reset pin to Vcc.

When the port is opened, DTR goes low and stays low. The cap and pullup form an R-C circuit to convert that high to low edge into a low pulse - which is what we need, because we must bring the reset line low, but then release it (if we don't release it, the chip will be held in reset state and do nothing).

Of course, you're not getting the bootloader uploaded, so you're well before the point that this becomes an issue.

I lost one of the 22pF SMT capacitors for the oscillator

I have had crystals get thermal shocked when soldering, it is risky to solder near those things. Also, I think the crystal load capacitors both need to have a good temperature coefficient (e.g. an NPO).

@Pert:

Yes, I was using that sketch, but I did not actually upload it.

@ron_sutherland

I was not aware, thanks for the tip. However, I was able to upload the bootloader (see below), so I am not sure if this indicates that the oscillator is shocked or not?

@DrAzzy:

I was naming my pins incorrectly. We are on the same page about the DTR pin, which is what I meant when I said "reset" pin. I have the DTR pin connected through a 0.1uF capacitor to the reset pin on the 1284p, and I have a 10k pull-up resistor from that reset line going to VCC, which I verified is actually giving me 5V to pull-up with using a multimeter.

That being said, I tried your recommendations and I got the bootloader burned! These are the changes I made:

  1. Installed Arduino v1.8.6
  2. Followed the instructions of this site: http://www.instructables.com/id/Arduino-18x-Clone-With-Atmega-853532644p1284p-the-/
  3. Selected the ArduinoISP sketch, and uploaded it successfully with "Arduino Uno" selected under boards.
  4. Connected all my wires to the 1284p clone board that I have, with reset still soldered to the leg of the reset switch so its a direct connection.
  5. Selected board: "ATmega 1284", variant "p", B.O.D. 2.7V, pinout standard, 16MHz crystal.
  6. Selected Programmer "Arduino as ISP (MightyCore)", and hit burn bootloader.

Now, the problem is that I cannot upload my sketches using the FTDI adapter I have. I have two adapters, and they were both working before on my 328p clone board, so I do not think they are at fault. I have selected "1284" under boards, and all the same settings that I had when I burned the bootloader. I'm getting the following error message when I try to upload:

vrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x01

That same "resp=0x01" repeats 10 times.

Any idea what my issue is now?

Thanks,

How do you have DTR and reset wired now? What's connected to reset? It should only be connected to one side of that cap (the other side of which goes to DTR on FTDI adapter), and the pullup (and optionally one side of a reset button).

If there is a reset line on your FTDI adapter, it should not be connected to the Arduino at all.

It's wired like this:

DTR-------- 0.1uF cap ------- Reset on 1284P
|
|----Reset Switch (N.O.) ----GND
|
10K Resistor
|
|
|
Vcc

The arduino is not not involved in any way anymore, I'm just trying to use the FTDI adapter to upload my sketch to the 1284p clone board.

Okay good. That looks right...

When I'm uploading sketches using my FTDI adapter, what do I need to have selected under Programmer? Does it still matter in this case or this selection only relevant when I burn the bootloader?

"It's wired like this:

DTR-------- 0.1uF cap ------- Reset on 1284P
|
|----Reset Switch (N.O.) ----GND
|
10K Resistor
|
|
|
Vcc
"

Any possibility you have a capacitor tied across your reset button? On some minimum system boards I have with the capacitor on the reset I am able to get the FTDI to work by tying a 10uF Cap between the DTR and reset instead of the 0.1uF Cap.

FedorAdarichev:
this selection only relevant when I burn the bootloader?

It's only relevant for Tools > Burn Bootloader and Sketch > Upload Using Programmer for standard uploads it makes no difference.

I do not have any capacitors tied across my reset switch. I have tried using a 10uF capacitor instead of the 0.1uF capacitor from DTR to Reset, and its still giving me an error.

Would a damaged oscillator be the problem, as ron_sutherland was mentioning? Because I was able to upload my bootloader, so I'm assuming at this point that the hardware on my clone board is OK, but is the crystal being used during the bootload burning?

Try connecting your ISP programmer again and doing another Tools > Burn Bootloader as a test. The first time you did it the microcontroller was likely running on the internal clock, as that is the factory default setting. But when you did the first Burn Bootloader, if you had Tools > Clock set to 16 MHz external oscillator then it changed the fuses to use the external clock source. If your crystal isn't working this will cause the second attempt at Burn Bootloader to fail since the microcontroller now requires an external clock source to run.

I tried again, using the Arduino Uno to burn the bootloader. The bootloader was successful. I tried again to upload the sketch using the FTDI adapter, and still getting same error.

Perhaps if you have an LED on the 1284p board burn a blink sketch with the ISP and see if the LED blinks with the timing you expect. May also want a duplicate blink running on the Uno so you can see if the rate is drifting apart.

I would:

Show Verbose Upload, post output here, including that first line where it shows the avrdude invocation.

Watch while it uploads, does the LED give the optiboot blink (is there an LED on the pin that the core assumes?) - this is a very important debugging step, as it tells you whether the chip is getting correctly reset when DTR goes low. If it does, it should be working.

If not, does the LED blink when you press reset? If it does - it's the autoreset circuit - if not either there isn't an LED on that pin, or the bootloader isn't running at all.

If it "should be working" per above:

  • If you're not using a professionally made cable with the correct pinout for DTR/TX/RX/Vcc/Gnd - if not, swap TX/RX in case you got that backwards (my success rate with TX/RX and SDA/SCL on first try is barely better than random), see if that fixes it :stuck_out_tongue: (switch it back the way you expect it to be if this doesn't work)
  • You're using MightyCore to burn the bootloader - you're using MightyCore to upload right?

Here is my output:

Sketch uses 1216 bytes (0%) of program storage space. Maximum is 130048 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 16375 bytes for local variables. Maximum is 16384 bytes.
C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CC:\Users\ME\AppData\Local\Arduino15\packages\MightyCore\hardware\avr\1.0.6/avrdude.conf -v -patmega1284p -carduino -PCOM7 -b115200 -D -Uflash:w:C:\Users\ME\AppData\Local\Temp\arduino_build_83994/Blink.ino.hex:i

avrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch

System wide configuration file is "C:\Users\ME\AppData\Local\Arduino15\packages\MightyCore\hardware\avr\1.0.6/avrdude.conf"

Using Port : COM7
Using Programmer : arduino
Overriding Baud Rate : 115200
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0xff
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0xff
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0xff
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0xff
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0xff
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0xff
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0xff
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0xff
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0xff
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0xff

avrdude done. Thank you.

Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

I soldered an LED to PB0 on the 1284p, and when I hooked up my FTDI adapter to the computer to upload the sketch (provided power to my clone board), that LED blinked three times. When I hit upload on the sketch, the "TX" LED on the FTDI adapter blinked three times. The LED on the MCU actually did different things. It either didn't blink at all when trying to upload, or it actually did start blinking randomly. It also did not blink when I had power provided through the FTDI adapter and I hit the reset button.

I tried to re-burn the bootloader, I am getting this error message now:

Error while burning bootloader.
Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
this check.

I am for sure using MightyCore. I switched the TX/RX wires on the FTDI, and it still gives me the same error.

"I can see your approach, but I can't even get any sketch to upload, that's the problem."

Using "Sketch/Upload Using Programmer"?

@kprims

When I try and upload using programmer (Arduino Uno), I get the following error:

An error occurred while uploading the sketch
Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
this check.

avrdude done. Thank you.

The LED on the 1284p board (on pin PB0) blinks repeatedly with double pulses while plugged in with the Arduino Uno. There are no such pulses when I hit upload with the programmer, though.

0x000000 signature indicates wiring mistake or that the clock is no longer running; That would explain why nothing else was working.

I think your replacement crystal loading cap is the problem here; a film cap really isn't appropriate for use as a loading cap (or a decoupling cap, for that matter, for the same reason - too much parasitic inductance) - you need a ceramic one - and that film cap also looks too big to be 22pf too; the loading cap must be the correct capacitance.