Solution architecture help
I need help in implementing a solution. I'd like to implement a system that measures elapsed time (ET) between two digital input (DI) pulses. These two signals will be on different channels. There are 4 sets of signal, therefore I need to measure four things: ET(0) = DI(0) -> DI(1), ET(1) = DI(2) -> DI(3), ET(2) = DI(4) -> DI(5), ET(4) = DI(6) -> DI(7).
The counting should be between positive edges, resolution should be in microseconds, maximum time will be <= 2s. Each of the measurements should reset on DI(x) and store on DI(x+1). It is possible that multiple DI(x) will occur before DI(x+1) therefore ET will always be the measurement between DI(x+1) and the last DI(X)
I first implemented a solution with a raspberry pi pico. That solution implemented an interrupt on each of the digital input channels that triggered on a positive transition. The interrupt handler essentially queues up the DI index and a 64bit microsecond tick count on a pre initialized queue. The super loop monitors the queue and figures out the elapsed times based on what comes through the queue.
For a number of reasons it's desirable to move to the STM32 foamily. In this case the L432KC was selected because of its form factor and its inclusion of a CAN peripheral.
Could someone offer any suggestions no how to approach this problem with the L432KC? Additionally, I'd be willing to move to a different family member if there is a compelling reason.
Thanks for the help