Skip to main content
Graduate II
November 12, 2025
Solved

TIM15 in Slave Mode, Gated Mode to count the time a signal is High

  • November 12, 2025
  • 1 reply
  • 170 views

Hi, 

 

I want to count the time that an incoming level signal is high for. 

To achieve this I setup Timer 15 as a Gated Mode Slave, which has it's counter counting while the trigger input is high. The trigger input is the Filtered Timer 15 Channel 1. For some reason when I connect my signal to my input Timer. Nothing Happens. The signal on the IO Pin TIM 15 CH1  is a 2V square Wave.

My own software seems correct. I then moved to Hal to see if I can achieve it.  

I've tried to use HAL to achieve this without any luck here is my HAL software.

Uploaded is the main and IOC file

I am working on the STM32G071

Thanks

 

    This topic has been closed for replies.
    Best answer by danielbathtub

    Solving my own problem: 

    The issue is that I was using the Timer in One Pulse Mode. 

    This is incorrect, without setting the Timer in One Pulse Mode, everything works as expected and the Timer accurately clocks while the trigger input is high  

     

    1 reply

    danielbathtubAuthorAnswer
    Graduate II
    November 13, 2025

    Solving my own problem: 

    The issue is that I was using the Timer in One Pulse Mode. 

    This is incorrect, without setting the Timer in One Pulse Mode, everything works as expected and the Timer accurately clocks while the trigger input is high