![]() ![]() When I send a LOW signal to pin 12, I get a wake-up triggered by pin12 via ext0 and the SR records the” time1” timestamp. Or maybe there is a problem with keeping the measured time value(s) in memory after sleep. Even if I am using the ext0 which keeps some of the peripherals (pin12 and pin27 included) active during sleep. There is some sort of a deep sleep-wake-up issue which I think is that either not all input pins are usable for a period of time after wake-up from deep sleep. This combined program works but only for every second set of readings. The problem: Both separate programs work. Once that is done, the ESp32 goes back to sleep. A routine subtracts “time2” – “time1” to arrive to the final value. It does another ISR routine and takes a snapshot of the “time2” of the second signal (on pin27). Next the second LOW/FALLING signal happens on pin27 within about 200-800 micro-seconds from the first one on pin12. ![]() The ISR runs a micros() routine that takes a snapshot of the “time1” when the interrupt happened. A single LOW/FALLING signal on pin12 wakes up the ESp32 from deep sleep using the ext0 wake up event and an attach interrupt with ISR. How it supposed to work: The first LOW/FALLING signal is always on pin 12 and the second LOW/FALLING always on pin 27. They always come in pairs and randomly seconds or minutes apart. The signals come on both pins and drop fast (about 20-40ns) and are about 200-800 micro-seconds apart in duration. ![]() The other program measures the time difference between two separate LOW or FALLING signals on Pin 12 and 27 of the ESP32 SparkFun Thing Plus. One program is deep sleep with ext0 (and/or ext1) wake interrupt on which I got off the web. The Arduino program is a marriage of two separate Arduino programs (attached), both work. The code is not that difficult so you may want to skip to “the problem” section below to spare you the details. I think I am very close to the solution (maybe couple of lines of codes away), but the answer seems to lie in the memory state of the ESP32 after coming back from “deep sleep”. My knowledge is lacking and unable to progress further. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |