AVRONE Atmel Studio 6 programming error - Got 0xc0 ...

Go To Last Post
33 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi All,

I am currently having problems programming the STK600 (with an ATmega2560) using AVRONE and AS6.

When I try to program the board via JTAG using AVRONE I get the following error:

" Failed to launch program.
Error: Failed to enter programming mode. doSimpleCommand: Error status received: Got 0xc0, expected 0x00
"

I perform the programming via Debug > "Start Without Debugging" option on the AS6.

My initial suspicions were on the hardware. However, the self test on AVRONE passed so I know the debugger is working.

Also, I tried to program the STK600 by using the JTAG facility on the board itself (i.e. the 10 pin header cable). This method worked and my code was programmed on the ATmega2560 chip I am currently working with. The program also runs as expected. This also tells me that the STK600 board settings are also correct.

I also have a Dragon debugger, which I also tested. However, I got the same programming error as in AVRONE.

I have been trying to get information on this during the last couple of days but no recipe really helped.

If anyone could give a hand, that will be really helpful.

Regards...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quick update on my troubleshooting.

I installed AVR Studio 5.1 and performed the same tests. Unfortunately, the result was the same. The error message in AS5.1 is as follows:

"Failed to launch program:failed to enter programming mode. Unexpected answer size reading memory (got 1 bytes)"

The above message means the same as the one I received in AV6. So nothing has changed.

By the way, I am using Windows XP if that helps at all.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Stick to AS6. It works well, and it works well with the AvrOne.

Take a look at the options in [/Tools/Device Programming]. What voltage do you read ? Are you able to find the chip ? Is the Device ID read correctly ?

What is your chip speed and what is your programming (interface) speed ? Try lowering the latter to match the programming speed divided by about 10 (just to see what happens).

Sid

Life... is a state of mind

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am able to read the voltages and all the chip attributes, lock bits and fuse bits.

Voltage reads as 5.1V. I can find the chip. The device ID also reads correctly. For Atmega2560, I read 0x1E9801.

The chip speed is 16MHz and the JTAG is running at 1 MHz.

All seems to be in order from what I can see but I cannot seem to enter the program mode from AS6.

The same problem applies to AVR Dragon as well as AVRONE debugger.

Very frustrating...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What happens if you use ISP instead of JTAG ?

Sid

Life... is a state of mind

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't have a ATmega2560, but thousands of people must have the STK600.
The Dragon works fine on AS6 with other chips.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

When I use the ISP, I get exactly the same problem.

Later this afternoon, I tried a few more things to get an understanding of what exactly the source of this problem is. Here is what I found.

I installed AS4.19 as well and created the same project. For this AS version, I had to create my own makefile using WinAVR as the toolchain (for some reason) does not get installed automatically in AS4.19. After doing that, I connected my AVRONE and managed to successfully upload my code to the chip!

I took the next step of trying to step through my code using breakpoints and that also worked well. I was able to do the same within the disassembled code too. Therefore, I can confirm that:

1 - My hardware is working
2 - There seems to be a problem with either:
2.1 - AS5.1 or AS6 and debugging with ISP and AVRONE using ATmega2560
OR
2.2 - Windows XP SP3 is causing some issues with AS5.1 and AS6 and I observe this problem by not being able to get into program mode.

I would ideally like to use AS6 for my development. Therefore, I will need to sort this problem out in AS6. I don't want to be forced to use AS4.19 purely because the debugging works there to be honest.

My next step is going to be to install AS6 on a reliable Windows 7 machine that I will be able to get hold of tomorrow.

I am also planning to file a ticket with Atmel on this problem. I am sure I am not the only one who is experiencing this issue.

In the meantime, I will be more than happy to try out your suggestions.

Regards...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

For this AS version, I had to create my own makefile using WinAVR as the toolchain (for some reason) does not get installed automatically in AS4.19

See sticky at the top of AS4 forum for a fix for that.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Nice one clawson. The fix works like a charm. Thanks for that!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Not many AVRONE owners on this forum.

So I would do your experiments with the Dragon.
As I said earlier, there will be a lot of STK600+Dragon+ATmega2560 owners here.

So if you can post a minimal project, others can attempt to replicate your problem.

Verifying the project hardware via AS4 was a very wise move.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for that tip David. It does make a lot of sense. Basically, everything I have observed and posted for AVRONE here applies to Dragon as well. I checked them both for each test.

From now on I will post based on Dragon to be safe though.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

david.prentice wrote:
Not many AVRONE owners on this forum.

I have one. It works just fine.

Sid

Life... is a state of mind

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

When you switched from as6 to as4, did studio try to downgrade the firmware in the programmer? This really messed me up trying to use avr-isp-mkii and jtag-ice-mkii with different version of avrstudio. I also see the "byte read as 0xc0, should be 0x00" when trying to program certain AVRs (mega1280) with jtage-ice-mkii and as4 on xpsp3. I have to go to the lt with win7, jtag-ice-iii and as6. There's a bug in there somewhere.

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

For what it's worth, programming a MEGA2560 mounted on a STK600 using a Dragon over ISP works fine with latest AS6 and Service Pack 1. What ISP programming speed did you try?

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I tried down to about 25 kHz speed with ISP with no luck.

