uint32_t writeError = UC3 + STK600 + JTAG;

Saving_to_device_failed

 

I can’t write to my AT32UC3A3 using my STK600 and AVR Dragon via JTAG! What do I do?!

My adventure in troubleshooting Atmel programmers/debuggers


 

I have been working on a prototype for an audio hub type device for my Ford F-150. The bluetooth connectivity is unreliable:

  1. Making a connection is difficult
  2. Connections don’t always stick
  3. Sometimes there is a strange behavior where the audio will speed up in short bursts

Anyway, I’ve been wanting to create a device that will connect to my phone via bluetooth (reliably) as well as serve up mp3 files from an SD card. I may go into more detail about this later, but that is not what I am writing about today.

I have been prototyping with Atmel’s STK600 and AVR Dragon. The microcontroller I choose for this project is the AT32UC3A3256S. Any of the AT32UC3A3 microcontrollers should work, but I was able to get Atmel to send me a sample of the AT32UC3A3256S. The reason I chose the AT32UC3A3 is because it supports high speed USB and more importantly, there is some example code that uses the AT32UC3A3.

I have been using my STK600 and AVR Dragon to program and debug an ATMEGA2560 via JTAG for a while and have had few issues. I decided that it was time to try this setup on my AT32UC3A3256S. Here was the result (using Atmel Studio 6.2) when I tried to push to the device:Saving_to_device_failed

Failed to launch program.
Error: Saving device failed.

That wasn’t encouraging. I decided I would see what information I could get from Device Programming tool (Ctrl+Shift+P).

avr_dragon_read_wo_68

I clicked the Apply button and then the Read button.

avr_dragon_read_wo_68_success

Success! …well, kinda. It was able to read the JTAG id, target voltage and the daisy chain configuration (programing multiple device).

I then tried programming the device via the memories tab.

avr_dragon_memories_wo_68

I clicked the Program button under the flash section.

failed_to_write_to_segment

Boom!

Failed to write segment at 0x80000000 to target for memorytype base

Well there is more information. In other words there are other words to use as search terms for Google. I tried this a few more times. I expected the same result but noticed the segment at which it fails doesn’t seem to always be 0x80000000. This didn’t tell me much but made sense in the end.

I then decided to search for “troubleshooting avr dragon.” The first result was exactly what I was looking for! On the first line of the document I found this:

Problem: Errors when programming or debugging Atmel AVR UC3 devices over JTAG

Reason: Ringing on the TCK line might lead to incorrect detection of rising edges on TCK. This is depending on the target board, and has shown to be a problem when connected to an AVR UC3 target on some Atmel STK600 configurations.

Solution: Add a series resistor on TCK (typically 68 Ohm) or add a capacitor of at least 1 nF between TCK and ground. The series resistor solution is the preferred one since it does not stress the Dragon level converters as much as the capacitor solution, but both solutions should work.

So now I need to create a new JTAG cable?! Ok…

68 ohm JTAG cable

 

After snipping, soldering and some hot glue I gave it another try.

avr_dragon_prog_w_68 avr_dragon_prog_w_68_success

Whoohooo! Success!

This type of issues can be aggravating and a big time sink, but I know they are part of the process of learning. I learn so much more from my failures than I do my successes.

Electronics, Making, Programming, Technology

Leave a Reply

Your email address will not be published. Required fields are marked *