Fixed serial number location

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
DaHu_285096
Level 5
Level 5
10 likes received 250 replies posted 100 replies posted

I have a production programmer that can serialize PSOC 5LP while being programmed. It appears I can allocate a physical location and a start value and it will put sequentially incrementing numbers into this location each device I program.

   

The serial number will be 2-byte value.

   

I am unsure how to set up the location in the PSOC device (how to select a physical address and what declaration to use, then how to read from the address at run time. 

   

Thanks

0 Likes
1 Solution
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

You would want an absolute location, this should help -

   

http://www.cypress.com/forum/psoc-5-device-programming/setting-bytes-absolute-address

   

http://www.cypress.com/documentation/application-notes/an89610-psoc-4-and-psoc-5lp-arm-cortex-code-o...     AN89610 - PSoC® 4 and PSoC 5LP ARM Cortex Code Optimization

   

 

   

Regards, Dana.

View solution in original post

0 Likes
9 Replies
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

You would want an absolute location, this should help -

   

http://www.cypress.com/forum/psoc-5-device-programming/setting-bytes-absolute-address

   

http://www.cypress.com/documentation/application-notes/an89610-psoc-4-and-psoc-5lp-arm-cortex-code-o...     AN89610 - PSoC® 4 and PSoC 5LP ARM Cortex Code Optimization

   

 

   

Regards, Dana.

0 Likes
DaHu_285096
Level 5
Level 5
10 likes received 250 replies posted 100 replies posted

Is this then what I need to do?...

   

Place this into my code...

   

uint16 SerialNum __attribute__ ((section (".SERIALNUM")));

   

uint16 MySerialNumber;

   

MySerialNumber = SerialNum;

   

Then place this in linker...

   

build setting -> linker -> command line

   

BuildSetting -> Linker -> Command Line -> the custom flags

   

-Wl,--section-start=.SERIALNUM=0x30000

   

External programmer writes 2-byte sequential serial number into location0x30000 for each device when programming
and the device can access this number at run time.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

I have not done this but sure looks like you could provide a little code in

   

target to prove this with a couple of test devices, eg. ability to display its

   

serial number in end application. Or a jumper that is tested on startup that

   

reveals serial code burned in.....

   

 

   

Regards, Dana.

0 Likes
DaHu_285096
Level 5
Level 5
10 likes received 250 replies posted 100 replies posted

Would it be easier to place the serial code in an EEPROM location from my programmer? If so, what would be the actual address I would place into my programmer that would put the value into EEPROM location 0? Or does the compiler shift the memory locations allocated for EEPROM?

   

Thanks

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

If you are talking about real EEProm as in PSoC5 devices you are free to choose the place for your serial number.

   

The em_EEProm as in PSoC4 devices resides in flash and is prone for being overwritten by code. In this case, choose the upper flash locations of your device as storage area.

   

 

   

Bob

0 Likes
DaHu_285096
Level 5
Level 5
10 likes received 250 replies posted 100 replies posted

I was originally aksing about 5LP, however it is the 4200 that I need to get the serial number into from my production programmer.

   

If I change the serial number back to a fixed const and then use my programmer (without serialization) the code runs fine. When I add this code and use the programmer to place the 2-byte serial number at location 0x1000, the program fails to work. (I selected 0x1000 based on example in documentation)

   

The code below is what I used and it does not appear to work. (Part is CY8C4245PVI-482)

   

uint16 SerialNum __attribute__ ((section(".SERIALNUMBER")));

   

I use the variable like this

   

buf[1] = high_byte(SerialNum);

   

buf[2] = lo_byte(SerialNum);

   

This is compiler directive -Wl,--section-start=.SERIALNUMBER=0x00001000
 

0 Likes
lock attach
Attachments are accessible only for community members.
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Attached address map.

   

 

   

Look at your .lst file, look for last code address, and place the address well above that still in flash area.

   

 

   

Regards, Dana.

ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

This is an alternative, from PSOC Programmer user guide -

   

 

   

 

   

2.16 Using the Patch Image Option

   


To use the Patch Image option, select File > Patch Image or press [F12].

   


You can load a hex file and connect the Miniprog1 to the target devices. PSoC Programmer reads the Flash content on the
target device and compares it with the selected hex file. Then, the PSoC Programmer replaces the Flash blocks that differ.
This feature is useful to replace calibration data or a manufacturing number. See the PSoC Programmer COM User Guide
and code examples in the root installation folder for more information on writing unique applications to complete specific
tasks.

   

 

   

Regards, Dana.
 

DaHu_285096
Level 5
Level 5
10 likes received 250 replies posted 100 replies posted

Thanks all,

   

I have the serialization working ok now

0 Likes