CCR Values Show on STM32F334R8 MCU but readCaptureValue Returns Zero
Hello everyone,
I'm working on a project using the STM32F334R8 MCU to capture two rising edge signals with the intent of obtaining the CNT value at each signal's rising edge. My calculations and data are meant to be processed through an external interrupt and transmitted to a computer. I am using a 72 MHz clock with Timer 2, specifically channel 1 and 4.
In my debug testing, everything initializes correctly—both input capture and external interrupts start properly, and both CCR1 and CCR4 registers display values. However, when I attempt to retrieve these values using readcapture, the function consistently returns zero. I have also tried accessing the register values directly without using the API, but the results remain the same.
Here are some key points:
- MCU: STM32F334R8
- Timer Clock: 72 MHz
- Timer used: Timer 2 (Channel 1 and 4)
- Issue: CCR displays values, but HAL_TIM_ReadCaptureValue() returns zero.
Has anyone encountered a similar issue or can provide insights on why this discrepancy occurs and how to fix it? Any advice or suggestions would be greatly appreciated.
Thank you in advance for your help!
My code and debug screenshots are as follows.

