DebugWire issue on an ATmega328P using Atmel Studio 7

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

Hi all !

I am using Atmel Studio 7 and the Atmel ICE programmer to program and debug an ATmega328P. I have been able so far to use ISP to correctly read and write the fuses, read the signature, program the bootloader... 

However, I wanted to debug my program and when I launched the debug session, when Atmel asked me to toggle the power on my ATmega328P, it then returned an error and now I can't do anything. If I try to read the signature on Atmel Studio, I have the following error message : 

Failed to enter programming mode. ispEnterProgMode: Error status received: Got 0xc0, expected 0x00 (Command has failed to execute on the tool)

Unable to enter programming mode. Verify device selection, interface settings, target power, security bit, and connections to the target device.

If I try to disable Debugwire via atprogram with this command : 

./atprogram -t atmelice -i debugwire -d atmega328p dwdisable

 

the program returns this error : 

Firmware check OK
[ERROR] Could not establish connection to device. Please check input parameters, hardware connections, security bit, target power, and clock values.
Failure when increasing communication baud. Debugger command Activate physical failed. (TCF Error code: 1)

And I can't use ISP anymore ...

 

The fuses before enabling the DWEN fuse were : extended : 0xFF, high : 0xD6, low : 0xFF

 

Don't see what I can do to fix it, thanks for your help smiley

Last Edited: Tue. Jul 16, 2019 - 01:00 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If there is a capacitor on the reset pin, remove it.
If the reset pin pull-up resistance is less than 10k, replace it with 10k or more.
If DWEN is enabled, you can not use an ISP, but you can still run debugwire mode. Select [Debug]-> [Disable dbugWire and close] from debug mode to disable DWEN and enable ISP.

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

Hi kabasan and thanks for your answer.
I have replace the 1k resistor with a 10k one and unsoldered the capacitor and it now works perfectly.

First I designed my PCB with the 1k pull-up resistor according to the Arduino Nano's schematic (which was also blocked in DebugWire). I don't really get why this pull-up resistor is 1k on the Nano and 10k on the Uno ...

Moreover I found these lines on the Atmel-ICE datasheet : 

 

When designing a target application PCB where debugWIRE will be used, the following considerations must be made for correct operation:

  • Pull-up resistors on the dW/(RESET) line must not be smaller (stronger) than 10kΩ. The pull-up resistor is not required for debugWIRE functionality, since the debugger tool provides this.

  • Any stabilizing capacitor connected to the RESET pin must be disconnected when using debugWIRE, since they will interfere with correct operation of the interface

  • All external reset sources or other active drivers on the RESET line must be disconnected, since they may interfere with the correct operation of the interface

    Never program the lock-bits on the target device. The debugWIRE interface requires that lock-bits are cleared in order to function correctly.

 Thanks for your help !