Measure time between the rising edge of 2 distinct signals.
I'm using an STM32F030K6 and I need to measure the time between the rising edge of 2 signals.
The 2 signals (square wave) are not in phase and intended to use TIM1 to:
* rising edge of signal 1, make timer start (internaly clocked);
* rising edge of signal 2, capture the timer and trigger the DMA;
* automatically stop at the timer to wait for the rising edge of signal 1 again.

I find some information in sections 13.3.17 and 13.3.18, but not enough to understand the process and how I can prepare the setup using CubeMX.
Could you please explain the process and recommend some specific reading on this example?
Thank you