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

nRF52832 SPI slave event can not receive

hi :

i send characters of SPI master of 52DK to SPI slave of our target board(Nordic nRF52832), our target board use SDK v12 spis example. but spi slave event can not rececive from SPI master. my code as below:

#ifndef SPIS1_ENABLED
#define SPIS1_ENABLED 1
#endif

void spis_event_handler(nrf_drv_spis_event_t event)
{
    if (event.evt_type == NRF_DRV_SPIS_XFER_DONE)
    {
        spis_xfer_done = true;
        NRF_LOG_INFO(" Transfer completed. Received: %s\r\n",(uint32_t)spis_rx_buf);
    }
}

spis init()
{
    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;
	
    APP_ERROR_CHECK(nrf_drv_spis_init(&spis, &spis_config, spis_event_handler));	
}

main()
{
    while (1)
    {
        memset(spis_rx_buf, 0, spis_rx_length);
        spis_xfer_done = false;

        APP_ERROR_CHECK(nrf_drv_spis_buffers_set(&spis, spis_tx_buf, spis_tx_length, spis_rx_buf, spis_rx_length));
		
        while (!spis_xfer_done)
        {
            __WFE();
        }
        
    }
}

please give me a suggest, thanks

Parents
  • Your code looks like it using SPIS which is where the nRF52 is the slave

    I think you should be using SPIM where the nRF52 is the master and the other device is the slave

    Edit.

    No I re-read your question, I'm not sure which code you posted.

    Perhaps it is your slave device. If so please ignore this answer

    But.

    I did you attach a logic analyser to the SPI lines, is the master sending data ?

Reply
  • Your code looks like it using SPIS which is where the nRF52 is the slave

    I think you should be using SPIM where the nRF52 is the master and the other device is the slave

    Edit.

    No I re-read your question, I'm not sure which code you posted.

    Perhaps it is your slave device. If so please ignore this answer

    But.

    I did you attach a logic analyser to the SPI lines, is the master sending data ?

Children
No Data
Related