AVR: Only able to read Device-ID once, ISP-error - Page 1
Forum section: electronics / general

author: Araho
author_rank: Regular Contributor
timestamp: April 06, 2014, 05:41:28 pm
content: Hi!I'm having some trouble with my newest project, which uses an ATMega16U4. Specifically, when I try to connect my AVR Dragon to the PCB for firmware uploading, fuses etc, I can only do one ISP-operation before it fails. I've tried searching for similar issues over the interwebz, but found no viable solution.Replicating the problem:I connect the ISP-cable to the dragon from the PCB, power the board and press Read Target Voltage, which gives 4.9-5.2V, depending on where I power it from. Then i press Read Device Signature, and it produces 0x1E9488, as expected. If I press Read Device Signature again, I get an "Unable to enter programming mode"-error. Statuscode 0 and a signature of 0x000102.Info about the circuitI suspected a timing-issue, so even though I have a 16MHz crystal connected (with loading capacitors), I set the fuses to use the internal RC oscillator to check. Still got the same issue. Also, when setting fuses, I have to turn off/on the DUT between each read/program of the fuses. Fuses are currently set: Low: 0x6F, High: 0x99, Extended: 0xF3 (I've also tried several different fuse configurations, regarding clock source and start-up time).The SPI-lines are also used for LCD-datalines in the circuit, and are isolated from the LCD with 1k resistors in series, see picture 1.The ISP-connector is connected as in picture 2. I don't expect there to be a problem with this, as I actually get a valid device signature once. All physical connections have been checked thrice, with beep mode on the multimeter. I've resoldered several of the pins on the MCU just in case. All power/gnd-connections on the device have correct voltage levels on them.If anyone has an idea here, it would be awfully nice of you to share it. I'm still a beginner with AVRs, so hopefully it's just something stupid I've overlooked.

author: westfw
author_rank: Super Contributor
timestamp: April 07, 2014, 01:03:21 am
content: is RESET connected properly between dragon and chip? Your first operation might benefit from power-on reset...

author: senso
author_rank: Frequent Contributor
timestamp: April 07, 2014, 03:48:47 am
content: Lower the programming speed, with 1k in the spi lines you cant expect to be able to program the chip at much more than 250Khz.

author: Araho
author_rank: Regular Contributor
timestamp: April 07, 2014, 02:07:16 pm
content: Update:I've now got another board working with only the bare minimum of components soldered on. This leads me to believe that there is either something wrong with the soldering after all (most likely) or that some part of the circuit is interfering (not that likely, since the only things different are the isolation resistors and the pullup on RESET).Senso: I'm not working at more than 125kHz or 64kHz. Tried different speeds, of course.westfw: This sounds like it's worth checking again. However, it doesn't work if I press the reset button on the pcb between attempts or hold it down while trying again. I'm maybe suspecting that a 20k pullup on the RESET-line is too strong? I'll recheck / resolder the RESET-line from ISP-header to chip anyway, thanks!

author: Araho
author_rank: Regular Contributor
timestamp: April 08, 2014, 01:55:39 am
content: Well, I found the bloody error. Argh. I'm using an SMT pushbutton with two tabs on each side. Apparently, those tabs were connected in pairs, opposite from the way they were connected in my parts library, so there was a constant short to GND on the RESET-line, after the pullup.Removed the switch and it works perfectly. Time to either cut some tracks or leave out the reset-button.Thanks for the help guys, you steered me in the right direction by looking at the RESET-line.

author: David_AVD
author_rank: Super Contributor
timestamp: April 08, 2014, 01:58:12 am
content: Now you know why it's a good idea to measure voltages instead of assuming the circuit is so simple nothing could be wrong.

author: westfw
author_rank: Super Contributor
timestamp: April 08, 2014, 02:01:19 am
content: QuoteWould that be a commonly used parts library that we should watch out for, or your own mistake?In any case, thanks for the update. It's always nice to hear how things turn out.

author: Araho
author_rank: Regular Contributor
timestamp: April 08, 2014, 04:11:04 pm
content: westfw: Totally my own library and my own fault. No reason to be nervous, just a reminder to double-check your pinouts before you send gerbers to production.David: Hehe, I was actually measuring voltages, I just didn't mentally connect the voltage level on the line with a problem. At least not until I had a working unit to compare it with

author: David_AVD
author_rank: Super Contributor
timestamp: April 08, 2014, 09:11:22 pm
content: Yeah, you gotta remember that reset is almost always active low for microcontrollers.