8 years, 11 months ago.

Nucleo_NFC: why does TT4_ReadURI(&URIin) always succeed and report the same value than previous ?

Hi,

I have one simple question about M24SR of Nucleo-NFC01A1 on STM32F411RET6. I start with the Nucleo_NFC_Example.

Why calling the TT4_ReadURI(&URIin) does always report the same value once it has returned one ?

In the Nucleo_NFC_Example project, the main loop is only :

    while(1)
    {
        // blink LED on Nucleo board when done
        wait(0.5);
        myled = !myled;
    }

The acquisition block is before the main loop:

    while(TT4_ReadURI(&URIin) != SUCCESS)
    { ...
    }
    ...
    pc.printf("URIin contents:\n");
    pc.printf("URIin.protocol=%s\n", URIin.protocol);
    pc.printf("URIin Type: %d\n", getUriType(URIin.protocol));
    pc.printf("URIin.URI_Message=%s\n\n", URIin.URI_Message);

and it works fine.

But if I put an acquisition in the main loop:

    while(1)
    {
        // blink LED on Nucleo board when done
        wait(2);
        myled = !myled;

        memset(&URIin, 0x00, sizeof(URIin));
        memset(&NDEF_Buffer, 0x00, sizeof(NDEF_Buffer));

        nfcled1 = 0;
        BlinkLEDCounter = 0;
        while(TT4_Init()!=SUCCESS)
        {
            if(BlinkLEDCounter < BLINK_LED_CYCLES)
            {
                BlinkLEDCounter++;
            }
            else
            {
                BlinkLEDCounter=0;
                nfcled1 = !nfcled1;
            }
        }
        // success
        nfcled1 = 1;
        pc.printf("TT4_Init SUCCESS\r\n\r\n");

        while(TT4_ReadURI(&URIin) != SUCCESS)
        {
            if(BlinkLEDCounter < BLINK_LED_CYCLES)
            {
                BlinkLEDCounter++;
            }
            else
            {
                BlinkLEDCounter=0;
                nfcled3 = !nfcled3;
            }
        }
        // success
        nfcled3 = 1;
        pc.printf("TT4_ReadURI SUCCESS\r\n\r\n");

        // Display contents read back
        pc.printf("URIin contents:\r\n");
        pc.printf("URIin.protocol=%s\r\n", URIin.protocol);
        pc.printf("URIin Type: %d\r\n", getUriType(URIin.protocol));
        pc.printf("URIin.URI_Message=%s\r\n\r\n", URIin.URI_Message);
    }

Then the (TT4_ReadURI(&URIin) != SUCCESS) always succeeds and reports last read tag.

thanks for your help, Yves

Be the first to answer this question.