cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H750 Timers

psiva.13
Associate II

Hi,

In one of my project I am using STM32H750 controller.I want to measure the pulse width which is an input to the controller whose width will be in some nanoseconds so I want to configure the timer in a way that it can support to start the count from 5 nanoseconds .Is this achievable with this controller ? If not, what is the least (or) minimum supported time that I can start to count with this controller?

Actually I have tried the TIM2 in way to achieve 40 nanoseconds as start count but it is not giving the actual width of the pulse that is occurring . Have a look on the below provided timer configuration that I have done.

static void MX_TIM2_Init(void)

{

 /* USER CODE BEGIN TIM2_Init 0 */

 /* USER CODE END TIM2_Init 0 */

 TIM_ClockConfigTypeDef sClockSourceConfig = {0};

 TIM_MasterConfigTypeDef sMasterConfig = {0};

 /* USER CODE BEGIN TIM2_Init 1 */

 /* USER CODE END TIM2_Init 1 */

 htim2.Instance = TIM2;

 htim2.Init.Prescaler = 8;

 htim2.Init.CounterMode = TIM_COUNTERMODE_UP;

 htim2.Init.Period = 0xFFFF;

 htim2.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;

 htim2.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;

 if (HAL_TIM_Base_Init(&htim2) != HAL_OK)

 {

  Error_Handler();

 }

 sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL;

 if (HAL_TIM_ConfigClockSource(&htim2, &sClockSourceConfig) != HAL_OK)

 {

  Error_Handler();

 }

 sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;

 sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;

 if (HAL_TIMEx_MasterConfigSynchronization(&htim2, &sMasterConfig) != HAL_OK)

 {

  Error_Handler();

 }

 /* USER CODE BEGIN TIM2_Init 2 */

 /* USER CODE END TIM2_Init 2 */

}

The system core clock frequency is 400 MHz.

Thanks,

Parvathi.

1 REPLY 1

Set Prescaler to ZERO, and Period to 0xFFFFFFFF, this will provide for maximal precision.

Use PWM Input mode​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..