Clocks - part 2


I am sorry to be back here again with yet another question / challenge with clocks and this board. If there was a way I could understand this stuff, I’d be over the moon!

Anyway, on with my problem.

MKRWA1310 running a script that is looking for falling edge interrupts, to be used to capture water info when I get it working. My final system will need to consist of

  • falling edge detection of the sensors using interrupts
  • rtc triggering every 30 seconds to send data
  • LoRaWAN routines to transmit data
  • watchdog to capture when something goes wrong

The sensors I have are

  • Wind vane - read every rtc trigger to get a analog value to work out direction
  • Wind speed & rainfall - using falling edge triggering to count revolutions every 30 seconds, reset to zero on send
  • Temperature & Humidity - reading od DHT22 sensor every rtc trigger
  • Battery status - reading of battery charger every rtc trigger
  • LoRa - all data sent every rtc trigger

All running in deep sleep mode to get power down to what is required

I can get bits of it working, but I can’t get the whole system to work. It all works fine in normal mode, but as soon as it goes to sleep, it just doesn’t.

The attached script has both a watchdog setup and a rtc counter - thanks to another post previously, but with both running, the interrupt triggers after about 3 - 5 seconds, which clearly is not what I’m after.

It is probably clock related, but for those of you who have already read any of my posts know, it is an area that is not my expertise. I think I got it right, watchdog on genclock 2, rtc stuff on genclock 4, but I can’t seem to figure out which clock etc the interrupts are using. I hunted through links sent by others, but it is just beyond me. I have learnt so much, but it continues to feel that there is still so far to go!

I really appreciate any suggestions, thanks in advance.

uSec_Delay_Int.ino (6.83 KB)

WDTZero.cpp (4.83 KB)