- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Improve the Performance of CyBle_ProcessEvents() on PSoC 4 Devices
Symptoms
CyBle_ProcessEvents() might crash in a long run, especially when Deep-Sleep or multiple ISRs are enabled on the same PSoC 4 device.
Diagnosis
BLESS (BLE Sub-System) is a self-maintained component. The MCU doesn't directly handle the activities of BLESS but only communicates with it using callbacks, which makes the communication asynchronous. Hence when the MCU frequently switches between different power modes or gets interrupted by ISRs, the BLESS might sometimes run into unknown states and cannot be recovered without a reset. It's an inevitable design defect of asynchronous communication.
To improve the reliability and durability, we should try to strengthen the connection between the MCU and the BLESS.
Solution
1>>>
Follow the design guideline of PSoC 4 Low-Power Modes, if your code needs it. See below:
https://www.cypress.com/documentation/application-notes/an86233-psoc-4-low-power-modes-and-power-red...
2>>>
Put CyBle_ProcessEvents() inside CyEnterCriticalSection/CyExitCriticalSection, i.e.:
uint8 exp;
exp = CyEnterCriticalSection();
CyBle_ProcessEvents();
CyExitCriticalSection(exp);
It's always okay to do this. You can put CyBle_ProcessEvents() inside the critical session in most of your applications. This is not an officially documented solution but I highly recommend it. It only makes slightly detectable changes to your application but it prevents many unexpected issues as the tests reveal.