spi sent but no signal received

spim2、ncs2.6.1

I used SPIM2 to send the string "Hello, SPIM!" and receive data of the same length.

However, on the logic analyzer, I can only see the transmitted signals, and there are no received signals。

int zhd_spim_init(void)
{
#if defined(__ZEPHYR__)
    IRQ_CONNECT(NRFX_IRQ_NUMBER_GET(NRF_SPIM_INST_GET(SPIM_INST_IDX)), IRQ_PRIO_LOWEST,
                NRFX_SPIM_INST_HANDLER_GET(SPIM_INST_IDX), 0, 0);
#endif
    nrfx_spim_t spim_inst = NRFX_SPIM_INSTANCE(SPIM_INST_IDX);
    nrfx_spim_config_t spim_config = NRFX_SPIM_DEFAULT_CONFIG(ZHD_SPIM_SCK,
                                                              ZHD_SPIM_MOSI,
                                                              ZHD_SPIM_MISO,
                                                              ZHD_SPIM_CS);
    nrfx_err_t status = nrfx_spim_init(&spim_inst, &spim_config, spim_handler, NULL);
    if (status != NRFX_SUCCESS) {
        LOG_ERR("Failed to initialize SPIM instance: %d", status);
    }
    return status;
}
uint8_t tx_buffer[13] = "Hello, SPIM!";
uint8_t rx_buffer[13] = {0};
__unused void zhd_spim_test(void)
{
    zhd_spim_transfer(tx_buffer, 13, rx_buffer, 13);
}
int zhd_spim_transfer(uint8_t * p_tx_buf, uint8_t tx_length, uint8_t * p_rx_buf, uint8_t rx_length)
{
    nrfx_spim_t spim_inst = NRFX_SPIM_INSTANCE(SPIM_INST_IDX);
    nrfx_err_t status = NRFX_ERROR_NULL;
    // if ((p_tx_buf != NULL) && (tx_length != 0))
    // {
    //     nrfx_spim_xfer_desc_t spim_xfer_desc = NRFX_SPIM_XFER_TX(p_tx_buf, tx_length);
    //     status = nrfx_spim_xfer(&spim_inst, &spim_xfer_desc, 0);
    //     if (status != NRFX_SUCCESS)
    //     {
    //         LOG_ERR("Failed to transfer data: %d", status);
    //         return status;
    //     }
    // }
    // if ((p_rx_buf != NULL) && (rx_length != 0))
    // {
    //     while(!spim_tx_done);
    //     spim_tx_done = false;
    //     nrfx_spim_xfer_desc_t spim_xfer_desc = NRFX_SPIM_XFER_RX(p_rx_buf, rx_length);
    //     status = nrfx_spim_xfer(&spim_inst, &spim_xfer_desc, 0);
    //     if (status != NRFX_SUCCESS)
    //     {
    //         LOG_ERR("Failed to receive data: %d", status);
    //         return status;
    //     }
    // }
    nrfx_spim_xfer_desc_t spim_xfer_desc = NRFX_SPIM_XFER_TRX(p_tx_buf, tx_length, p_rx_buf, rx_length);
    status = nrfx_spim_xfer(&spim_inst, &spim_xfer_desc, 0);
    if (status != NRFX_SUCCESS)
    {
        LOG_ERR("Failed to transfer data: %d", status);
        return status;
    }

    return status;
}
int main(void)
{
zhd_spim_init();
    for (;;) {      
        printk("main loop\r\n");
        zhd_spim_test();
        k_sleep(K_SECONDS(3));
    }
}
I think that even if the slave doesn't respond, the master should still generate 13 bytes worth of clock signals.
Related