2023-11-04 10:32 PM
Hello experts
2023-11-08 02:29 AM
Hello @thannara123,
Just start the CH1N with HAL_TIMEx_PWMN_Start()
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-11-08 04:18 AM
I had also try with HAL_TIMEx_PWMN_Start() but there is no affect to output too. it's like as there is something missing in side that function.
2023-11-10 03:41 AM
Hello, could you share your timer configuration
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-11-10 09:21 PM - edited 2023-11-10 09:22 PM
This is my Timer 2 Initial.
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};
TIM_OC_InitTypeDef sConfigOC = {0};
/* USER CODE BEGIN TIM2_Init 1 */
/* USER CODE END TIM2_Init 1 */
htim2.Instance = TIM2;
htim2.Init.Prescaler = 639;
htim2.Init.CounterMode = TIM_COUNTERMODE_UP;
htim2.Init.Period = 999;
htim2.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
htim2.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_ENABLE;
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();
}
if (HAL_TIM_PWM_Init(&htim2) != HAL_OK)
{
Error_Handler();
}
sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
if (HAL_TIMEx_MasterConfigSynchronization(&htim2, &sMasterConfig) != HAL_OK)
{
Error_Handler();
}
sConfigOC.OCMode = TIM_OCMODE_PWM1;
sConfigOC.Pulse = 0;
sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
sConfigOC.OCFastMode = TIM_OCFAST_ENABLE;
if (HAL_TIM_PWM_ConfigChannel(&htim2, &sConfigOC, TIM_CHANNEL_1) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN TIM2_Init 2 */
/* USER CODE END TIM2_Init 2 */
HAL_TIM_MspPostInit(&htim2);
}
and I had try to start timer 2 in many way
// HAL_TIMEx_PWMN_Start_DMA(&htim2, TIM_CHANNEL_1, &dsin,360);
HAL_TIM_Base_Start(&htim2);
// HAL_TIM_PWM_Start_DMA(&htim2, TIM_CHANNEL_1, &dsin,360);
// HAL_TIMEx_PWMN_Start_DMA(&htim2, TIM_CHANNEL_1, &dsin,360);
there are only HAL_TIM that it's work fine and HAL_TIMEX is nothing run even the register is not start too.
2023-11-10 10:18 PM
HAL_TIM_Base_Start_DMA(&htim2, TIM_CHANNEL_1, &dsin,360);
HAL_TIMEx_PWMN_Start(&htim2, TIM_CHANNEL_1,);
Try it ,
will work
2023-11-10 10:27 PM
that has only HAL_TIM_Base_Start_DMA(&htim2, TIM_CHANNEL_1, &dsin,360);
without HAL_TIMEx_PWMN_Start(&htim2, TIM_CHANNEL_1,);
it's still work fine.
so HAL_TIMEx_PWMN_Start(&htim2, TIM_CHANNEL_1,); , what 's necessary of it?
2023-11-10 10:30 PM - edited 2023-11-10 10:31 PM
HAL_TIMEx_PWMN_Start(&htim2, TIM_CHANNEL_1,); // It is used to getout the complimentory signal of
2023-11-10 11:15 PM
Oh, I got it. A Complementary one is negative PWM used for drive H bridge.
2023-11-13 02:38 AM
The complementary signal output CH1N must be enabled independently, even without using the CH1 output.
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.