Today I installed the AS6 to a Windows 7 (64-bit) machine and the same problem occurred there. So it seems this is not just an XP specific problem.

The next step will be to report this problem to Atmel directly I think.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

The next step will be to report this problem to Atmel directly I think.

I work for/at Atmel, so I'm one of the people you would be reporting to. Can you give details of your exact setup, so I can try to replicate it? As I said, the Dragon worked fine with AS6 and a MEGA2560 on my desk when I tested it today.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks Dean. Here is my set up:

OS: Windows XP - SP3

Platform: STK600

MCU: Atmega2560

Debugger: AVRONE! ( I also have AVR Dragon I can test with)

Problem: When I try to program the board via JTAG using AVRONE or the Dragon I get the following error:

" Failed to launch program.
Error: Failed to enter programming mode. doSimpleCommand: Error status received: Got 0xc0, expected 0x00 "

If you require further information, please let me know. Shall I hold up raising a ticket on Atmel website until you look into this then?

Regards...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No, raise a support ticket (I'm on support for the next two weeks, might as well do this on the clock).

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Dean,

I have created the ticket 694286 as you have suggested. I put a bit more information there for your reference.

Regards...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Is there any useful info from USBDeview as to USB driver versions, etc?

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The only driver information I have is Jungo version 11.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@Dean

Hi Dean,

Is there any progress on "ticket 694286"? When will there be a release of AS6 that I can download and work with?

Regards...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No activity by the tools team - I've just re-poked them about it.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I just wanted to give a quick update on this problem.

I just downloaded the AS6 November 2012 that includes service pack 2 and installed it on my Win 7.0 (64-bit) version. This version is called 6.0.1996 - Service Pack 2.

When I tried to enter debug mode, I get the following error:

"Communication error. Try with a lower clock speed. Debugger command setEmulatorMode failed."

I reduced the JTAG speed all the way to 500 kHz but I still got the same error. I am normally able to debug in AS 4.19 at 1 MHz JTAG speeds with no problem at all.

Apparently, the problem I have mentioned in this post has not been resolved yet. It looks like I will have to carry on using my good old trusted friend AS v4.19. The polished AS 6 does not help me at this stage despite all its bells and whistles :)

One good thing I noticed about AS 6.0 is that the generated hex code is much smaller than that produced with AS 4.19, which is good but it is useless for me unless I am able to use the AVRONE! debugging tool.

Regards...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

One debugged, recompile with new compiler for release. QED.

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Bob,

I build the project in release mode and tried to debug afterwards but I got the same error.

I also tried to program the board with the elf file without debugging to see if the code would work as normal. However, although the tool seems to erase and program the board normally, the program does not seem to execute at all. This happens in release as well as debug builds.

I also tried to debug and program using the Dragon. At least with Dragon, I am able to enter the debug mode and able to see the disassembly and the program seems to step through the assembly code. However, the code does not seem to work as it should.

It appears that there is a problem with the build as well.

Regards...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Dean, I had this problem spontaneously appear on a known-good board ... nothing physically changed, I was just playing around in AS4 to figure out how to burn an .eep as part of a .hex file. Played with the .elf settings and wham, suddenly I couldn't program the 2560 anymore. STK600 seems to be responding fine, I can re-flash its firmware til the cows come home. Same "expected 0x00 got 0xc0" in AS6 and AS4.

I've dialed back ISP programming speed to bare bones, re-flashed the STK600 multiple times, checked for shorts in the wires (which I didn't move at all), checked for shorts under the board, on and on ... and it still won't go into programming mode.

If it would be helpful, I'd be glad to send the unit in for analysis. It's not doing me any good right now anyway. Thankfully the programming class I was taking is mostly finished.

abcminiuser wrote:
No activity by the tools team - I've just re-poked them about it.

- Dean :twisted:

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm back on support, so I can take a look at this.

Does dialing back the firmware of the STK600 help under Studio 4? Can you try another device to check if it's a general issue with the STK600, or just the target board?

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

For what it's worth, I wasn't able to reproduce this with yesterday's 6.1 SP1 release using SPI on the STK600. Did you perhaps alter the device BOD level fuse below that of VCC?

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I wanted to update this post as my problem has been transformed in AS6.1 and wanted to share my new observations with all interested.

I downloaded AS6.1 (which automatically updates the Jungo driver) and tried to debug my application. I must note that this process also updated my AVRONE! firmware to 5.1B from 5.16 (which made me nervous a bit) and it was successful.

As a step forward, I managed to upload my code to the device. (Last time in AS6.0, this was not possible) I then tried to breakpoint and debug my application but was presented with the following error message and failed to debug anything.

https://www.flickr.com/photos/11...@N00/12931806695/

As a result, I am still sticking to my good old AS4.19 for compiling, linking and debugging. I hope AS6.1+ versions will be successful for me. I am still holding up giving a shot to AS6.2 as it is a beta release at this point.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I hope the OCDEN fuse is set in the target ? (Fuses can be set from programming dialog -> Fuses window)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am able to program and debug the same target device from AS4.19. So I presume the OCDEN fuse is set.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That readProgamCounter error with AVR One and xmega should be solved in the beta (it was a blocker issue for the beta cut as far as I remember...)

:: Morten

 

(yes, I work for Atmel, yes, I do this in my spare time, now stop sending PMs)