Order of Deep Sleep Callback Registration Causing System Fault

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

cross mob
Anonymous
Not applicable

Hello, I am facing a problem with registering callback functions for deep sleep and hope that someone could help. I am working on a project right now that uses only the cm0 core of the psoc 6 and part of the project uses the i2c bus to sample from an accelerometer to send data across bluetooth.

Where the problem occurs is when integrating deep sleep and the required callback function for i2c low-power mode. As documentation requires the API Cy_SCB_I2C_DeepSleepCallback() must be registered as a callback function and executed before entering deep sleep mode. The problem is a system fault occurs when registering the callback function before initializing bluetooth, but is ok when registering after initializing bluetooth.

What is recommended to get the former case working? Thank you.

0 Likes
1 Solution
Anonymous
Not applicable

Hi fwan, it turns out the system fault was because the 'cy_stc_syspm_callback_t' structure was being defined locally, but defining it globally fixed the problem. Also, I had to modify the generated file cy_syspm.c as suggested in this post https://community.cypress.com/thread/34855 in order for bluetooth deep sleep callbacks to execute.

View solution in original post

0 Likes
2 Replies
ShipingW_81
Moderator
Moderator
Moderator
500 replies posted 250 solutions authored 250 replies posted

I tried making a simple demo to reproduce this issue but there is no any problem put Cy_SCB_I2C_DeepSleepCallback registering before initializing BLE.

Can you please show relevant code snippet or demo project for us to verify?

0 Likes
Anonymous
Not applicable

Hi fwan, it turns out the system fault was because the 'cy_stc_syspm_callback_t' structure was being defined locally, but defining it globally fixed the problem. Also, I had to modify the generated file cy_syspm.c as suggested in this post https://community.cypress.com/thread/34855 in order for bluetooth deep sleep callbacks to execute.

0 Likes