Skip to main content
Explorer
January 15, 2024
Solved

How does NFC rewrite code?

  • January 15, 2024
  • 1 reply
  • 3147 views

Why do I rewrite the code according to the example of nfc07a1, but the string of smartag is always read out? Can I change its code?

 

void MX_NFC7_NDEF_URI_Init(void){
 SmarTag_LED_GREEN_On();
	while( SMARTAG1_NFCTAG_Init(SMARTAG1_NFCTAG_INSTANCE) != NFCTAG_OK ){}
 /* Reset Mailbox enable to allow write to EEPROM */
 SMARTAG1_NFCTAG_ResetMBEN_Dyn(SMARTAG1_NFCTAG_INSTANCE);
 /* Check if no NDEF detected, init mem in Tag Type 5 */
 if( NfcType5_NDEFDetection( ) != NDEF_OK ) {
 CCFileStruct.MagicNumber = NFCT5_MAGICNUMBER_E1_CCFILE;
 CCFileStruct.Version = NFCT5_VERSION_V1_0;
 CCFileStruct.MemorySize = ( ST25DV_MAX_SIZE / 8 ) & 0xFF;
 CCFileStruct.TT5Tag = 0x05;
 while( NfcType5_TT5Init( ) != NFCTAG_OK ) ;
 
 }

 SmarTag_LED_GREEN_Off();
}


/**
 * @brief Process of the NDEF_URI application
 * @retval None
 */
void MX_NFC7_NDEF_URI_Process(void)
{

 char str[] = "Hello, NFC!";
 const uint16_t size = strlen(str) + 1;
 NfcType5_WriteNDEF(size, (uint8_t *)str);
	 HAL_Delay(300);
}

 

微信图片_20240115161054.jpg

    This topic has been closed for replies.
    Best answer by Rene Lenerve

    Hi Schuyler,

    First point take care that NFC07 is based on ST25DVKC and smartag1 is based on ST25DVK, they are very similar but IC Ref information and some registers are not at same address.

    See DataSheet:

    ST25DV64KC

    ST25DV64K

    Second point, you may check if the memory address is not protected by password for write on I²C side.

    Getting more information about what was wrong (error code returned, line of code where something goes wrong, ..) would help to precise what went wrong.

    If you want to write raw data it would be preferable not to use writeNDEF functions as it is intended to write formated data as NDEF.

    Kind Regards.

    1 reply

    ST Employee
    January 19, 2024

    Hi Schuyler,

    First point take care that NFC07 is based on ST25DVKC and smartag1 is based on ST25DVK, they are very similar but IC Ref information and some registers are not at same address.

    See DataSheet:

    ST25DV64KC

    ST25DV64K

    Second point, you may check if the memory address is not protected by password for write on I²C side.

    Getting more information about what was wrong (error code returned, line of code where something goes wrong, ..) would help to precise what went wrong.

    If you want to write raw data it would be preferable not to use writeNDEF functions as it is intended to write formated data as NDEF.

    Kind Regards.