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.
Anonymous
Not applicable

I have a project for a  CYBLE-022001-00 on a custom  board.(attached)

It has  WDT and a button interrrupt

Both work fine when low power mode is disabled

When it is enabled ( function EnterLowPowerMode is called in main.c) the counters main_loop_count   and _isr_count  never increment.

The EnterLowPowerMode function was copied from e.pratt's post for the similar issue so I have no doubts that it works

Any ideas ?

Thanks

Andy

0 Likes
1 Solution
Anonymous
Not applicable

After catching up on reading your three comments :

           //CySysClkWriteHfclkDirect(CY_SYS_CLK_HFCLK_ECO);

The above function will change the high frequency clock to the clock passed as the parameter: In this case, I was setting chip CPU clock from the IMO to the ECO to save power; I leave the ECO running for BLE and watchdog timer usage, but turn off the IMO to save power.

           // CySysClkImoStop();

The above function will stop the IMO clock. Note, if you don't change the CPU clock (HFCLK) to a clock that is going to be running, then turning off the clock that the CPU is running off of will essentially halt the CPU.

Thankfully, you were able to determine this with trial and error already

Looking at your code to set the WDT, it looks like you might be misunderstanding what the CySysWdtWriteMatch() is doing?

The WDT0 has a maximum value of 65536 (uint16). If the clock you are using for WDT0 runs at say 32 kHz, then setting a match value of 32000 will cause an interrupt every second. Then, adjusting your sleep time to different intervals, using only WDT0 you will be able to get an interval from 31.2 us to 2 seconds. So, trying to input a value of 5 seconds is rolling over for the uint32 to 1 second, which explains why you are getting an interrupt every one second.

In order to get a longer WDT sleep time, you will need to use the WDTs cascaded together; Chapter 12 of the TRM http://www.cypress.com/documentation/technical-reference-manuals/psoc-4000-family-psoc-4-architectur...  will show you how to cascade the two watch dog timers together. This will allow a longer period than the 2 seconds of the WDT0.

(If you still can't get the timers working correctly, setting up a RAM variable to hold the timer counts to multiply the number of "sleep" cycles before turning back on will also work. E.G. Every time we wake up increment sleepCount until sleepCount = 20, then we know we have been asleep for 1*20 seconds or 20 seconds total.)

As far as why you can't turn off the clocks, try configuring the clocks with only the ones you want turned on in deep sleep mode; If the IDE lets you do it, then it is definitely possible with code. However, if you are unable to do it with the IDE, then you still might be able to configure the clocks with code; At least one clock needs to be on and set to run the HFCLK, and one clock needs to be on and running the LFCLK for the BLE chip. For me, I was able to get the ECO and WCO working for this.

View solution in original post

0 Likes
21 Replies