Skip to main content
Explorer II
August 7, 2022
Solved

about SPI HW chip select

  • August 7, 2022
  • 4 replies
  • 907 views

Dear Sir,

I am porting RFAL now. Based on 5.8 in UM2890, for HW chip selection, macro ST25R_COM_SINGLETXRX should be set. In st25r3916_com.c, the following code declared a local buffer.

#if defined(ST25R_COM_SINGLETXRX) && !defined(RFAL_USE_I2C)

static uint8_t comBuf[ST25R3916_BUF_LEN];               /*!< ST25R3916 communication buffer                 */

static uint16_t comBufIt;                       /*!< ST25R3916 communication buffer iterator            */

#endif /* ST25R_COM_SINGLETXRX */

I can understand why such local buffer is need. Is it dependent on some host specification which provide single byte access?

If I use a host that support multibytes access, is it not necessary

to use such local buffer for my case?

best regards

Dai Sai

    This topic has been closed for replies.
    Best answer by Ulysses HERNIOSUS

    Dear Sai,

    the folder test/compile_defines is a folder containing internal tests for continuous integration. The platform.h is not meant to have a meaningful implementation of the SPI.

    Please rather see the various platform.h files in the Projects folder on top level.

    I would like to also hint you on rfal.chm contained inside the RFAL folder and the UM2890 available from st.com.

    Best Regards, Ulysses

    4 replies

    Technical Moderator
    August 8, 2022

    Hi Dai,

    ST25R_COM_SINGLETXRX is for cases where you have and SPI driver which automatically drives the chip select pin and where every SPI frame needs to be handed as one buffer to the SPI driver.

    Without setting this define the big buffer is not allocated but at the expense that the SPI throughput will be reduced due to needing multiple calls of SPI driver to transmit/receive one frame.

    Best Regards, Ulysses

    DSai.1Author
    Explorer II
    August 9, 2022

    Dear Ulysses,

    thank you very much for your reply.

    I got the reason.

    I checked the platform.h at

    ST25NFC_Embedded_Lib_ST25R3916_1.4.0\Middlewares\ST\RFAL\test\compile_defines

    and found the define as followings

    #define platformSpiSelect()              

    #define platformSpiDeselect()             

    #define platformSpiTxRx( txBuf, rxBuf, len )   

    It seems platformSpiTxRx( txBuf, rxBuf, len )   is cleared here.

    If so, how the transceivion by SPI is realized?

    best regards

    Dai Sai

    Technical Moderator
    August 9, 2022

    Dear Sai,

    the folder test/compile_defines is a folder containing internal tests for continuous integration. The platform.h is not meant to have a meaningful implementation of the SPI.

    Please rather see the various platform.h files in the Projects folder on top level.

    I would like to also hint you on rfal.chm contained inside the RFAL folder and the UM2890 available from st.com.

    Best Regards, Ulysses

    DSai.1Author
    Explorer II
    August 9, 2022

    Dear Ulysses,

    thank you for you great help.

    I will refer the document and code according to your advice.

    Best regards

    Dai Sai