Conditions for NRFX_SPIS_XFER_DONE event Trigger

I am using SPIS for my project. I am manually toggling CS for the peripheral. I get NRFX_SUCCESS for nrfx_spis_buffers_set() function. Also, when I probe the CS signal on oscilloscope, I see that CS transitions from low to high state. However, I am not getting NRFX_SPIS_XFER_DONE event.

My code is looking for NRFX_SPIS_XFER_DONE event to proceed further. I am not sure what will make  NRFX_SPIS_XFER_DONE event to get triggered as I have buffers set appropriately (getting NRFX_SUCCESS) and also CS going to High state. 

I am using NRF53 with nrfConnect SDK

Parents
  • Hi,

    The NRFX_SPIS_XFER_DONE events occurs after a END event in the peripehral itself (see product specification for details). Based on what you write, you are just testing with toggling CS, and not actually having a SPI master? The slave does not generate it's own clock, so if you don't have a master (real or dummy) that drives the clock, there will not be any transactions.

  • I am using NRF5340 as SPI slave and an image sensor as SPI master. I am getting all signals from the sensor. CS also gets toggled from Low to High state and the data output from the camera is fed to MOSI pin. However, when I printed the rx_buffer, it's not getting updated, but I am getting NRFX_SUCCESS for nrfx_spis_buffers_set(). Maybe this is the reason why I am not able to get NRFX_SPIS_XFER_DONE event. How can this be resolved

    Below is my prj.conf

    # GPIO
    CONFIG_GPIO=y
    
    # I2C
    CONFIG_I2C=y
    
    # Log
    CONFIG_LOG=y
    
    # Bluetooth
    CONFIG_BT=y
    CONFIG_BT_PERIPHERAL=y
    CONFIG_BT_GATT_CLIENT=y
    CONFIG_BT_DEVICE_NAME="Test"
    CONFIG_BT_DEVICE_APPEARANCE=833
    CONFIG_BT_MAX_CONN=1
    CONFIG_BT_MAX_PAIRED=1
    CONFIG_BT_BUF_ACL_RX_SIZE=502
    CONFIG_BT_ATT_PREPARE_COUNT=2
    CONFIG_BT_L2CAP_TX_BUF_COUNT=10
    CONFIG_BT_L2CAP_TX_MTU=498
    CONFIG_BT_CONN_TX_MAX=10
    CONFIG_BT_BUF_ACL_TX_COUNT=10
    CONFIG_BT_BUF_ACL_TX_SIZE=502
    CONFIG_BT_USER_DATA_LEN_UPDATE=y
    CONFIG_BT_USER_PHY_UPDATE=y
    CONFIG_BT_HCI_CORE_LOG_LEVEL_INF=y
    CONFIG_BT_RX_STACK_SIZE=8192
    
    # GPIOTE
    CONFIG_NRFX_GPIOTE=y
    # The below command is needed to include multiple GPIOTEs (FRAME_VALID, LINE_VALID).
    # Else, the configuration of GPIOTE initialized second would fail. Only the first one would work
    CONFIG_NRFX_GPIOTE_NUM_OF_EVT_HANDLERS=2
    
    # Timer
    CONFIG_NRFX_TIMER0=y
    CONFIG_NRFX_TIMER1=y
    
    # SPI
    CONFIG_SPI=n
    CONFIG_NRFX_SPIM2=n
    CONFIG_NRFX_UARTE2=n
    CONFIG_NRFX_SPIS2=y
    
    CONFIG_LOG_BUFFER_SIZE=10000

  • I am not able to say much based on just your config, Can you share the code as well? Also, if you need a simple example of using SPI slave, you can look at this unoficial sample that includes a slave and a master. This use the Zephyr API, but there are also samples using nrfx directly under modules/hal/nordic/nrfx/samples/src/nrfx_spim_spis/ in the SDK.

  • modules/hal/nordic/nrfx/samples/src/nrfx_spim_spis/- This is the example I referred to implement.

    I have attached the complete code in a private ticket.

    Thanks!

Reply Children
Related