Skip to main content
Graduate
May 19, 2024
Solved

TIM2, TIM3, TIM4 ERT mode on Nucleo-H743ZI2

  • May 19, 2024
  • 2 replies
  • 1077 views

Hello,

I am new on Nucleo-H743ZI2. Im trying to test the ETR mode on TIM2 (PA0), TIM3 (PD2) and TIM4 (PE0). I used the same code and setup for all the 3 timers. But only TIM2 functions properly. TIM3 just can increase once then the CNT will not increase anymore. TIM4 does not have any response on the pulse input, and the CNT does not change at all. I use a jump wire connect the 3.3V to each of the ETR pin to generate the pulse.

Can someone guide me what I should do on TIM3 and TIM4? Is there any special setting I need? Thanks in advance.

屏幕截图 2024-05-19 120149.png

屏幕截图 2024-05-19 122421.png

屏幕截图 2024-05-19 122457.png

屏幕截图 2024-05-19 122510.png

屏幕截图 2024-05-19 122522.png

/* USER CODE BEGIN PV */

uint16_t Counter_Tim2;

uint16_t Counter_Tim3;

uint16_t Counter_Tim4;

/* USER CODE END PV */

 

/* USER CODE BEGIN 2 */

HAL_TIM_Base_Start(&htim2);

HAL_TIM_Base_Start(&htim3);

HAL_TIM_Base_Start(&htim4);

/* USER CODE END 2 */

 

while (1)

{

/* USER CODE END WHILE */

 

/* USER CODE BEGIN 3 */

Counter_Tim2 = __HAL_TIM_GET_COUNTER(&htim2);

Counter_Tim3 = __HAL_TIM_GET_COUNTER(&htim3);

Counter_Tim4 = __HAL_TIM_GET_COUNTER(&htim4);

HAL_Delay(10);

}

/* USER CODE END 3 */

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

    Finally it works. The reason that it did not function at the beginning is: I injected the pulse by a jump wire from 3.3V power supply directly. Now I give the pulse by an infrared sensor. The signal comes from a voltage comparison output on the sensor board. 

    1716291797225.jpg

    2 replies

    Super User
    May 19, 2024

    Read out and check/post TIM registers content. Make sure TIMx_CCER.CC1E bit is not set.

    JW

     

    PS. Maybe similar https://community.st.com/t5/stm32-mcus-products/unable-to-read-32khz-oscillator-signal-on-etr-pin/m-p/675217

    JiamingAuthorAnswer
    Graduate
    May 21, 2024

    Finally it works. The reason that it did not function at the beginning is: I injected the pulse by a jump wire from 3.3V power supply directly. Now I give the pulse by an infrared sensor. The signal comes from a voltage comparison output on the sensor board. 

    1716291797225.jpg