Generating Interrupts Based on Internal RTC

Pedro Faria
Posts: 2
Joined: Fri Jul 19, 2024 4:43 pm

Generating Interrupts Based on Internal RTC

Postby Pedro Faria » Thu Jul 25, 2024 5:33 pm

Hi everyone,

I'm developing an ESP32-WROOM-32E based device that requires precise GPS and PPS synchronization. Here’s what I've implemented so far:
1. I use a GPS module to retrieve time data (date, time) from the RMC command.
2. On the next PPS rising edge, I synchronize the internal RTC with settimeofday (RMC time + 1 second).
Now, I need to generate interrupts based on the internal RTC to allow for synchronized sampling at specific frequencies, such as 8.192 kHz and 1.024 kHz.

My question is: Is it possible to generate interrupts that are related to the internal RTC on the ESP32? If so, could you provide guidance or examples on how to achieve this?

Thanks!

ESP_Sprite
Posts: 9545
Joined: Thu Nov 26, 2015 4:08 am

Re: Generating Interrupts Based on Internal RTC

Postby ESP_Sprite » Fri Jul 26, 2024 12:21 am

Probably easier to also reset a general purpose timer and generate your interrupts that way. When not in deep sleep, both use the 40MHz crystal as a reference, so there's no difference in precision. You could even use the MCPWM timer, from what I remember it can reset based on an external signal entirely in hardware, so you should get an even better lock to the PPS signal as there's no interrupt latency.

Pedro Faria
Posts: 2
Joined: Fri Jul 19, 2024 4:43 pm

Re: Generating Interrupts Based on Internal RTC

Postby Pedro Faria » Fri Jul 26, 2024 2:54 pm

ESP_Sprite wrote:
Fri Jul 26, 2024 12:21 am
Probably easier to also reset a general purpose timer and generate your interrupts that way. When not in deep sleep, both use the 40MHz crystal as a reference, so there's no difference in precision. You could even use the MCPWM timer, from what I remember it can reset based on an external signal entirely in hardware, so you should get an even better lock to the PPS signal as there's no interrupt latency.

Thank you for the suggestion! I'll definitely try the MCPWM approach.
I appreciate your help!

Who is online

Users browsing this forum: No registered users and 58 guests