Hi,
I’ve come back to clocks again, trying to get to my utopia of a mkrwan 1310 running with
- edge triggering on external inputs
- a rtc running to send data every 30 seconds
- a watchdog to catch for when something messes up
all at very low power consumption
If you look for my other posts you will see that I have been on this for a while, tried various things and borrow sample code from many other posts. I have learnt loads about the SAMD21 chip and how to configure it, but I am still not quite there. I have achieve a milestone, I now have some code that gives me the things I want, but it is drawing 3.1mA!!! That is about 20 times higher than I was hoping for.
The code below has
- the main clock enabled for the EIC controller to give me edge triggering
- the osculp32k clock fed into the generic clock controller 1 which then feeds rtc AND wdt
In the main loop I then gradually increase the rtc duration until it exceeds wdt to confirm operation
What I can’t explain is the this code consumes 3.1mA from battery when in deep sleep. I’ve tried a simple program with no rtc and no wdt and I was approximately 100uA, but as soon as I have rtc and wdt it is massively increased.
Does anyone have any idea how I can reduce the consumption through changing the configuration?
Note: The code was written using VSCode, hence it is called main.cpp.
main.cpp (16.4 KB)