cancel
Showing results for 
Search instead for 
Did you mean: 

Question about NDEF writing delay with NFC04A1!

Patrick1
Associate II

Hi, i'm using NFC04A1 with NUCLEO-F401RE board, and im very new on this.

Trying to send NDEF texts (88bytes) with <1sec period ,but i cannot make it short less than 1.2sec.

Here's the while loop code with 1.2sec period.

while (1)

 { 

NFC04A1_LED_ON( BLUE_LED );

while( NDEF_WriteText(myMessage) != NDEF_OK );

NFC04A1_LED_OFF( BLUE_LED );

HAL_Delay(600);

HAL_GPIO_TogglePin(GPIOA,GPIO_PIN_5);

 }

I have tried many times with various HAL_Delay value and 600ms is the best for now.

Can't it be shorter?

Please give me some advices.

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Rene Lenerve
ST Employee

Hi @Patrick​ ,

Normally the driver is Polling the device address (I²C) to check when writing is finished. So from what I understood of your code is you are looping continuously on an I²C writing. The memory cannot be accessed in the same time by I²C and RF, there is an arbitration. That could explain why the Phone cannot access memory except if you give time to do (HAL_Delay).

I think you should reconsider your sequence and only write in I²C only when it is needed to allow time for the RF commands.

May I also suggest you to have a look to the Datasheet of the ST25DV (https://www.st.com/content/st_com/en/products/nfc/st25-nfc-rfid-tags-readers/st25-dynamic-nfc-tags/st25dv-i2c-series-dynamic-nfc-tags/st25dv04k.html), this device has some features that could help to better manage arbitration between I²C and RF (e.g. GPO, ...).

Hope this can help.

Regards.

View solution in original post

3 REPLIES 3
Rene Lenerve
ST Employee

​Hi @Patrick​ ,

When you write data to the tag the driver is polling the device on I²C to know when it has finished writing. So normally, you shouldn't have to use HAL_Delay to wait until data are written to memory.

Writing 4 bytes takes about 5 ms max for this memory, so 88 bytes should take about 110ms + MCU processing and I²C time.

What is the problem removing the HAL_Delay in the loop?

Regards.

Hi Rene, Thanks for the answer​.

If i delete HAL_Delay in the loop, NDEF Message cannot be received.

Receiver (Phone) does not respond or find a tag without any messages inside(Empty Tag detect).

If so, what do you think i should do to get the messages with period under 1 sec??

Waiting for your answer.

Thanks.​

Rene Lenerve
ST Employee

Hi @Patrick​ ,

Normally the driver is Polling the device address (I²C) to check when writing is finished. So from what I understood of your code is you are looping continuously on an I²C writing. The memory cannot be accessed in the same time by I²C and RF, there is an arbitration. That could explain why the Phone cannot access memory except if you give time to do (HAL_Delay).

I think you should reconsider your sequence and only write in I²C only when it is needed to allow time for the RF commands.

May I also suggest you to have a look to the Datasheet of the ST25DV (https://www.st.com/content/st_com/en/products/nfc/st25-nfc-rfid-tags-readers/st25-dynamic-nfc-tags/st25dv-i2c-series-dynamic-nfc-tags/st25dv04k.html), this device has some features that could help to better manage arbitration between I²C and RF (e.g. GPO, ...).

Hope this can help.

Regards.