1 Reply Latest reply on Oct 8, 2018 5:36 AM by PY_21

    Watchdog Timer Interrupts and BLE Advertising


      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!