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

enter critical section from radio dispatcher

Hello, I am developing ble scanner in which I want to print data of adv reports over uart. Printing is executed in main and in on_ble_evt function I add items to circular buffer. But as I have many beacons I get too many interrupts and processor cannot follow up with printing. I would rather miss some adv reports and be able to print more data. Assuming I am using softdevice only for scanning how can I "block" softdevice when I get into on_ble_evt (called from ble_evt_dispatch) ? Is CRITICAL_SECTION_ENTER possible here?

Regards,

Michal

  • Hi Michal

    It seems to me the bottle neck here is the speed of the UART, so rather than blocking the SoftDevice I would recommend limiting the printing to a rate that the UART can handle. 

    In other words you should skip printing some of the adv reports when you reach a certain number of adv reports pr second. 

    If you want to be clever about it you could write a system to detect repeated adv reports from the same advertiser, and avoid printing the same report over and over. Then you should be able to report a larger numbers of unique beacons before having to limit the print out. 

    Blocking the SoftDevice itself will cause it to crash, so this I would not recommend.

    Best regards
    Torbjørn

Related