Code enters DeepSleep, now I can't connect debugger

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Code enters DeepSleep, now I can't connect debugger

449 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by robert.palmer on Fri Aug 24 15:40:31 MST 2012
Hello all,

First off, I have read and tried, possibly incorrectly, the information at:

http://support.code-red-tech.com/CodeRedWiki/DebugAccessChip

I am using a RedProbe+ and programmed my chip with code that puts it into one of the deeper sleep modes (not sure which is loaded) in the FreeRTOS IdleHook (yeah, not smart, but I was experimenting).

I have proved that the chip functions, I have a UART that spits out startup messages, which do appear, and I have GPIO pin toggles in the FreeRTOS IdleHook and TickHook functions.  I can see those pins toggle a couple of times after a reset, then stop.  I can pull the EINT0 pin low to generate a wake interrupt and watch the pins toggle and then stop (going back to sleep).

When I try to program, erase or debug, the connection always fails with:

02: Failed on connect: Em(01). Cannot find selected MEM-AP (check target power)
Emu(0): Conn&Reset. Was: None. DpID: 2BA01477. Info: FTUT6ATWA

I tried the ISP steps, but as soon as I try to load my new program, I get the same failure (Em(01))

Am I missing something on the ISP steps.  Just ground P2.10, do a reset, then release P2.10, then attempt to launch the debugger and program the chip, correct?
0 Kudos
8 Replies

418 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by robert.palmer on Mon Aug 27 16:13:30 MST 2012
WOO HOO!!

FlashMagic was the key!  I was able to erase the flash with FlashMagic and successfully connect the debugger from Eclipse.

I'm a bit disappointed that you have to use a separate tool like FlashMagic over ISP, and the SWD/JTAG won't do it.

Luckily I was able to get it working - ISP over UART0 with FlashMagic to the rescue (glad I was easily able to access UART0)
0 Kudos

418 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by robert.palmer on Mon Aug 27 09:32:31 MST 2012
As far as I know, I never turned on CRP.  I shouldn't have a hardware problem - as you can see, I've tested the board using the scope with resets and interrupts, I've been able to determine that it is actually running and that it is responding to the wake-up interrupt correctly.  The problem seems to be that the RedProbe+/debugger can't catch it before it goes to sleep.

Again though, if I press the Debug option from Eclipse, and watch the reset line going to the chip, (I have the scope set to capture a single event), I NEVER see the debugger cause the reset line to activate.  I get the connection error, but never a reset.  I would have thought the first thing it would do would be try to reset the chip, then attempt to connect, then do whatever else (program the chip, erase, etc).

I will try a couple more attempts - mass erase and FlashMagic to see if I can gain access.
0 Kudos

418 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by robert.palmer on Mon Aug 27 09:27:33 MST 2012
1756 actually, but it's in that same family
0 Kudos

418 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Sat Aug 25 12:37:25 MST 2012

Quote:

...Just ground P2.10...

Wild guess: 176x :confused:
0 Kudos

418 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by NXP_Europe on Sat Aug 25 12:31:26 MST 2012
Hi Robert,

I think Zero is right.

Which controller do you use?
0 Kudos

418 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Sat Aug 25 06:09:32 MST 2012

Quote: robert.palmer
I'll try again and I'll also try FlashMagic, but I'm not sure how it will be any different since it uses the same interface.  Maybe I'm wrong, I hope I'm wrong.



:confused:

FlashMagic is using old-fashioned ISP via UART, no SWD, no JTAG :)

No crystal is needed, just a powered chip. If FlashMagic fails, you've either a major hardware problem or a successfully CRP protected chip :eek:
0 Kudos

418 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by robert.palmer on Sat Aug 25 05:24:35 MST 2012
I don't understand how the programmer can't catch it after a reset.  I KNOW the code doesn't hit the sleep command until after the RTOS task manager has been started, which is well after all of the initialization code.

I tried configuring the debugger to break on SystemInit and ResetISR instead of main, and still the same problem

Interestingly, I checked the reset line with a scope, while the debugger was loading and I never saw the debugger pull the reset line low before I got the error message.  I would have assumed that the process for the RedProbe to connect would be something along the lines of: RESET, attempt to connect, do stuff (program the chip, ext), RESET, run new code.  But this doesn't seem to be the case :(

I'll try again and I'll also try FlashMagic, but I'm not sure how it will be any different since it uses the same interface.  Maybe I'm wrong, I hope I'm wrong.
0 Kudos

418 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Fri Aug 24 16:23:06 MST 2012

Quote: robert.palmer
Am I missing something on the ISP steps.  Just ground P2.10, do a reset, then release P2.10, then attempt to launch the debugger and program the chip, correct?



Correct, if you've enabled vector catch already the next step is to use FlashMagic, your last hope :)
0 Kudos