Serial AVR-JTAG not working properly.

Hi all,

I’m trying to use the serial port version of Olimex’s AVR JTAG with an STK500 board (with ATMega16) and gcc development platform (20050214 release). I have successfully used the JTAG for a short time before and started using it again a few days back. I saw some issues when I recently started using it. It did not stop at the breakpoint specified and things like that. Using avarice, I played around with the bitrate and power-cycled my board a few times. While I was trying this, I noticed that the JTAG LED didn’t come back up anymore. Now when I try running avarice in debug mode, I see output similar to that underneath. Eventhough this is for the default bitrate, I’ve tried it with 500KHz, 250KHz and 125KHz also with similar results.

avarice -d --jtag /dev/ttyS0 :4242

AVaRICE version 2.3, Feb 10 2005 17:55:46

Defaulting JTAG bitrate to 1 MHz. Make sure that the target

frequency is at least 4 MHz or you will likely encounter failures

controlling the target.

JTAG config starting.

Attempting synchronisation at bitrate ff

command[S, 1]: 53 45 20 20

Out of sync, reponse was `fc’

command[S, 1]: 53 20 20

Out of sync, reponse was `fc’

command[S, 2]: 53 45 20 20

Out of sync, reponse was `fc’

command[S, 1]: 53 20 20

Out of sync, reponse was `fc’

command[S, 3]: 53 45 20 20

Out of sync, reponse was `fc’

command[S, 1]: 53 20 20

Out of sync, reponse was `fc’

Attempting synchronisation at bitrate fa

command[S, 1]: 53 45 20 20

Out of sync, reponse was `d7’

command[S, 1]: 53 20 20

Out of sync, reponse was `d7’

command[S, 2]: 53 45 20 20

Out of sync, reponse was `d7’

command[S, 1]: 53 20 20

Out of sync, reponse was `d7’

command[S, 3]: 53 45 20 20

Out of sync, reponse was `d7’

command[S, 1]: 53 20 20

Out of sync, reponse was `f7’

Attempting synchronisation at bitrate fe

command[S, 1]: 53 45 20 20

Out of sync, reponse was `72’

command[S, 1]: 53 20 20

Out of sync, reponse was `fe’

command[S, 2]: 53 45 20 20

Out of sync, reponse was `72’

command[S, 1]: 53 20 20

Out of sync, reponse was `fe’

command[S, 3]: 53 45 20 20

Out of sync, reponse was `72’

command[S, 1]: 53 20 20

Out of sync, reponse was `fe’

Attempting synchronisation at bitrate fd

command[S, 1]: 53 45 20 20

command[S, 1]: 53 20 20

response: 56 52 42 4F 4F 54 3F 3F

command[S, 2]: 53 45 20 20

command[S, 1]: 53 20 20

response: 56 52 42 4F 4F 54 3F 3F

command[S, 3]: 53 45 20 20

command[S, 1]: 53 20 20

response: 56 52 42 4F 4F 54 3F 3F

Attempting synchronisation at bitrate f4

command[S, 1]: 53 45 20 20

Out of sync, reponse was `fa’

command[S, 1]: 53 20 20

Out of sync, reponse was `fa’

command[S, 2]: 53 45 20 20

Out of sync, reponse was `fa’

command[S, 1]: 53 20 20

Out of sync, reponse was `fa’

command[S, 3]: 53 45 20 20

Out of sync, reponse was `fa’

command[S, 1]: 53 20 20

Out of sync, reponse was `fa’

Failed to synchronise with the JTAG ICE (is it connected and powered?)

Anyone have any idea as to what I’m doing wrong? Is my JTAG hosed? I’m not sure what I did to break it. I can detect the STK500 board through AVR Studio my COM port is fine but even AVR Studio can’t detect the JTAG.

I did some more digging - from avarice code the commands seen in my previous posting are used by avarice to sync up with the JTAG.

Commands seen:

53 45 20 20 => "SE "

53 20 20 => "S "

A valid response to these commands would be “AVRNOCDA”.

Olimex JTAG seems to be responding to avarice commands at 38400 baud rate but instead responds back with:

56 52 42 4F 4F 54 3F 3F => “VRBOOT??”

Olimex,

Do you guys know what could incite this behavior?

Thanks,

Manbir.

Why not as start to download AVRStudio 4.11 and try to work through it?

At lests AVR-JTAG is buld to work with it and AVaRice probably chating the AVRStudio protocol, thus may not be compatible with all releases of the firmware.

Tsvetan

Thanks for the response, Tsvetan. I had already tried connecting my JTAG with AVRStudio as I mentioned in my first email. AVR studio doesn’t detect the JTAG. I have Version 4.11 build 401 of AVR Studio.

Some days back, I’ve used the same JTAG with avarice successfully for a short time. I don’t believe in voodoo so there must have been something that I did but I can’t figure out what. All I remember doing was change my baud-rate in avarice and power-cycle STK500 a few times.

Regards,

Manbir.

please try to re-flash the firmware, on our web is written how to enable manually the internal bootloader

Tsvetan

Thanks Tsvetan. That worked. Atmel must have some code for it’s JTAG-ICE to self-destruct itself. For others who need to upgrade the AVRJTAG with STK500 the following connection can be used between ISP6PIN and JTAG.

ISP6-PIN1 (MISO) ↔ JTAG-PIN3

ISP6-PIN2 (VTG) ↔ JTAG-PIN4 and JTAG-PIN7 ↔ Vcc

ISP6-PIN3 (SCK) ↔ JTAG-PIN1

ISP6-PIN4 (MOSI) ↔ JTAG-PIN9

ISP6-PIN5 (RST) ↔ JTAG-PIN-RESET

ISP6-PIN6 (GND) ↔ JTAG-PIN2 ↔ GND

Thanks,

Manbir.

Hi,

there is nothing with the code, just if your power supply is not well stabilized and you are working on under 5 V power supply on very small percentage of M16 the internal flash memory random sector can got erased when power supply glitch occurs.

this is something Atmel is aware of, they recommendation was to add brown out detector circuit which hold M16 in reset if power supply drops below 4.5V, but this is impossible to do on our current design as AVR-JTAG-L should operate at down to 3V targets

this is something everyone should be aware of if use AVR devices in industrial environment or where noise on power supply is possible

Best regards

Tsvetan