"Flash driver failed to initialize" on LPXpresso802

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

"Flash driver failed to initialize" on LPXpresso802

668 Views
drsmith_yorku
Contributor III

I was experimenting with the SYSAHBCLKCTRL0 register on my LPXpressor802 board and appear to have locked it up.  Any suggestion as to how I can reset my board (I have a Segger Jlink that I can use, if necessary).

It was working okay when I had an OR in my first line

  SYSCON->SYSAHBCLKCTRL0 |= 0b000000000000000000000000000001000000;

but when I changed that to a simple equal, like this

  SYSCON->SYSAHBCLKCTRL0 = 0b000000000000000000000000000001000000;

and then ran the program.  My suspicion is that by not using the OR I have cleared a bit that I wasn't supposed to.  (I understand that removing the OR wasn't a smart thing to do... I'm trying to see if changes like this break the board before using it to teach in a classroom.)

Here is the program I was trying to run

void main(void) {
// Power up GPIO 0 unit via Bit 6 on AHB Clock Control Register
  SYSCON->SYSAHBCLKCTRL0 = 0b000000000000000000000000000001000000;

  // Preemptively turn off the LED on GPIO bit 8.
  GPIO->SET[0] = 0b000000000000000000000000000100000000;

  // Set data direction on GPIO bit 8 to Output.
  GPIO->DIRSET[0] = 0b000000000000000000000000000100000000;

  // Turn on the LED on GPIO bit 8.
  GPIO->CLR[0] = 0b000000000000000000000000000100000000;

} // end of main

LPC802_flash_failed_Nov2018.PNG

Labels (1)
0 Kudos
5 Replies

461 Views
drsmith_yorku
Contributor III

Fixed!

I recompiled my original code ( with the |= )

SYSCON->SYSAHBCLKCTRL0 |= (1UL<<SYSCON_SYSAHBCLKCTRL0_GPIO0_SHIFT);

and then selected "Debug" with the JLink as follows

LPC802_debug_with_JLink_worked.PNG

Lesson learned? Always have a stand-alone debugger, like a JLink, even if the board has an onboard debugger.

all the best,

James

0 Kudos

461 Views
jeremyzhou
NXP Employee
NXP Employee

Hi 

Thank you for your interest in NXP Semiconductor products and
for the opportunity to serve you.
Firstly, using the following code to enable the GPIO clock, however, it will disable other units' clock. For instance, they include the AHB, the APB bridge, the Arm Cortex-M0+, the SYSCON block, and the PMU, etc.

 SYSCON->SYSAHBCLKCTRL0 = 0b000000000000000000000000000001000000;

pastedImage_1.png

Fig 1

No doubt, it will crash the MCU after doing this.
MCUXpresso provide the feature which allow the developer to to observe the changing of SYSAHBCLKCTRL0 register in the debug, I think it's just you want, please refer to MCUXpresso's user guide to enable this feature.

TIC

 

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

0 Kudos

461 Views
drsmith_yorku
Contributor III

Hi Jeremy,

I read through the manual (good suggestion!) and was able to use the "Attach" mode to access the registers on the board.  I modified 0x40048000 (SYSAHBCLKCTRL0) to be 0x000000D7 (i.e. default value + GPIO on). I am still getting a flash writing error.  Thinking that this may be because of my MCUXpresso installation, I tried programming the '802 board on my Mac, with MCUXpresso 10.1.  I got the same flash writing error.

Do you have another suggestion as to what I can look at?

thanks!

James

LPC802_flash_failed_Nov14_2018.PNG

0 Kudos

461 Views
drsmith_yorku
Contributor III

I connected my JLink to the board (with a jumper on EXT_DBG and power applied to USB on the board).  I can access the SYSAHBCLKCTRL0 register and set it to 0xD7 with the JLink, too.  However, when I try to erase flash with the JLink I get an error, too.  It says something about "failed to download RAMCode."

LPC802_JLink_flash_failed_Nov14_2018.PNG

0 Kudos

461 Views
drsmith_yorku
Contributor III

Thanks!  I'll have a look in the User Guide.

0 Kudos