20719 Button callback context and interrupt execution time

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
naroc_3877611
Level 1
Level 1

I'm developing an application using the 20719 silicon, namely the CYBT-423028-02 module. The application is designed to collect data from a sensor over a hardware serial bus, and forward it over the Bluetooth connection using the serial port profile.

The basic application is working in that it catches the sensor pin interrupt and does the appropriate transaction to collect the data which is then forwarded over Bluetooth. The issue I'm having is that if I start pushing the data rate towards what I require for the application (250 samples per second), the module will crash. From experimentation, I've found that the module will crash even if I do not initialize the Bluetooth stack at all (commenting out wiced_bt_stack_init call) and only have the application reading data from the sensor. But it won't crash if I remove the call to actually read the sensor, which is an approximate 300us SPI transaction. If I just toggle a pin state and return, the module will continue running normally.

So from this information, I'm guessing that if you get a callback generated by a pin interrupt which was registered with wiced_platform_register_button_callback, you must return within a set time period. What is this time period exactly, and where is it documented? Further, does this callback execute from interrupt context and is holding off other critical system interrupts, which is why the chip is crashing? If that's the case, is there a way for me to tell the module that I need to execute something from the main context instead so that I don't hold off the module's critical functions? Normally I would use a worker thread, but WICED Studio does not implement the RTOS for this module as far as I am aware (it has the header file, but is missing the (SDK directory)/WICED/RTOS folder which defines the RTOS).

Thanks for any help in advance, let me know if you need more information to answer my questions in paragraph 3.

0 Likes
2 Replies