Disabling debugWire, or other problem?

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

Just starting out with Atmel Studio. Been a struggle.

 

I have an ATmega328P Xplain MINI with a USB-based debug/programming capability. I cannon seem to program the device any more -- it used to work -- and get the "Got 0xc0, expected 0x00" type of error. I figured so far that this might have to do with me playing with debugWire, and that's causing some problem since I didn't use the 'Disable debugWire and Close' (very well hidden) option.

 

Problem is that I cannot enter debug mode any more (always getting the failure above whether I choose to enable the DWEN fuse or not), so that option above is always greyed out! I've tried all possible combinations and it still can't access the chip.

 

Any advice?

 

 

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

Take a look at page 4 of the manual - which I have attached.  It explains how the unit is supposed to connect to Studio, and programming. 

 

Jim

Attachment(s): 

If you want a career with a known path - become an undertaker. Dead people don't sue! - Kartman

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB user

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

Hello Jim.

 

I have gone through this before, and again now. It doesn't work. I get the same error that I originally specified... "Unable to enter programming mode... ispEnterProgMode: Error status received: got 0xc0, expected0x00" when I try to go anything (such as read the device signature, etc.).

 

I also have an Atmel-ICE, and even that won't program the chip through the ISP interface!

 

I've spent hours trying to work this out, but it looks to me like the device is bricked, just because I hadn't clicked the right option in a hidden menu :(

 

 

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

Not having one of these units I am at a disadvantage sadly.  Hopefully a fellow freak that has one and may have experienced the same problem can jump in here.

 

I will read the manual later and see if I can come up with something for you.

 

JIm

If you want a career with a known path - become an undertaker. Dead people don't sue! - Kartman

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB user

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

Jim:

 

I bricked , in a similar fashion, a ATmega168PB-XMINI. This is what I did:

 

1) for the ATmega168PB-XMINI, I removed resistors R110,R111,R112,R113 to prevent conflicts with the JTAG ICE mk-II about to be used in step 3.

2) Made a project for the ATmega168PB  microcontroller ( not the XMINI board itself). Plugged in the JTAG ICE mk-II into the computer and selected in Project properties the debug tool , JTAG ICE mk-II in debug wire mode.   If a XMINI project is made, the JTAG ICE mk-II debug wire option is NOT offered! So a project for the ATmega168PB seems the only viable choice.

3) Build the project, attach JTAG ICE mk-II and debug.

4) Exit with disabling debug wire (DWEN).

5) Your choice at this point , continue to use JTAG ICE mk-II ( what I plan on doing )

 

OR

 replace the removed resistors and use the use mEDBG as before, hopefully always remembering the exit with disabling debug wire (DWEN)

If you forget then do this all over again.

 

 

 

 

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

I am seeing the same issue. I seem to be able to set the clock source fuse bits for SUT, but not CKSEL. I have an AVR Dragon here and at some point will try it, isolating the ISP interface like the above poster did.

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

Also got there with Atmega328PB on custom card and Atmel-ICE after following the fuse settings instructions on http://microchipdeveloper.com/8avr:usart-mega-example-polled  

The following fuse settings need to be programmed into the device:

  • HIGH: 0xDF
  • LOW: 0xC0
  • EXT: 0xFC

 

Any help/suggestion would be appreciated

 

Thanks

Udi

Udi

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

Seems like the HIGH fuse setting of 0xDF bricked my card since it sets the 'External Reset Disable' and the WatchDog fuses - this looks like a fatal documentation typo.

Any work-around to save the card?

Udi

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

Remember, for the fuses '1' is unprogrammed '0' is programmed.

It looks like that set up for an external clock signal, but has not disabled reset or configured WDT...

 

Confirm fuses for yourself at:

http://www.engbedded.com/fusecalc/

 

You will need an external clock signal, see:

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

 

Edit: typo

David (aka frog_jr)

Last Edited: Wed. Dec 13, 2017 - 04:47 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

JR, Thank you so much - I'll give it a go...

Udi

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

find atprogram.exe in your atmel studio install folder and run it inside a dos terminal window.

 

run it like this:

 

..\atprogram.exe -t medbg -i debugWIRE -d atmega328p dwdisable

 

DO not powercycle your eXplained at this point, leave USB plugged in.

 

Then you should be able to open atmel studio and get into fuse programming and disable that dwen fuse.

 

Worked for me, just thought i'd share.  I know debug mode is not working for you, studio was giving me same exact error, (expected 0x00 but got 0xc0).  but if DWEN fuse and SPIEN fuse are both set this should work.

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

Oh forgot to tell you, I tried it a few times with slight variations in the command before i got it to work, i think it may be case-sensitive.  The command above was copied exactly as I typed it, case sensitive (or mayby debugWIRE is not case sensitive, unknown).

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

I've have some experience "bricking" devices from wrong fuse settings.  One option is to use the "High Voltage" protocol to reset the fuses.  There's a serial and a "parallel" version of this protocol and the ATMega328P uses the parallel protocol.  If you have an Arduino handy, you can build a fairly simple circuit to implement this protocol.  Se this article http://mightyohm.com/blog/2008/0... for details.  BTW, you don't need all the isolation resistors shown in his original design, as he dropped them in a later redesign of a kit he also sells for this circuit.

 

Wayne