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

NRF52 Multiprotocol with TIMESLOT ESB

Hello, I recently migrated to nrf52 and countering some problems with NRF_ESB concurrently with BLE.

I started with This example which was a part of the Running micro-ESB concurrently with BLE tutorial.

Since this example used a micro esb and older version of the time slot API, I tried to modify the code that utilizes NRF_ESB and TIME SLOT API in SDK 11. Also, since I only needed to receive data with ESB, I got rid of the transmitting part of the example.

When I log the code, I see that the timeslot API works correctly. Every part works as expected.

void TIMESLOT_BEGIN_IRQHandler(void)
{
    uint32_t err_code;
	NRF_LOG("TIMESLOT_BEGIN_IRQHandler\r\n");

    err_code = nrf_esb_init(&nrf_esb_config);
   	NRF_LOG_PRINTF(" esb init error code: %d\r\n",err_code);
    APP_ERROR_CHECK(err_code);
    err_code = nrf_esb_start_rx();
		NRF_LOG_PRINTF(" esb start error code: %d\r\n",err_code);
    APP_ERROR_CHECK(err_code);
}

I do not get any error code in this part of the code either.

However when I run esb_ptx example in a second chip, I do not get any response from the function

void nrf_esb_event_handler(nrf_esb_evt_t const * p_event)

I do get multiple

NRF_RADIO_CALLBACK_SIGNAL_TYPE_RADIO 

calls from

nrf_radio_signal_callback_return_param_t * radio_callback(uint8_t signal_type)

Also, when I scan for the device from my phone, the chip shuts down.

Can somebody look at my code.

Thank you, John Lee main.c timeslot.h timeslot.c

I tried to upload the full code but the attachment module does not let me do it

Parents
  • timeslot.cI have managed to modify your timeslot.c and it works fine. Attached please find the file.

  • UESB_RX_HANDLE_IRQHandler is running at lower interrupt level, allowing radio/bluetooth to operate without any hindrance. In other words, Timer 0 is operating at highest interrupt level of 0, which then triggers TIMESLOT_BEGIN_IRQHandler set with priority 1, which in turn triggers UESB_RX_HANDLE_IRQHandler set at priority 3. You may remove this function and read the data directly in TIMESLOT_BEGIN_IRQHandler instead. Some more information: Set a breakpoint in app_error_weak.c line 29, and if the SoftDevice crashes it may give you some clues from the call stack. Also comment out the code inside the function sleep_mode_enter() or better set it with conditional define as #ifdef DEBUG because you can't place the device into sleep whilst in debug mode. Notice it will crash otherwise. Finally, don't use Timer0 counter[2]. It also crashes the SoftDevice (I don't know why).

Reply
  • UESB_RX_HANDLE_IRQHandler is running at lower interrupt level, allowing radio/bluetooth to operate without any hindrance. In other words, Timer 0 is operating at highest interrupt level of 0, which then triggers TIMESLOT_BEGIN_IRQHandler set with priority 1, which in turn triggers UESB_RX_HANDLE_IRQHandler set at priority 3. You may remove this function and read the data directly in TIMESLOT_BEGIN_IRQHandler instead. Some more information: Set a breakpoint in app_error_weak.c line 29, and if the SoftDevice crashes it may give you some clues from the call stack. Also comment out the code inside the function sleep_mode_enter() or better set it with conditional define as #ifdef DEBUG because you can't place the device into sleep whilst in debug mode. Notice it will crash otherwise. Finally, don't use Timer0 counter[2]. It also crashes the SoftDevice (I don't know why).

Children
No Data
Related