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

SPIS blocks BLE application

Hi together,

since quite some time I try to merge my BLE application with the SPIS functionalities from nRF52 SDK 12.3 example with softdevice S132.
My application should receive 200 bytes per second as an SPI slave and forward it to a connected device.
If I just run the SPIS example, everything works fine - all data is properly received.
As soon as I use the function nrf_drv_spis_buffers_set () in my application, the BLE advertising is blocked and nothing happens anymore.

The functions used are called as follows.

int main(void)
{
    uint32_t err_code;
    bool     erase_bonds;

    // Initialize.
    err_code = NRF_LOG_INIT(NULL);
    APP_ERROR_CHECK(err_code);

    NRF_LOG_INFO("====== START BLE_stack ======\r\n");

    timers_init();
    buttons_leds_init(&erase_bonds);

    nrf_drv_spis_config_t spis_config = NRF_DRV_SPIS_DEFAULT_CONFIG;
	spis_config.csn_pin               = 12;
	spis_config.miso_pin              = 24;
	spis_config.mosi_pin              = 23;
	spis_config.sck_pin               = 25;
	spis_config.bit_order 			  = NRF_DRV_SPIS_BIT_ORDER_MSB_FIRST;

    err_code = nrf_drv_spis_init(&spis, &spis_config, spis_event_handler);

    if (err_code != NRF_SUCCESS)
    {
       	NRF_LOG_INFO("SPIS Init failure\r\n");
       	return err_code;
    }
    else
    {
    	NRF_LOG_INFO("SPIS Init success\r\n");
    }

    ble_stack_init();
    peer_manager_init(erase_bonds);

    if (erase_bonds == true)
    {
        NRF_LOG_INFO("Bonds erased!\r\n");
    }

    gap_params_init();
    advertising_init();
    services_init();
    conn_params_init();

    // Start execution.
    NRF_LOG_INFO("NIRSOXY-Service started\r\n");
    application_timers_start();
    err_code = ble_advertising_start(BLE_ADV_MODE_FAST);
    APP_ERROR_CHECK(err_code);

    // Enter main loop.
    while(1)
    {
    	if (NRF_LOG_PROCESS()==false)
    	{
			power_manage();
		}

    	memset(pui8DataTmp, 0, NIRSOXY_SUPER_HEADER_SIZE);
    	spis_xfer_done = false;
    	err_code = nrf_drv_spis_buffers_set(&spis, pui8DataTmp, NIRSOXY_SUPER_HEADER_SIZE, pui8Data, NIRSOXY_SUPER_HEADER_SIZE);
    	if (err_code != NRF_SUCCESS)
		{
			NRF_LOG_INFO("SPIS buffer failure\r\n");
		}
    }
    return (0);
}

Does anyone have an idea or experience how to fix the problem?

Parents
  • As soon as I use the function nrf_drv_spis_buffers_set () in my application, the BLE advertising is blocked and nothing happens anymore.

    The CPU cannot halt in a running program, so if the application is not progressing at all, then it has to be looping somewhere. When you start the application in the debug mode, you can run the debugger for sometime and hit the pause button to see where the PC register is pointing to.  

     

Reply
  • As soon as I use the function nrf_drv_spis_buffers_set () in my application, the BLE advertising is blocked and nothing happens anymore.

    The CPU cannot halt in a running program, so if the application is not progressing at all, then it has to be looping somewhere. When you start the application in the debug mode, you can run the debugger for sometime and hit the pause button to see where the PC register is pointing to.  

     

Children
No Data
Related