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

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

  • Thank you so much for taking your time and helping me. I really appreciated it.

    I was able to successfully run the code.

    I see that you changed the code so that you set base addresses and set prefixes in TIMESLOT_BEGIN_IRQHandle and added NVIC_SetPendingIRQ(TIMESLOT_END_IRQn); in NRF_RADIO_CALLBACK_SIGNAL_TYPE_EXTEND_FAILED . Were there any other problems in my code?

    Also, I have a quick question. What happens when I don't use UESB_RX_HANDLE_IRQHandler and instead do the data reading in NRF_RADIO_CALLBACK_SIGNAL_TYPE_RADIO

  • 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).

  • @Muratza & JohnLee: thanks for reporting the issue with CC[2], we found that it's a bug in the softdevice, you need to clear both CC[1] and CC[2] and INTEN register for their event before return the timeslot back to the softdevice. Otherwise the softdevice will crash.

    We also porting the ESB+timeslot example to SDK v11 and will update the github repo.

  • @Hung Bui: You mentioned that you are porting the ESB & timeslot example to SDK11 (and also nRF52 support?). At GitHub there is still the old version with SDK9. Is there any progress on this? I would love to play around with this example.

Related