I need to know how to read the LPC15xx/LPC176x unique serial number in application. I know it is possible to read it by means FLASH MAGIC, for exemple, but I need to read it running the application.
One way is using the IAP interface (use LPCOpen):
Hi Carsten! I thank you for your tip. The answer was "in front of me" ... I will try to do it to check if it so easy ... Thanx!
Hi Carsten! Unfortunately it didn´t work ... I did the following code:
// LPC1518 IAP accesses#define IAP_Read_UID_Command 58#define IAP_LOCATION 0x03000200
unsigned int IAP_command;unsigned int IAP_result;
typedef void (*IAP)(unsigned int ,unsigned int);IAP iap_entry;
IAP_command=58;iser0=NVIC->ISER; // temp copy iser1=NVIC->ISER; // temp copy NVIC->ICER=0xFFFFFFFF; // block IRQs NVIC->ICER=0xFFFFFFFF; // block IRQs
iap_entry(IAP_command, IAP_result); // read UID
NVIC->ISER=iser0; // restore NVIC->ISER=iser1; // restore
The point is: my program stoped at iap_entry(IAP_command, IAP_result) command and didn´t run ... it didn´t "came back" to main program ...
Any tip? I´m doing something wrong ... but don´t know what ...
Thanx in advance!
The IAP entrypoint is:
/* Pointer to ROM IAP entry functions */#define IAP_ENTRY_LOCATION 0x03000205UL
I use the function from LPCOpen (using Keil) for my test and they seem to work.
Hope you can figure this out
Hi Carsten. I use KEIL5 as well.
I changed the IAP entrypoint to #define IAP_ENTRY_LOCATION 0x03000205UL but the result was the same ... the program stops in this instruction. Probably I´m forgetting something ... any kind of inicialization or to anable any function. But, as there´s nothing more detailed about this procedure (read UID) I really have no idea what I´m doing wrong ... May be an #include ... I don´t know ...
#define IAP_ENTRY_LOCATION 0x03000205UL
I would get the LPCOpen for the LPC15xx if I was you, maybe there is something in there you can use ?
There is a IAP.C file that contains a function for reading the UID
Ok Carsten. How to do it? How can I get the LPCOpen for LPC15xx ???
Thanx Carsten. Im´doing it !!!
Carsten, before I download the LPCOpen support, I´ve tried the following:
#define IAPCommand_UID_Read 58#define IAP_LOCATION 0x03000200
iap_entry=(IAP) (IAP_LOCATION+5); // ???????????????IAP_command=IAPCommand_UID_Read; //
And it worked-out !!! I read the iap_entry=(IAP) (IAP_LOCATION+5) structure in some Application Note ... But the point is: I can´t explain why the code works with it ... and crashes withou it ...
Anyway, I will download LPCOpen resources because there are a lot of interesting things on it.
Thanx once more Carsten!
Retrieving data ...