LPC845 BOD Power Up

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

LPC845 BOD Power Up

2,923 Views
hparracho
Contributor II

Hi!

Working with the latest MCUXpresso and a LPCXpresso845MAX Rev.A board.

I am experiencing a strange problem with my board when enabling Brown-Out detection.

As soon as I power up the BOD peripheral my program stops working (not power related issue).

LPC_SYSCON->PDRUNCFG &= ~(1 << 3);

If I try it in a debug session the debug terminates in the same instruction with the error:

16: Target error from status-poll
Wire ACK Fault in DAP access
16: Target error from status-poll: Ee(FF). Redlink interface error 255.
Debugging context: lpc845 LinkServer Debug

After this I lose access to the chip and can only recover it by entering ISP, mass erase and flash it again.

I have discovered (by pure luck) that if I enable the ACMP (Analog comparator) first and then the BOD, everything works fine. I can even disable ACMP immediately after. I have also noticed that BOD reset enable (LPC_SYSCON->BODCTRL bit 4) starts enabled after reset and not disabled as the manual states. (The manual and datasheet are full of typos and errors, a shame really...)

Any thought on this issue? Thanks.

Labels (3)
10 Replies

1,807 Views
hparracho
Contributor II

I'm still trying to solve this issue...

Since I have changed heavily my startup code I was afraid I had messed something up in my code so I followed the tutorial from this post Working with LPCXpresso845-MAX Evaluation Board , imported the multi timer blinky example and just added the following line to main():

int main(void) {

LPC_SYSCON->PDRUNCFG &= ~(1 << 3);

...Just got the same result!

Second test: With the debug paused at main() I went to the Peripherals tab, SYSCON -> PDRUNCFG and changed the BOD-PD bit manually from 1 to 0. The IDE just stalled and this is the error I got after 3 or 4 seconds:

12: Failed writing register SYSCON.PDRUNCFG.BOD-PD
Debug port inaccessible after access at location 0x40048238
Debugging context: Multi_Timer_Blinky LinkServer flash

I can clear any other bit (enabling other peripherals) of the register without problems. Just the BOD-PD gives me this error.

0 Kudos

1,807 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Helder Parracho ,

Sorry for reply late.

The phenomenon doesn't happen when I debug the PMU_Modes in IAR IDE with LPCXpresso 845 board, the BOD_PD is allowed to set 0 as the Figure1 indicates.

I was wondering if you can share a compile-able demo, then I can replicate the issue on my site directly.

pastedImage_1.png

 

Have a great day,
TIC
 
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
0 Kudos

1,807 Views
hparracho
Contributor II

Hi jeremyzhou‌,

Thank you for your reply.

Following your example I noticed that my original issue was related to not disable the BOD reset function before powering up the BOD peripheral. Blame the Manual! Page 112 states that the BODCTRL reset value is 0x0 (disabled) but it is not.

Yet, on your example you just powered up the BOD peripheral. You haven't re-enabled the reset function and again I am having trouble doing it so.

// Disable BOD reset function before powering BOD peripheral
LPC_SYSCON->BODCTRL &= ~(1 << BODRSTENA);

// Power up BOD
LPC_SYSCON->PDRUNCFG &= ~(BOD_PD);

// Wait at least 10 uSec before re-enabling BOD reset function.
// The for loop takes 7 clocks per iteration and executes
// at a maximum of 30 MHz (33 nSec), so worst case:
// i = (10000 nSec) / (7 * 33 nSec) = 43.3
for(uint32_t i = 0; i < 44; i++) __NOP();

// Enable BOD reset at level 3 (2.63V ~ 2.76V)
LPC_SYSCON->BODCTRL |= (3 << 0) | (1 << BODRSTENA);‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

I cannot enable the BOD reset function without the wait loop after power up. Why? Does it need some time to perform the power up? I have not seen anything mentioning this on the manual.

Try to comment the for loop and check what happens on your side.

NOTE: while debugging you can comment the for loop and successfully execute the code in step over mode but cannot run it in "resume" mode or run it in release mode.

Waiting again for your comment on this.

Thanks.

0 Kudos

1,807 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Helder Parracho ,

Sorry for reply late because Labor Day holiday.

Actually, the reset value of BODCTRL is 0x00 just as the RM states.

In my testing, the LPC824 will became 'brick' when enable the reset function without the wait loop, and it spend me a lot time to recover the 'brick'.

pastedImage_1.png

Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,807 Views
hparracho
Contributor II

Hi jeremyzhou‌,

Thanks again for your reply.

You have confused the microcontroller. I am referring to LPC845 and not LPC824.

I am sorry to disagree with you but, as you can clearly see from my print screen, immediately after reset, the LPC845 BODCTRL register starts with the value 0x13 and not 0x00.

BODCTRL.png

What I get from your answer is that the wait loop is needed (apparently not only on LPC845), still this is undocumented.

Also, it would be good to know the amount of time we should wait. I came up with 10us because that's what worked on my tests but it might not be the correct value (long enough) on other MCUs.

Recovering from the 'brick' is easy. Reset in ISP mode and do a mass erase.

Waiting again for your comment on this.

Thanks.

1,807 Views
jeremyzhou
NXP Employee
NXP Employee
Thanks for your reply and I've run the deo code with LPCXpresso 845 MAX board.
According to the testing result, the reset value of BODCTRL should be 0x13 as you mentioned before.
However I can reeable the BOD reset feautre without the wait loop after power up.
Hope this is clear.

pastedImage_1.png
Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,807 Views
hparracho
Contributor II

Hi jeremyzhou‌,

Thanks again for your reply. I'm sorry but unfortunately the situation is still not clear to me!

In the last post you told that accordingly to your tests you can enable the BOD reset feature without the wait loop after power up. I cannot do that on my board! Can you share your test program so I can test it on my side? I have Keil and MCUXpresso, don't have IAR, sorry.

Attached you can find 2 test programs where the issue happens on my board (blinky examples), one from Keil and another from MCUXpresso. Can you please flash these examples on a LPCXpresso 845 MAX board and tell me how it went?

NOTE: if you debug the program you have to "run" the program, if you go over each line step by step you don't see the problem happening because you are giving it time to rest between the powering the BOD up and enabling the reset feature.

I am not discarding a problem with my demo board but everything else is working as expected so far...

0 Kudos

1,807 Views
jeremyzhou
NXP Employee
NXP Employee
Thanks for your reply.
Yes, I've replicated the issue, it acutally need some time to wait before reable the BOD reset feature.
I'll contact with AE team for confirming later and I think it will add some statements to notice the issue and help the developer to keep away the risk in an updated version of RM in the future
Hope this is clear.

Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,807 Views
hansonhe
NXP Employee
NXP Employee

Jeremy,

I also meet same problem on LPC845 BOD. And I send mail and repeat project to you.

  1. NVIC_EnableIRQ(BOD_IRQn);    After enabled this code, it will enter into BOD interrupt immediately.
  2. After enable BOD reset, add this code LPC_SYSCON->BODCTRL = (1 << 0)|(3 << 2)|(1 << 4);    JLINK debug tools could not download and debug on MDK IDE, need do erase LPC845 with Flashmagic under ISP UART mode, and then JLINK could download and debug again.
0 Kudos

1,807 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Helder Parracho ,

Thanks for your information and I'd like to replicate this phenomena later.

Have a great day,
TIC
 
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

 

0 Kudos