Read UID MK66FN2M0VMQ18 Through EzPort (board FDRM-K66F)

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

Read UID MK66FN2M0VMQ18 Through EzPort (board FDRM-K66F)

775 Views
manurlruiz
Contributor I

Hi,

I am trying read the UID of the Chip MK66FN2M0VMQ18, but I don't know how to convert the address 4004_8054 of 32 bits to 24 bits, so that through of EzPort I may get data of SIM register of UID.

The reference Manual of this family of controllers indicate that you can access this register through EzPort.

2 Replies

598 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Manurl Ruiz,

   Why you need to convert the address 4004_8054 of 32 bits to 24 bits? Could you give me more details? I think you can send the 32bits address directly.

  Actually, about the EzPort operation, we have a document for your reference, please check it:

How to use EzPort module 

 Even it is used for K60 and K22, but you still can refer to that code.

Wish it helps you.


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

598 Views
manurlruiz
Contributor I

Hi kerryzhou,

I am trying read register using the EzPort  commands, specifically command Flash Read Data. The struct of this command is:

<code command(7:0)>,<address(23:00)>

 

The address of SIM Register that I want, it need 32 bits for its representations. In addition, the reference Manual of MK66FN2M0VMQ18 indicates that changes must be to made to the address maintain a width 24 bits.

 

Next, I show the function that I am using:

 

* @param addr Addres of register.
* @param data Param where store data.
* @param size Number data to read.
* @return EZ_RESULT_SUCCESS / EZ_RESULT_ERROR
*/
TEzResult ezSectorReadSIM(uint32_t addr, uint8_t *data, uint32_t size)
{
if( !data || !size ) return EZ_RESULT_ERROR;
if( size>4096 ) return EZ_RESULT_ERROR;
if( addr & 0xBFFB7F03) return EZ_RESULT_ERROR; //Valid Addres SIM UID 

//Command EzPort Flahs Read Data.
wrBuf[0] = 0x03;
wrBuf[1] = (uint8_t)((addr >> 16) & 0xFF);
wrBuf[2] = (uint8_t)((addr >> 8) & 0xFF);
wrBuf[3] = (uint8_t)(addr & 0xFF);
// Sending of the command and Receive data.
if( ezSpiTransfer(wrBuf, rdBuf, 5+size) == EZ_RESULT_SUCCESS ){
memcpy(data, &rdBuf[4], size);
return EZ_RESULT_SUCCESS;
}
else {
return EZ_RESULT_ERROR;
}
}

 

pastedImage_1.png

0 Kudos