This project uses BLE Adv and connection events to update RTC in PSoC4. This method of synchronizing RTC to BLE events helps to avoid using WDT or any other interrupt waking up the device from deep sleep in between BLE advertising or connection intervals to update the RTC. This method is ideally suited for low power applications where Adv and connection intervals can be one second.Project Details
BLE component is configured to have advertising interval as 1sec. The central device should have connection interval as 1sec.
- RTC period is set to 1sec in firmware using the API
RTC_Update()has to be called once in every advertising and connection interval. Multiple BLESS interrupts happen within an advertising or connection interval, which wakes up the device multiple times and puts it back to deep sleep/sleep.
CYBLE_BLESS_STATE_ECO_ONhappens only once in an adv or connection interval. So
RTC_Update()is called once the device wakes up from deepsleep due to a BLESS interrupt and if the BLESS state is
CYBLE_BLESS_STATE_ECO_ON. On board Red LED is toggled to indicate the RTC time update. Also, the updated time is send over UART.
Program the project to 042BLE kit.
The device starts advertising. Use CySmart PC or mobile app to connect to the device. Remember to set the connection intervals in the app as 1sec before making the connection.
You will see the RTC time updating every 1sec in UART terminal. Also, the Red LED on the kit also toggles every 1sec in advertising and connected states.