Skip to main content
Visitor II
May 21, 2021
Solved

Writing 300 bytes causes hard fault using X-CUBE NFC-6 on X-NUCLEO-NFC06A1

  • May 21, 2021
  • 4 replies
  • 1417 views

Hello!

I using X-CUBE NFC-6 library on X-NUCLEO-NFC06A1 board in Card Emulation mode and writing on "tag" (board) 300 bytes of data and it causes hard fault during next read or write "tag".

I think it's a bug in library, can you help me with that problem?

Best regards, Vladimir

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

    Hi @Wladimir​,

    Ok I have seen what is going on, the CCFile defined in the code sets the frame length for each response (MLe) to 127 bytes and the buffer to send data is only of 100 bytes. So if you change the buffer txBuf (line 482, function demoCE) in the file demo_polling.c to that :

    uint8_t txBuf[130];

    this should fix your issue. So the issue is only on the read command, and this is happening only when you are writing data above 100 bytes, because the default ndef is under this size.

    130, because we need to add the 2 bytes responce 90 00 at the end (so it could be above 129).

    I Hope this can help you.

    Best Regards.

    4 replies

    WladimirAuthor
    Visitor II
    May 21, 2021

    About setting up Card Emulation mode see this topic:

    my question about CE mode

    WladimirAuthor
    Visitor II
    May 21, 2021

    Same thing happens when i write 2 records of 150 bytes each , next read or write operation causes hard fault.

    WladimirAuthor
    Visitor II
    May 21, 2021

    When writing messages on tag i using NFC Tools Pro android app

    ST Employee
    May 21, 2021

    Hi @Wladimir​,

    Ok I have seen what is going on, the CCFile defined in the code sets the frame length for each response (MLe) to 127 bytes and the buffer to send data is only of 100 bytes. So if you change the buffer txBuf (line 482, function demoCE) in the file demo_polling.c to that :

    uint8_t txBuf[130];

    this should fix your issue. So the issue is only on the read command, and this is happening only when you are writing data above 100 bytes, because the default ndef is under this size.

    130, because we need to add the 2 bytes responce 90 00 at the end (so it could be above 129).

    I Hope this can help you.

    Best Regards.

    WladimirAuthor
    Visitor II
    May 21, 2021

    Thank you, it helps!)