You can use the function Cy_SCB_UART_DeepSleepCallback that handles the transition of the SCB UART into and out of Deep Sleep mode. It prevents the device from entering Deep Sleep mode if the UART is transmitting data or has any data in the RX FIFO.
Please refer to the PDL driver under PDL API Reference -> SCB -> UART -> Functions -> Low power callbacks
You need to register this call back function to Cy_SysPm_RegisterCallback.
Refer to the app note PSoC 6 MCU Low-Power Modes and Power Reduction Techniques Appendix C on how to register a call back function for low power mode transition.
Hope this helps!
Thank you! I'm currently researching your recommendation for proper implementation. It sounds like exactly what I need.
Is there a PSoC6 example that uses the UART and establishes the callback you speak of before going into deepsleep?
I've been able to use Cy_SCB_UART_DeepSleepCallback() as a callback function. I now don't appear to have UART framing errors when going to sleep.
I do appreciate the elegance of the callback registering technique but it does make it more complicated. Not intuitive to the novice user. Would it make more sense that PDL components have a default API call to the SysPM manager libs that the user can use. this would simplify setup of the register as long as the user doesn't need special considerations.
We are glad that you got it working!
We understand your concern. We will create an enhancement request to improve our documentation to provide better experience to our customers.
Thank you for choosing Cypress products!