Atmel Studio Debug to Programming Mode

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

Hi I have a custom built PCB with an ATMEGA328p onboard. I have a programming header attached to the programming pins and have been programming this successfully using ISP on Atmel Studio 7 for ages. I have recently started debugging the unit using atmel studio 7 and changed from ISP to Debug Wire in the Tools menu and have been able to compile and debug the target fine. Now I wish to switch back to programming via ISP however when I try I get the message:

 

Failed to enter programming mode, ispEnterProgMode: Error Status received Got 0xc0, expected 0x00 

 

I cannot read device signature. I think its something about disabling the debugWire but I have no idea of how to do this.

 

I should also add: I have tried using the "disable DebugWIRE and close" option and it says: Failed to disable debugWire: Failure to enter programming mode.  ispEnterProgMode: Error Status received Got 0xc0, expected 0x00. Please cycle target power to restore debugWire mode

 

Can you help?

 

thanks

Last Edited: Wed. Aug 16, 2017 - 12:10 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

mrhlogic wrote:
I should also add: I have tried using the "disable DebugWIRE and close" option and it says: Failed to disable debugWire: Failure to enter programming mode. ispEnterProgMode: Error Status received Got 0xc0, expected 0x00. Please cycle target power to restore debugWire mode Can you help?
Well that IS the way to get out of dW mode but at the moment you do that all the ISP wires must be connected. It's not enough to just have the limited subset used for debugWire.

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

thanks! I have all 6 of the ISP wires connected :-S any further thoughts? I assume changing the atmega328p will work?

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

Two things:

 

1) Atmel have a command line tool in the AS7 package that can do operations with programmers (atprogram?) I believe it has an option for "switch off dW" and I think Morten has said in the past that this is a "more robust" way to attempt it than through the UI

 

2) if all else fails I believe avrdude.exe has a "switch off dW" option too

 

(personally I try to void chips with dW and use 40pin JTAG chips so never have to play this game ;-)

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

I use DW all the time, it's great!   To exit from DW mode, you must start a debug session, then exit using the disable dW mode, then power cycle the chip!

 

 

Jim

 

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

Ive tried this multiple times but then it gives me the error message of not being able to get back to programming mode. any thoughts?

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

Do you by any chance know the commands to try?

 

thanks

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

Can you re-enter debug mode?   if yes, did you remember to power cycle the chip after selecting "disable DW mode and exit"?

 

Jim

 

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

mrhlogic wrote:
Do you by any chance know the commands to try?
Not off hand but I bet the search function here does ;-)

 

(I was kind of hoping that mentions of "atprogram debugwire" or "avrdude debugwire" would be enough to locate the relevant stuff).

 

EDIT: for example I just tried a google for "atprogram disable debugwire" and it came back to this site and the following thread:

 

http://www.avrfreaks.net/forum/s...

 

take particular attention to #38 in that. Morten is an Atmel engineer who works/worked on Studio so will know all about atprogram.

Last Edited: Wed. Aug 16, 2017 - 02:58 PM