2020-01-20 04:54 AM
2020-01-21 02:10 AM
period and pulse are not initialized.
void PWM_Timer_Init(void)
{
/* Enable TIM3 clock */
__HAL_RCC_TIM3_CLK_ENABLE();
/* Configuration for TIM3 */
ConfTimer.Instance = TIM3;
ConfTimer.Init.Prescaler = 215U;
ConfTimer.Init.CounterMode = TIM_COUNTERMODE_UP;
ConfTimer.Init.Period = 999U; //(1000000U / 1000U) - 1U;
ConfTimer.Init.ClockDivision = 0U; /* no divider */
ConfTimer.Init.RepetitionCounter = 0U;
ConfTimer.Init.AutoReloadPreload = 0U; /* disabled */
//ConfTimer.Channel = TIM_CHANNEL_2;
if (HAL_TIM_PWM_Init(&ConfTimer) != HAL_OK)
{
Error_Handler();
}
sConfigOC.OCMode = TIM_OCMODE_PWM1;
sConfigOC.Pulse = 499U;
sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
//sConfigOC.OCNPolarity = TIM_OCNPOLARITY_HIGH;
sConfigOC.OCFastMode = TIM_OCFAST_DISABLE;
sConfigOC.OCNIdleState = TIM_OCIDLESTATE_SET;
sConfigOC.OCNIdleState= TIM_OCNIDLESTATE_RESET;
if (HAL_TIM_PWM_ConfigChannel(&ConfTimer, &sConfigOC, TIM_CHANNEL_2) != HAL_OK)
{
Error_Handler();
}
//HAL_TIM_Base_Start(&ConfTimer);
}
2020-01-20 05:25 AM
A lot of samples come with the STM32Cube firmware (drivers). See your %USERPROFILE%\STM32Cube\Repository folder (Windows) or online: https://github.com/STMicroelectronics/STM32CubeF7/tree/master/Projects. I don't get the idea what you want to do
What tools, OS, HAL, LL, register level,...
2020-01-20 05:42 AM
Thank you for your fast reply. I have generated the code just that there is no information about which TIMx module can be used for which GPIOx pin. I want to use TIM3_CH2 with PB5 and the timer does not start.
2020-01-20 05:55 AM
2020-01-20 06:06 AM
Edit, didn't see all code.
2020-01-20 06:27 AM
You are perhaps looking for the alternate function mapping table, which can be found at the end of chapter 3 in the datasheet.
2020-01-20 06:31 AM
Yes, exactly. I have RM0410
"Reference manual STM32F76xxx and STM32F77xxx advanced Arm®-based 32-bit MCUs" RM0410 Rev 4 pdf and in chapter 3 there is the FLASH registers. Could you give me a link of the file you refer to? Thank you.
2020-01-20 06:44 AM
Please try Document DS11532 Table 13 in section 3
2020-01-20 06:45 AM
chapter 3 in the datasheet, not the reference manual. It should be downloadable from the MCU product page on the ST website.
2020-01-20 11:12 PM