PSoC4 BLE sleep/deep sleep and WDT not working with breakpoints

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.
KimS_967071
Level 2
Level 2
10 replies posted 5 sign-ins 5 replies posted

I set up a basic project with the BLE advertising fast for 30s and then slow for 30s, a WDT, and a UART.  After the BLE timeout, I restart the Advertising in main.  I added sleep and deep sleep modes to measure current draw on my custom board.  I have a few I/O set up in this project to turn OFF the hardware for the lowest current draw.  I have 2 watchdog timers set up at 50 ms and 1 s and the third one is setup to reset the board at 2s but disabled right now.  I realize that the fast advertising window of 20-30ms is a lot considering my 50 ms WDT but right now I am just trying to test out current draw on my board and figure out the slowest Advertising window I can have while minimizing current draw and still remain connectable (which I haven't implemented here yet).   My product requires the 50 ms WDT so I can't change it.  

The code runs fine if I program the board.  The UART prints the messages and the BLE starts in Fast Advertising, switches to slow Advertising, and then starts again.  And if I turn ON the Uart print statements I can see my 50 ms timer is running too.  I can also run in debug mode but if I add break points I will hit a few of them and then the code stops running properly and no more interrupts happen. Thinking that it might have something to do with the fast Advertising window and my 50 ms WDT I tried running just slow advertising but the same thing happens although I can hit a few more breakpoints.  When I pause the code I have the following call stack:

 

KiSm_967071_0-1645803904693.png

So, it looks like the BLE stops?  And the WDT interrupts stop too.  What do I have wrong?  Do I need to change the interrupt priorities?  I left them at default right now but there are times when the WDT will need to have the priority over BLE.  This device will only be connected to once in a while when the user needs to get status and update settings.  So, when there is no connection the rest of the interrupts will be a higher priority for normal system operation.  

I attached my project.

Thanks,

Kim

0 Likes
1 Solution

Hi @KimS_967071 

It is not good idea to place breakpoints at line 786 and 792 in debug mode instead you can use UART prints for debugging.

 

Thanks & Regards

Pratiksha V

View solution in original post

0 Likes
4 Replies
PratikshaV
Moderator
Moderator
Moderator
100 solutions authored 5 likes given 250 sign-ins

Hi @KimS_967071 

Please let us know at which all breakpoints you are facing this issue.

Thanks & Regards

Pratiksha V

0 Likes

Hi @PratikshaV 

I have tested with breakpoints at the following lines:

696  timer50ms = 0;

786  CySysPmDeepSleep();

792  CySysPmSleep();

I can have just one breakpoint enabled or all of them.  After each time I hit a breakpoint I select run (so not stepping thru the code) and I will hit a few and then it stops responding.

thanks,

Kim

 

0 Likes

I responded online too. I downloaded the Cycling Sensor project and it
looks like what I am doing. I will dig deeper and compare to see if I can
find the mistake. I was using the Glucose Sensor when I started which is
similar.



I have done a number of Broadcast/Observer projects where a connection
wasn't required. So, I would advertise for a period of time and then would
Observe for a period of time and then go back to sleep.



Thanks,

Kim






0 Likes

Hi @KimS_967071 

It is not good idea to place breakpoints at line 786 and 792 in debug mode instead you can use UART prints for debugging.

 

Thanks & Regards

Pratiksha V

0 Likes