Detecting boot source on LPC4330

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

Detecting boot source on LPC4330

471 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by gertvijfman on Fri Mar 18 09:31:23 MST 2016

Hello,

How can I detect that the LPC4330 has been booted from USB UDF?

My board has a user button to switch the boot mode between SPIFI and UDF. For manufacturing purposes I would like my code to detect if it has been booted from UDF, and then automatically copy the program code from RAM to flash at bootup.

Thanks,

Ger
Labels (1)
0 Kudos
5 Replies

439 Views
lpcware
NXP Employee
NXP Employee
bump
0 Kudos

439 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by gertvijfman on Sun Mar 20 11:13:21 MST 2016
Well, there's only one single version of the firmware. For manufacturing or updating it is loaded through USB/UDF, and is then copied from RAM into SPIFI flash. No different signatures possible.

For now I took the pragmatic route: at boot time I compare the flash memory to the program in RAM. If any differences are found the code from RAM is copied into flash.
0 Kudos

439 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MikeSimmonds on Sat Mar 19 03:39:25 MST 2016
I don't know if this is sensible with your environment, but I would put code in both versions of the firmware
to write a (different) signature to a known location.
You can read the signature from this location to see which version of the firmware is running.

Cheers, Mike.

EDIT: are the RTC non-volatile user registers available on you device?
They are very useful to pass info between say boot code and app code (and vice-versa).
And obviously easy to locate and do not interfere with code layout.

EDIT2: Also, I believe there is a 'scratch' register in the UART block(s).

0 Kudos

439 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by gertvijfman on Fri Mar 18 13:41:53 MST 2016
Not quite: if the user presses and holds the button, one of the bootstrap pins changes level so that the chip boots in UDF mode; the user then releases the button and starts firmware upload from the PC. If the application then starts (from RAM), the button has already been released so the state read from the GPIO pins is the same as in the normal operational mode.
0 Kudos

439 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by rocketdawg on Fri Mar 18 09:56:43 MST 2016
The boot pins P2_9, P2_8, P1_2 and P1_1 can also be GPIO pins.
I wonder if is not just as simple as configuring the pins to be inputs and reading the state.
0 Kudos