UART doesn't work when enable SPIS

Hi guys,

I am using SPIS to receive data from a camera and use UART to put this data back into the terminal. However, I noticed that my UART wouldn't print anything as long as I enabled the SPIS. I do use retargeting to make sure app_uart_put is working as expected. BTW, uart works fine when I disable the SPIS. 

void uart_spis_init() {
    uint32_t err_code;

    nrf_drv_spis_config_t spis_config = NRF_DRV_SPIS_DEFAULT_CONFIG;
    spis_config.csn_pin               = APP_SPIS_CS_PIN;
    spis_config.miso_pin              = APP_SPIS_MISO_PIN;
    spis_config.mosi_pin              = APP_SPIS_MOSI_PIN;
    spis_config.sck_pin               = APP_SPIS_SCK_PIN;
    spis_config.irq_priority          = APP_SPIS_IRQ_PRIORITY;

    APP_ERROR_CHECK(nrf_drv_spis_init(&spis, &spis_config, spis_event_handler));

    const app_uart_comm_params_t comm_params =
      {
          RX_PIN_NUMBER,
          TX_PIN_NUMBER,
          RTS_PIN_NUMBER,
          CTS_PIN_NUMBER,
          UART_HWFC,
          false,
          NRF_UART_BAUDRATE_115200
      };

    APP_UART_FIFO_INIT(&comm_params,
                         UART_RX_BUF_SIZE,
                         UART_TX_BUF_SIZE,
                         uart_error_handle,
                         APP_IRQ_PRIORITY_HIGHEST,
                         err_code);

    APP_ERROR_CHECK(err_code);
}

void spis_event_handler(nrf_drv_spis_event_t event)
{
    if (event.evt_type == NRF_DRV_SPIS_XFER_DONE)
    {

        spis_xfer_done = true;
        app_uart_put("K");
    }
}

int main(void)
{   
    ret_code_t err_code;
    bsp_board_init(BSP_INIT_LEDS);   
    err_code = nrf_drv_gpiote_init(); // Initialize the GPIOTE
    APP_ERROR_CHECK(err_code);
    uart_spis_init();
    while (true)
    {
        spis_xfer_done = false;
        app_uart_put('A');  #uart output testing
        memset(m_rx_buf, 0, m_rx_length);
        APP_ERROR_CHECK(nrf_drv_spis_buffers_set(&spis, m_tx_buf, m_tx_length, m_rx_buf, m_rx_length));
        while (!spis_xfer_done);

        
    }
}

Related