ATMega328P and AVR Dragon (ISP) Not working - Page 1
Forum section: electronics / general

author: danergo
author_rank: Regular Contributor
timestamp: March 23, 2017, 09:14:50 pm
content: Hello, Guys,I just built a PCB with M328P, and I'm trying to program it with my AVR Dragon via ISP.Dragon is working for sure, it's after burning dozens of chips before.And the M328P should also be fine, I just opened its case (from tape).DC is 5V (4.81), no shorts, no heating happens.I have an XTAL soldered onto the board.When trying to connect to the chip with AVR Dragon (avrdude), I got an error:Code:sudo avrdude -cdragon_isp -pm328 -tavrdude: jtagmkII_setparm(): bad response to set parameter command: RSP_FAILEDavrdude: jtagmkII_getsync(): ISP activation failed, trying debugWireavrdude: jtagmkII_setparm(): bad response to set parameter command: RSP_DEBUGWIRE_SYNC_FAILEDavrdude: failed to sync with the AVR Dragon in ISP modeavrdude done. Thank you.Is M328P special somehow?Thanks very much!

author: alm
author_rank: Super Contributor
timestamp: March 23, 2017, 10:53:02 pm
content: Are all ISP lines connected correctly? Pull-up resistor on /RST not too low? Power supply connected and decoupled? ISP frequency not too high for the clock? I believe out of the box the 328 is set for the internal 1 MHz oscillator, so ISP frequency should be below 64 kHz.If you already changed some fuses, it is possible that the clock fuses are wrong or RSTDISBL/SPIEN were set, all of which could prevent ISP from working.For more ideas checkAVR042.

author: danergo
author_rank: Regular Contributor
timestamp: March 24, 2017, 06:02:06 am
content: Thanks for the tips.This is my schematic:.Of course, there are other peripherials on the chip too, but they are not yet soldered in.I've tried with avrdude -B 32, which should be the lowest frequency, but it resulted the same.Now looking on the AVR042. In the meantime, if you have any ideas based on my sch, it's more than welcome.Thanks!

author: danergo
author_rank: Regular Contributor
timestamp: March 24, 2017, 08:17:05 am
content: Is it a problem with this 328p if the xtal is applied before setting the fuses?Other MCUs dont care if xtal is installed before programming for the first time.Is ISP for 328P using the same pins as usual? (MISO, MOSI, SCK, RST)?(m128a used rx and tx for io)5V is getting into the MCU.It is not hot at all, so by sensing, everything is ok.Pin1 is well marked on this, and I'm using the TQFP32 version, which is pretty easy to solder, but I double checked it again.MISO, MOSI, SCK and RSTN are going to the header, then via cable to the dragon.All the wires are all right (measured by multimeter from dragon to my board).Is there anything else beside having a faulty m328p soldered in?Thanks

author: alm
author_rank: Super Contributor
timestamp: March 24, 2017, 11:53:32 am
content: ISP to MISO/MOSI/SCK/RST is correct. I assume ground and +5V are also connected to the header (shown on the schematic, but for troubleshooting you sometimes have to ask the stupid questions)?With default fuse settings the crystal should not matter, since it is using the internal 8 MHz RC oscillator with /8 divider. Just to be sure, you did not succeed one time in programming and somehow changed the fuses? Is the ATmega328p blank or was it loaded with an Arduino bootloader or something else that might have changed its fuse settings?The other things I can think off is apart from verifying all connections are:- Test ISP from the Dragon to some other, known-working, target. The old version (pre-2009 or so) without mounting holes was quite fragile and used to kill its DC-DC converter if you looked at it funny. The new version was much better, but it is still not the most robust tool without any case.- Test for shorts between any of the pins you connect (e.g. MOSI/MISO/SCK/RST/VCC/GND).- Try removing the crystal and feed a 1 MHz clock to XTAL1 (the Dragon may have an output, or generate it with another AVR with CLKOUT or a function generator). This should recover from most incorrect fuse settings.- Wire the AVR up for high-voltage parallel programming. This will require you to remove most components from this PCB and connect about two dozen wires between the Dragon and this board. Note that this uses high voltage (12 V) signals, so be sure to remove things like voltage regulators. This should work regardless of the fuse settings. Soldering in another AVR would be quicker, however.