How to read the LPC15xx unique serial number in application?

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

How to read the LPC15xx unique serial number in application?

1,583 Views
xavieralbornoz
Contributor III

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.

Labels (5)
0 Kudos
10 Replies

973 Views
xavieralbornoz
Contributor III

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!

0 Kudos

973 Views
xavieralbornoz
Contributor III

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[5];
unsigned int IAP_result[5];

typedef void (*IAP)(unsigned int [],unsigned int[]);
IAP iap_entry;

IAP_command[0]=58;
iser0=NVIC->ISER[0];   // temp copy 
iser1=NVIC->ISER[1];   // temp copy
NVIC->ICER[0]=0xFFFFFFFF;   // block IRQs
NVIC->ICER[1]=0xFFFFFFFF;   // block IRQs

iap_entry(IAP_command, IAP_result);   // read UID

NVIC->ISER[0]=iser0;   // restore
NVIC->ISER[1]=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!

0 Kudos

973 Views
carstengroen
Senior Contributor II

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

0 Kudos

973 Views
xavieralbornoz
Contributor III

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 ...

0 Kudos

973 Views
carstengroen
Senior Contributor II

Xavier,

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

0 Kudos

973 Views
xavieralbornoz
Contributor III

Ok Carsten. How to do it? How can I get the LPCOpen for LPC15xx ???

0 Kudos

973 Views
carstengroen
Senior Contributor II
0 Kudos

973 Views
xavieralbornoz
Contributor III

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[0]=IAPCommand_UID_Read; //

iap_entry(IAP_command, IAP_result);

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!

0 Kudos

973 Views
xavieralbornoz
Contributor III

Thanx Carsten. Im´doing it !!!

0 Kudos

973 Views
carstengroen
Senior Contributor II

One way is using the IAP interface (use LPCOpen):

pastedImage_1.png

0 Kudos