Trying to start debug session

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

Hi all,

 

I got my PCB boards back and I assembled one. I'm not too familiar with debugging on Atmel Studio, so maybe someone can help me. Part is ATMEGA328PB.

 

I'm using an external 16 MHz oscillator for the clock source. I programmed my fuses as follows: LOW.CKDIV8 = unchecked, LOW.SUT_CKSEL = Ext. Crystal Osc. 8.0 -  MHz; Startup Time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms

Fuse register low = 0xEF. Fuse register high = 0xD1. I haven't touched any other fuses. Is this correct settings for the 16 MHz clock source? I don't want the divide by 8 feature and I don't want the CKOUT feature ( I need to use PORTB0). The fuses are very confusing and seem opposite (inverted) to what I expect since programmed is "0" and unprogrammed is "1".

 

I'm able to program the FLASH memory fine, but I need to enter debug mode.

 

Details: Atmel Studio: 7.0.1645, Programmer/debugger: Atmel-ICE.

 

So, I click on "Start Debugging and Break" and I get a popup message: "ISP on Atmel ICE does not support debugging...".

 

Therefore, I go back into Properties->Tool and change interface to "debugWIRE" and select "Skip Programming" from the Program settings. I try again by clicking "Start Debugging and Break". Now, I get a popup message: "Failed to launch debug session with debugWIRE. This could be caused by reset line circuitry or disabled debugWIRE interface. Make sure the reset line is free before continuing. Do you want to use SPI to enable the DWEN fuse?" There is nothing on the reset line except a 10k pullup to +5V. I'm afraid to say yes here since I've read I can "brick" the part. Is this correct? Do I need to say yes? How do I prevent not getting my part "bricked"?

 

Thanks.

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

It asked you "Do you want to use SPI to enabled dW? ". What did you answer? Hope it was "yes" as it needs to use ISP to enable the DWEN fuse. Also clear the RESET line when using dW. The 10K might be OK but it'll more likely be successful if you do what the datasheet told you.

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

clawson wrote:

It asked you "Do you want to use SPI to enabled dW? ". What did you answer? Hope it was "yes" as it needs to use ISP to enable the DWEN fuse. Also clear the RESET line when using dW. The 10K might be OK but it'll more likely be successful if you do what the datasheet told you.

 

I answered "no" since I was afraid I might brick the IC. How do I make sure I don't brick the part?

 

I'm looking through the datasheet. Where does it state what to do with the RESET line?

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

Sorry I thought it was 328P not 328PB, that's a new chip so maybe the datasheet content is different?

 

The fact is that it has to use ISP to enable the DWEN fuse to get it into debug mode. At that point the operation of the RESET line changes. There is then a command it can issue in dW mode that can be used to switch back (when you use the Debug menu entry to switch back).

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

clawson wrote:

Sorry I thought it was 328P not 328PB, that's a new chip so maybe the datasheet content is different?

 

The fact is that it has to use ISP to enable the DWEN fuse to get it into debug mode. At that point the operation of the RESET line changes. There is then a command it can issue in dW mode that can be used to switch back (when you use the Debug menu entry to switch back).

 

Ahhh. I found it in section 30.3 which states the pull-up resistor should not be smaller than 10k and no caps should be connected. So, I should be good.

 

So, I assume that switching back from debug mode (disabling DWEN) can be done from debug mode? Otherwise, you would not be able to get back to ISP (programming) mode?

 

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

That's right, it confuses a lot of folks where the "switch out of dW " option is located. If it ever fails there's an option on avrdude you can use to attempt the same thing. As the switching involves ISP in one direction it probably makes sense to leave all 6 ISP lines connected all the time even though, in dW mode it's actually just using 2.