Announcements
IMPORTANT: Cypress Developer Community is transitioning on October 20th. To learn more and be prepared for this change, check out our latest announcement.
cancel
Showing results for 
Search instead for 
Did you mean: 

Resource Library

Improve the Performance of CyBle_ProcessEvents() on PSoC 4 Devices

Charles_Lai
Moderator
Moderator

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.

0 Likes
Version history
Revision #:
5 of 5
Last update:
‎Sep 10, 2021 03:31 AM
Updated by: