Watchdog Timer Interrupts and BLE Advertising

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

cross mob
lock attach
Attachments are accessible only for community members.
addac_3199101
Level 1
Level 1

Hi all,

We are working on a project with the CYBLE-214900 BLE chip. The goal is to have the chip in deep sleep and periodically wake up, take an ADC measurement, and broadcast it through a BLE advertisement. In order to have the chip periodically wake up from deep sleep, we use the Watchdog Timer to generate interrupts. We have verified both the periodic wake up operation (chip wakes up, writes data to EEPROM, goes back to sleep), as well as the BLE advertisement operation (chip continuous advertises packets) separately. However, when we combine the two into one PSoC program, we appear to not be getting watchdog timer interrupts, i.e. the chip is not waking up from deep sleep.

I have attached the our main loop code as the file main.c. The function AppCallback is our BLE event handler but does not serve much purpose outside of initialization (we attempted to monitor the "done" state of the BLE advertising using CYBLE_EVT_GAPP_ADVERTISEMENT_START_STOP event but were not able to see the code block until the packets were sent as expected. CY_ISR is the watchdog timer event handler, which simply increments a counter variable so we can control the period of BLE advertisements. The InitWatchdog function simple initializes the watchdog timer. In the main loop, if the counter has reached its value, an ADC measurement is taken and the CyBle_GappSetNumOfAdvPkts function is used to send a fixed number of data packets. Finally, the CyBle_EnterLPM function is used to put the BLE module to deep sleep, and the CySysPmDeepSleep function to put the chip itself into deep sleep.

I have also attached the entire PSoC project separately. We are not sure if the current WDT clock settings (WCO, ILO, etc..) are not compatible with BLE since the original WDT deep sleep code that we adapted this code from used an EEPROM instead of BLE.

If anyone has any ideas or suggestions as what could be causing this issue, they would be greatly appreciated! Thanks in advance!

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
Yugandhar
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 5 likes given

Hello,

Apologies for the delay.

Please refer the below modified project, in which the device enters into deep sleep mode after stopping the BLE (by calling CyBle_Stop()) and WDT interrupt is used to enable the system. In the main loop, if the counter has reached its value, BLE will start, an ADC measurement is taken and the CyBle_GappSetNumOfAdvPkts function is used to send a fixed number of data packets.

Please let us know if this helps.

Thanks,

P Yugandhar.

View solution in original post

0 Likes
1 Reply
lock attach
Attachments are accessible only for community members.
Yugandhar
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 5 likes given

Hello,

Apologies for the delay.

Please refer the below modified project, in which the device enters into deep sleep mode after stopping the BLE (by calling CyBle_Stop()) and WDT interrupt is used to enable the system. In the main loop, if the counter has reached its value, BLE will start, an ADC measurement is taken and the CyBle_GappSetNumOfAdvPkts function is used to send a fixed number of data packets.

Please let us know if this helps.

Thanks,

P Yugandhar.

0 Likes