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

Closing the TimeSlot API in Observer Example

I'm using the Github project github.com/NordicSemiconducto... in order to SCAN in a specific channel rather than all 3 channels. I don't want to use the timeslot API continuously, and I want to be able to activate and deactivate it.

For deactivating it (in the specific observer example) is it just enough to use: sd_radio_session_close () and disable the two interrupts: SD_EVT_IRQn and SWI0_IRQn with sd_nvic_DisableIRQ.

  • do not disable SD_EVT_IRQn if there is parallel BLE activity from softdevice other than time_slot traffic.

    Yes, closing the session will disable time-slot session and you can also disable SWI0_IRQQn if not using it.

  • Thanks, I did this. But, after closing the session, is there any way to see if it's still scanning or not? The whole purpose of using the timeslot for me was to scan in a single channel (hope that like the advertising part, a channel mask will be added for scanning in the future). I want to start advertising after this scan. However, a strange problem happened. I tried to advertise similar to the example provided by Petter for me. After using SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_XTAL_20_PPM, NULL) in ble_stack_init function, the program jumps to the start of MAIN! This was tested on PCA20006 and S110 SDK 9. That example was working with normal scan and then adv in all 3 channels (no timeslot). But right now after closing the timeslot session and using the same functions for ADV it fails.

  • I know the issue of advertising might need another post, but I'm trying to figure out if this problem has anything to do with how I closed the radio session. My assumption was that as soon as I close the session, whatever program that I was running before can be run afterwards without any change. Off course, based on Hung Bui suggestion I changed the SD_EVT_IRQHnadler in the observer example to a combination of SYS_EVT_DISPATCH and a call to timeslot_sys_evt_handler. The observer example provides a nrf_adv_conn_init() function for advertising and by using that I was able to advertise. This function doesn't use SOFTDEVICE_HANDLER_INIT & softdevice_ble_evt_handler_set(ble_evt_dispatch). Both of these were used in Petter's example & Beacon application. So I'm not sure if these cause the problem or closing the session

  • after closing the time slot session you can put a breakpoint in the timeslot callback handler and see if anything hits. if not then we can say with confidence that no timeslots are being scheduled.

    Otherwise if your scanner is active then see if it sends any scan requests by sniffing the packets.

    Regarding your other problem of the program jumping to start or main, seems like there is some error_check failure in your app and the default behavior of the assert handler is to do a system soft reset.

Related