Skip to main content
Visitor II
December 5, 2018
Solved

Question about NDEF writing delay with NFC04A1!

  • December 5, 2018
  • 2 replies
  • 905 views

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.

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

    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.

    2 replies

    ST Employee
    December 6, 2018

    ​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.

    Patrick1Author
    Visitor II
    December 9, 2018

    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.​

    ST Employee
    December 10, 2018

    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.