2024-11-29 03:29 AM
Hello everyone,
I'm designing a new system based on the STM32F746BET6.
Basically it's just reading and writing GPIOs and receiving/transmitting data through a few interfaces (ethernet and I2C). The system receives a 100 bit/sec data frame every second for time tagging (IRIG-B) and have to measure time width of every pulse received in order to decode the message (width of every pulse varies from 2 ms to 8 ms).
My idea is capturing every rising and falling edge with a timer and then calculating time difference in order to obtain the pulse with. Still, I have a few questions about it.
1) To do so, my system will get an interrupt everytime an edge is detected on my timer pin. Will this stop the uC from its tasks everytime an edge is detected?
2) Do I really need a timer to detect edges or is there some other way to get pulses width?
Thank you very much in advanced
2024-11-29 06:53 AM
Hello,
Maybe I suggest using PWM input with which you can measure the high pulse and the period. Maybe also using DMA timer request to receive a burst of pulse and then calculate all the pulse durations after..
2024-11-29 07:09 AM
Hello,
Thank you for your answer. Will I still get an interrupt everytime I get an edge on my PWM input?
Thank you very much in advanced.
2024-11-29 07:13 AM
No with DMA you will get an interrupt at the end of DMA transfer. For that you need to set the data to transfer > 1.
2024-11-29 07:19 AM
@NDicostanzo wrote:my system will get an interrupt everytime an edge is detected on my timer pin. Will this stop the uC from its tasks everytime an edge is detected?
An interrupt blocks software executing at lower priority.
So it won't block the hardware operations of stuff like the I2C and Ethernet peripherals.
This is why it's important to keep interrupt handlers as short (timewise) as possible
2024-12-01 11:44 PM
That's the point.
I cannot block all the other software instructions everytime I get an edge on my interrupt pin. Still, I have to measure time width of all the pulses.
I was considering to add another microcontroller for handling the with measurement operation, then send data via I2C to the main mcu which will be interrupted upon reception.
2024-12-02 12:11 AM
You can use DMA to store the captured timestamps to a buffer in RAM, and then process it later, whenever you see it fit.
JW