This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

About SPIS and SPIS event "NRF_DRV_SPIS_XFER_DONE"

Hi Nordic,

I am using SDK 12.3.0, S130 2.0.1 and PCA10028 nrf51 DK.

I would like to ask about SPIS and SPIS event "NRF_DRV_SPIS_XFER_DONE".

1. What would trigger event "NRF_DRV_SPIS_XFER_DONE"? Number of transmitted data reach rx_amount / tx_amount? CS pin pull-high?

2. What would happen if number of transmitted data not reach rx_amount / tx_amount and CS pin already pull high? Would it trigger other event or timeout?

3. rx_amount and tx_amount must be the same? If not, what data would be transmit to master if rx_amount is greater than tx_amount.

Thank you.

Parents
  • Hi,

    1. The event is triggered when a transfer is completed and the peripheral generated the END event, that means that the SPIS peripheral have acquired the semaphore (described in nRF51 Reference Manual v3.0.1) and the CSN pin is pulled high:

      If the SPI slave acquires the semaphore, the transaction will be granted. The incoming data on MOSI will be stored in the RXD buffer and the data in the TXD buffer will be clocked out on MISO. When a granted transaction is completed and CSN goes high, the SPI slave will automatically release the semaphore and generate the END event.

    2. The SPI master is the one controlling the transfers. The tx_buffer_size/rx_buffer_size passed to the driver is the maximum available buffers. The actual tx_amount/rx_amount is reported in the event struct: nrf_drv_spis_event_t.
    3. No, they do not have to be the same. This is answered in the SPI slave peripheral documentation in nRF51 Reference Manual v3.0.1:

      The MAXRX register specifies the maximum number of bytes the SPI slave can receive in one granted transaction. If the SPI slave receives more than MAXRX number of bytes, an OVERFLOW will be indicated in the STATUS register and the incoming bytes will be discarded. The MAXTX parameter specifies the maximum number of bytes the SPI slave can transmit in one granted transaction. If the SPI slave is forced to transmit more than MAXTX number of bytes, an OVERREAD will be indicated in the STATUS register and the ORC character will be clocked out.

    Best regards,
    Jørgen

Reply
  • Hi,

    1. The event is triggered when a transfer is completed and the peripheral generated the END event, that means that the SPIS peripheral have acquired the semaphore (described in nRF51 Reference Manual v3.0.1) and the CSN pin is pulled high:

      If the SPI slave acquires the semaphore, the transaction will be granted. The incoming data on MOSI will be stored in the RXD buffer and the data in the TXD buffer will be clocked out on MISO. When a granted transaction is completed and CSN goes high, the SPI slave will automatically release the semaphore and generate the END event.

    2. The SPI master is the one controlling the transfers. The tx_buffer_size/rx_buffer_size passed to the driver is the maximum available buffers. The actual tx_amount/rx_amount is reported in the event struct: nrf_drv_spis_event_t.
    3. No, they do not have to be the same. This is answered in the SPI slave peripheral documentation in nRF51 Reference Manual v3.0.1:

      The MAXRX register specifies the maximum number of bytes the SPI slave can receive in one granted transaction. If the SPI slave receives more than MAXRX number of bytes, an OVERFLOW will be indicated in the STATUS register and the incoming bytes will be discarded. The MAXTX parameter specifies the maximum number of bytes the SPI slave can transmit in one granted transaction. If the SPI slave is forced to transmit more than MAXTX number of bytes, an OVERREAD will be indicated in the STATUS register and the ORC character will be clocked out.

    Best regards,
    Jørgen

Children
Related