Skip to main content
Visitor II
August 21, 2020
Solved

ST25R3916 - Card Emulation

  • August 21, 2020
  • 9 replies
  • 2184 views

Hi all,

how can i send in card emulation mode extended apdu? it's possible?

    This topic has been closed for replies.
    Best answer by Brian TIDAL

    Hi,

    (ctx).txBufLen = (uint16_t)rfalConvBytesToBits(tBL);

    ==> 2032 bits = 254 bytes (256 - 2 bytes for CRC)

    Rgds

    BT

    9 replies

    Technical Moderator
    August 24, 2020

    Hi,

    X-CUBE-NFC6 provides support and sample code for Card Emulation mode. See demoTransceiveBlocking() in demoCE() for an example of APDU sending.

    Can you elaborate on what you exactly mean by extended APDU? Do you mean extended field coding for Lc and Le fields?

    Rgds

    BT

    Visitor II
    August 24, 2020

    Hi Brian,

    to give you some more context ... i am trying to implement fido2 nfc.

    This is a trace of mi actual software ...

    I receive a err: 37 from mp_st25r3916_transceive_blocking (this is exactly the same as demoTransceiveBlocking() in demoCE())

    Some hints?

    Thanks,

    D.

    Technical Moderator
    August 24, 2020

    Hi,

    err 37 means ERR_LINK_LOSS. I believe this is caused by the big 965 bytes frame (i.e. reader not being able to receive such a big frame). Can you check the FSD value sent by the reader in the RATS (this should be available in the rfalNfcDevice device structure in proto.isodep.info.FSx)

    Do you have traces from the reader side? is the reader able to properly receive the 965 bytes frame or do you see an error code?

    Rgds

    BT

    Visitor II
    August 24, 2020

    Hi,

    FSx: 256

    the reader is an iPhone se 2020 iOS 13.6.1, application is safari with site: https://webauthn.io

    Some hints?

    Thanks,

    D.

    Technical Moderator
    August 24, 2020

    Hi,

    As the FSD=256, the RFAL lib will fragment the big 965 bytes frame in 4 chained smaller frames and the reader is supposed to de-fragment those 4 chained frame into a complete APDU. Is the reader working properly with a reference device? i.e. is the reader able to perform Fido authentication with an existing device? Do you have any trace on reader side? Is the content of the big frame correct (i.e. if some values are incorrect, the reader may be instructed to switch off the RF field ?

    can you provide a SPI trace on ST253916 side? (MISO/MOSI/CS/IRQ_OUT)

    Rgds

    BT

    Visitor II
    August 24, 2020

    Hi,

    the RFAL lib will fragment the big 965 bytes? how I can check this?

    The reader work properly with a YubiKey (a reference device) as I can see a success registration/authentication.

    I haven't any trace on reader side.

    Thanks,

    D.

    Technical Moderator
    August 24, 2020

    Hi,

    the fragmentation can be checked in different ways:

    1. use a RF spy (MP007, proxySPY, etc.)
    2. use a logic analyzer to spy the SPI commands on ST25R3916 (SPI +IRQ)
    3. put some trace in rfalStartTransceive to print the txBufLen

    Rgds

    BT

    Visitor II
    August 24, 2020

    Hi,

    rfalStartTransceive: 2032, what this mean? I have some configuration parameter wrong?

    Thanks, 

    D.

    Technical Moderator
    August 24, 2020

    Hi,

    (ctx).txBufLen = (uint16_t)rfalConvBytesToBits(tBL);

    ==> 2032 bits = 254 bytes (256 - 2 bytes for CRC)

    Rgds

    BT

    Visitor II
    August 24, 2020

    Hi Brian,

    the problem was a timeout not managed correctly by the test site (not reported), solved thanks for your time.

    My best regards, stay safe.

    D.