Hi there,
We are wondering why registering a CY_SYSPM_DEEPSLEEP call back with Cy_SysPm_RegisterCallback() at different parts of our code returns different results with low power mode.
We have a startup sequence with the callback registration:
void Boot()
{
Core_Init(); // Starts watchdog, power mode handling, etc.
SensorBus_Init(); // Starts I2c data bus
Ble_Init(); // Starts bluetooth
UI_Init(); // Starts pwm's and switches
cy_stc_syspm_callback_t DeepSleepCb = {DeepSleepCallback, CY_SYSPM_DEEPSLEEP,
CY_SYSPM_SKIP_CHECK_READY | CY_SYSPM_SKIP_CHECK_FAIL,
&callbackParams, NULL, NULL};
Cy_SysPm_RegisterCallback(&DeepSleepCb);
}
We would like to register the callback inside Core_Init() but noticed that doing so triggers a fault caused by Cy_BLE_Start() inside Ble_Init(). It seems that there's a mandatory order of registering the callbacks? So for testing purposes we register the callback after Cy_BLE_Start(). But then another fault is triggered upon calling any low power mode API's (Cy_SysPm_EnterLowPowerMode(), Cy_SysPm_Sleep(), etc.) which according to the debugger is triggered at the internal call of Cy_SysPm_ExecuteCallback(). In result, we registered the callback after all initialization which does the job. However we are curious about the issue caused by the sequence of registering the callback.
Best,
Steve
Solved! Go to Solution.
Steve,
Can you take a look at this post and my responses there? We do have an issue in our PDL that impacts the order in which callbacks are registered. I believe you are facing a similar issue. I have provided a workaround as well in the post. Try it and let me know if that solves your issue as well.
Regards,
Meenakshi Sundaram R
Steve,
Can you take a look at this post and my responses there? We do have an issue in our PDL that impacts the order in which callbacks are registered. I believe you are facing a similar issue. I have provided a workaround as well in the post. Try it and let me know if that solves your issue as well.
Regards,
Meenakshi Sundaram R