MC9S12XHY128 , the device id at address 0x40_0000 – 0x40_0007 is unique? i will use this id to encrypt program,but how to read the device id?

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

MC9S12XHY128 , the device id at address 0x40_0000 – 0x40_0007 is unique? i will use this id to encrypt program,but how to read the device id?

888 Views
zhyzhy
Contributor I

MC9S12XHY128 , the device id at address 0x40_0000 – 0x40_0007 is unique? how to read it?  i will use it to encrypt program!

0 Kudos
6 Replies

681 Views
lama
NXP TechSupport
NXP TechSupport

Hi,

The device ID at 0x40_0000 - 0x40_0007 cannot be programmed and cannot be erased. I cannot tell you the meaning or coding of these bytes. The content in these 8-bytes is specific to Freescale and is really of no use to the customer. However, I can confirm that each part has unique device ID.

The Program IFR is visible in the global memory map by setting the PGMIFRON bit in the MMCCTL1 register.

 

For identification you can use a routine which will program the write once field at address 0x40_0100~0x40_0135. The example code can be found in the attachment. Look at routines for program "program once field" and read "program once field". I program it in the main.c routine at the beginning.

The code is for another device but the same approach, code and addresses.

Best regards,

Ladislav

 

0 Kudos

681 Views
zhyzhy
Contributor I

i want to "read" the device ID, not write and not erase, only read the unique the ID, so each chip program is diffrient. you can tell me how to read?

0 Kudos

681 Views
lama
NXP TechSupport
NXP TechSupport

Simple, without testing (sorry I am at home and the board is t work...)

//==============================================================================
// read MCU ID
//==============================================================================
typedef struct
  {
    unsigned int partID[4];
    unsigned int versionID;
  }tMcuID;

//==============================================================================
static tMcuID mcuID;
//==============================================================================
void main(void)
{
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 // read ID
  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 MMCCTL1_PGMIFRON = 1;                      // Program IFR visible in the memory map
// mcuID.partID = pMcuID->partID;
// mcuID.versionID = pMcuID->versionID;

 mcuID.partID[0] = *((unsigned int * far) 0x400000);
 mcuID.partID[1] = *((unsigned int * far) 0x400002);
 mcuID.partID[2] = *((unsigned int * far) 0x400004);
 mcuID.partID[3] = *((unsigned int * far) 0x400006);
 mcuID.versionID =  *((unsigned int * far) 0x4000E8);
                                                   

 for(;;) {}
}
//==============================================================================

Best regards,

Ladislav

0 Kudos

681 Views
zhyzhy
Contributor I

you can tell me how to read .write erase the chip eeprom?

发自我的 iPhone

在 2017年8月29日,上午1:19,lama <admin@community.nxp.com> 写道:

NXP Community

Re: MC9S12XHY128 , the device id at address 0x40_0000 – 0x40_0007 is unique? i will use this id to encrypt program,but how to read the device id?

reply from lama in S12 / MagniV Microcontrollers - View the full discussion

Simple, without testing (sorry I am at home and the board is t work...)

//==============================================================================

// read MCU ID

//==============================================================================

typedef struct

{

unsigned int partID[4];

unsigned int versionID;

}tMcuID;

//==============================================================================

static tMcuID mcuID;

//==============================================================================

void main(void)

{

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

// read ID

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

MMCCTL1_PGMIFRON = 1; // Program IFR visible in the memory map

// mcuID.partID = pMcuID->partID;

// mcuID.versionID = pMcuID->versionID;

mcuID.partID[0] = *((unsigned int * far) 0x400000);

mcuID.partID[1] = *((unsigned int * far) 0x400002);

mcuID.partID[2] = *((unsigned int * far) 0x400004);

mcuID.partID[3] = *((unsigned int * far) 0x400006);

mcuID.versionID = *((unsigned int * far) 0x4000E8);

for(;;) {}

}

//==============================================================================

Best regards,

Ladislav

Reply to this message by replying to this email, or go to the message on NXP Community

Start a new discussion in S12 / MagniV Microcontrollers by email or at NXP Community

Following Re: MC9S12XHY128 , the device id at address 0x40_0000 – 0x40_0007 is unique? i will use this id to encrypt program,but how to read the device id? in these streams: Inbox

This email was sent by NXP Community because you are a registered user.

You may unsubscribe instantly from NXP Community, or adjust email frequency in your email preferences

>

0 Kudos

681 Views
zhyzhy
Contributor I

hi, read part id is ok! thank you very much!

can you tell me how to earse ,write ,read the chip's eeprom? 

0 Kudos

681 Views
zhyzhy
Contributor I

thanks!   I will test. 

0 Kudos