9 Replies Latest reply on Aug 19, 2015 5:25 PM by DaHu_285096

    Fixed serial number location

    DaHu_285096

      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

        • 1. Re: Fixed serial number location
          DaKn_263916

          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-optimization     AN89610 - PSoC® 4 and PSoC 5LP ARM Cortex Code Optimization

             

           

             

          Regards, Dana.

          • 2. Re: Fixed serial number location
            DaHu_285096

            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.

            • 3. Re: Fixed serial number location
              DaKn_263916

              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.

              • 4. Re: Fixed serial number location
                DaHu_285096

                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

                • 5. Re: Fixed serial number location
                  JoMe_264151

                  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

                  • 6. Re: Fixed serial number location
                    DaHu_285096

                    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
                     

                    • 7. Re: Fixed serial number location
                      DaKn_263916

                      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.

                      1 of 1 people found this helpful
                      • 8. Re: Fixed serial number location
                        DaKn_263916

                        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.
                         

                        1 of 1 people found this helpful
                        • 9. Re: Fixed serial number location
                          DaHu_285096

                          Thanks all,

                             

                          I have the serialization working ok now