We are currently working with the ESP32 in a multitasking setup and are facing an issue with our DLMS meter reading implementation. In certain cases, we need to halt the ongoing DLMS meter reading operation to prioritize other tasks. However, the ESP32 remains stuck in the reading task for approximately 10 seconds before returning control.
Our goal is to immediately interrupt or stop the DLMS reading operation when a GPIO alert interrupt occurs, allowing us to switch to handling other necessary functionality without waiting for the meter reading to complete.
Could you kindly provide guidance or suggest best practices to cancel or stop the DLMS reading task promptly upon receiving the GPIO interrupt?
Thank you in advance for your assistance!
Hi, The only way how you can…
Hi,
The only way how you can do this is that you handle the interrupt and if interrupt is set, you don't read more values from the meter.
Halting ongoing read will cause problems. I don't know what is the size of your UART, but I believe that it will be overwritten and that will cause problems when data is missing.
BR,
Mikko
Thank you for your response…
Thank you for your response and guidance.
To clarify, our UART buffer size is 4kB. Our objective is to cancel the DLMS reading operation rather than halting it. Once the interrupt-triggered function (which sends data to the server immediately upon GPIO alarm) completes, we will reinitiate the meter reading. Therefore, data loss is not a concern, as we plan to reread the meter once the immediate task is finished.
Could you please advise on a method to achieve this interruption cleanly? Specifically, we’d like to clear associated memory and variables and ensure the current reading operation stops properly without leaving residual data.
Thank you again for your assistance.
Hi, I'm sorry, but I can't…
Hi,
I'm sorry, but I can't help with your MCU interrupts. I can help you only with DLMS-specific questions.
BR,
Mikko