How do I prevent one ISR from interrupting another ISR that is in the process of reading the RTC? HAL_LOCK?
I'm working on my first large-ish C++ embedded program running on a STM32F413. Bare metal, no RTOS at least so far. The program reads data from a dozen or so UART and I2C sensors. All the UART sensors currently use DMA for TX and RX. When a complete message is received from any sensor, it needs to get time stamped. Based on advice from other forums, I'm investigating putting the RTC driver in a) a singleton, b) using extern "C" or c) using a static class. In all three options, I think I'll still need a way to lock the few lines of my code that actually read the RTC.
If one sensor's ISR is in the process of getting a time stamp from the RTC, will HAL_LOCK prevent another sensor from interrupting ?
If the interrupt priority of every sensor is set to the same value, will that prevent them from interrupting each other? This doesn't seem like a great solution since data from some sensors is more important than others.
I'm sure I'm not the first one to have to deal with this issue so how do experienced programmers handle RTC access?
Thanks
