I have a CY8C4248LQI-BL583 and is a PSOC 4 BLE module. I only use the BLE in advertisement mode, so it does not need to form a connection with a central node. However, I want to set my BLE to advertise and scan every 10 seconds, and I use the Real Time Clock (RTC), for this. The RTC also serves to create date and time stamps for my application. I also want my application to consume as less power as possible, therefore, if I place my BLE device in deep sleep mode doe the RTC remain active or is it affected? Can I use the RTC to get in and out of sleep mode, similar to the WDT?
To my understanding the RTC uses the WCO and according to the following Table below (from application note AN86233) the WCO remains on in deep sleep mode.
The RTC in PSoC4 is software RTC. That means there is no dedicated hardware block for implementing RTC inside PSoC.
To emulate the RTC inside PSoC4, the firmware should call the function "RTC_update()" once in a second. For this you can use any Timer. If you want to put the system in deep sleep, you can use WDT to generate the inerrupt once in every second and to call the RTC_update().
Please refer the code examples "RTC_P4_Systick_Example01" for Systick timer based RTC and "RTC_P4_WDT_Example01" for WDT based RTC. You can get these Code Examples in PSoC Creator itself.
Thank you so much for your response! In the "RTC_P4_WDT_Example01" example what is the purpose of first setting counter 0 with an interrupt to then set counter 0 with an interrupt to update the RTC? Why can't counter 0 be originally be set with an interrupt to update the RTC?
Also, if I place my BLE and cpu to deep sleep mode, will the WDT interrupt wake them both up?
There is no special significance in changing the call back function inside the ISR. The ISR is to just enable the RTC call back and to change the timer source for WDT from ILO to WCO. You can configure the RTC call back directly.
Please find Table 3 in the attached application note i.e. "PSoC 4 Low Power Modes and Power reduction Techniques".