cancel
Showing results for 
Search instead for 
Did you mean: 

NDEF writing/reading via I2C in X-Nucleo- NFC04A1(ST25DV)

NewOne
Associate

Hi I'm trying to write text via NDEF library to be available to read from EEPROM by phone nfc aplication. Also I want to read text send by phone directly to EEPROM. I tried to change NDEF_URI example method to implement NDEF_WriteText and NDEF_ReadText method and write some text into ST25DV EEPROM and read from but honestly I have no idea what's wrong with my conception. Could you show me some code where you are using these methods?

35 REPLIES 35
Schuyler
Senior

The NFC7 code you use is “en.x-cube-nfc7�? and I didn't make any changes? Can I see a screenshot that shows up correctly?

Rene Lenerve
ST Employee

Hi @帅罗.1 (Community Member)​,

Did you check in debug mode to see what's going wrong and where the error is, this will be the correct way to help you.

Kind regards.

Schuyler
Senior

Hi,@Rene Lenerve 

I'll take your advice,and to help me solve the problem quickly,could you please provide the code you tested so that I can check whether there is any problem with my hardware?

Rene Lenerve
ST Employee

Hi @帅罗.1 (Community Member)​,

The code is the NFC7 package available on st.com here. No modification needed, use the NDEF_URI project. If it is working your hardware is good. Then run with your modified code in debug mode step by step and tell us errors or condition not satisfied to write NDEF.

Kind Regards.

Schuyler
Senior

Hi,@Rene Lenerve​ 

I used code from X-CUBE-NFC7 - Dynamic NFC/RFID tag IC software expansion for STM32Cube - STMicroelectronics,and I run the  NDEF_URI successfully. Here are the results of the run,My ST25 Tap still doesn't have any NDEF messages.0693W00000aPNq4QAG.png

Rene Lenerve
ST Employee

Hi @帅罗.1 (Community Member)​,

This is not result of the run but result of the flash programming, which mean the binary has been correctly programmed.

Could you share the memory content of your tag.

The correct content is the following:

E1 40 40 05
03 15 D1 01
11 55 01 73
74 2E 63 6F
6D 2F 73 74
32 35 2D 64
65 6D 6f FE

This correspond to an NDEF message of type URI with an URL record that point to www.st.com/st25-demo (data after last byte 0xFE are not used). If your tag memory isn't filled with those data, please use the debug mode to understand what and where is the error. Without this information it will be hard to help you.

Some advice on posting on this forum please use as much as possible code snippet when you are sharing code or text data on this forum instead of pictures.

Kind regards.

Schuyler
Senior

Hi,@Rene Lenerve​ 

I know your mean, My ST25 Tap still doesn't have any NDEF messages. My NDEF is only shows 00 00 00 00,The following is the standard code.

void MX_NFC7_Process(void)

{

 /* USER CODE BEGIN NFC7_Library_Process */

 /* USER CODE END NFC7_Library_Process */

 MX_NFC7_NDEF_URI_Process();

}

void MX_NFC7_NDEF_URI_Init(void)

{

 /******************************************************************************/

 /* Configuration of X-NUCLEO-NFC02A1                     */

 /******************************************************************************/

 /* Init of the Leds on X-NUCLEO-NFC07A1 board */

 NFC07A1_LED_Init(GREEN_LED );

 NFC07A1_LED_Init(BLUE_LED );

 NFC07A1_LED_Init(YELLOW_LED );

 NFC07A1_LED_On( GREEN_LED );

 HAL_Delay( 300 );

 NFC07A1_LED_On( BLUE_LED );

 HAL_Delay( 300 );

 NFC07A1_LED_On( YELLOW_LED );

 HAL_Delay( 300 );

 /* Init ST25DVXXKC driver */

 while( NFC07A1_NFCTAG_Init(NFC07A1_NFCTAG_INSTANCE) != NFCTAG_OK );

 /* Reset Mailbox enable to allow write to EEPROM */

 NFC07A1_NFCTAG_ResetMBEN_Dyn(NFC07A1_NFCTAG_INSTANCE);

 NfcTag_SelectProtocol(NFCTAG_TYPE5);

 /* 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 = ( ST25DVXXKC_MAX_SIZE / 8 ) & 0xFF;

  CCFileStruct.TT5Tag = 0x05;

  /* Init of the Type Tag 5 component (M24LR) */

  while( NfcType5_TT5Init( ) != NFCTAG_OK );

 }

 /* Init done */

 NFC07A1_LED_Off( GREEN_LED );

 HAL_Delay( 300 );

 NFC07A1_LED_Off( BLUE_LED );

 HAL_Delay( 300 );

 NFC07A1_LED_Off( YELLOW_LED );

 HAL_Delay( 300 );

 /* Prepare URI NDEF message content */

 strcpy( URI.protocol,URI_ID_0x01_STRING );

 strcpy( URI.URI_Message,"st.com/st25-demo" );

 strcpy( URI.Information,"\0" );

 /* Write NDEF to EEPROM */

 HAL_Delay(5);

 while( NDEF_WriteURI( &URI ) != NDEF_OK );

 /* Set the LED3 on to indicate Programing done */

 NFC07A1_LED_On( YELLOW_LED );

}

Schuyler
Senior

Hi,@Rene Lenerve 

I'm using the official code without any changes, so I think I do not need use the debug mode, Will there be other problems?

Rene Lenerve
ST Employee

Hi @帅罗.1 (Community Member)​,

The NFC7 code is working with the NFC7 expansion board and nucleo board, so you seems to have something wrong with your setup, otherwise the memory would be filled with correct data. So please run the debug mode in order to see where the error is, without this information it will not be possible to help you and know what problem it is.

Kind Regards.

Schuyler
Senior

Hi,@Rene Lenerve​ 

I would like to ask what hardware requirements are required to meet this function?