Loading...
 

System Workbench for STM32


Configuring CubeMX for simple PWM

Hello,

I am completely new to STM chips and ARMs.

I want to make a simple PWM.
I have Nucleo F072RB.
I use CubeMX and TrueStudio.
I followed this tutorial to understand the registers better:
/watch?v=xs9lGF--QcU
At the end of the third video, the guy has a functioning PWM simply by configuring the registers properly.

I tried to configure cube MX as best I could. I used PA11 as the output. Using Timer1 channel 4.
I get no PWM.

Here are the configs. I tried various combination.
T1M Mode TIM Config
If I make a project where without configurating the T1M and pin PA11. The GPIO config function MX_GPIO_Init(); is identical as when I configure PA11. it’s like Cube MX doesn’T even initializes PA11.

This is the function:
static void MX_GPIO_Init(void)
{
GPIO_InitTypeDef GPIO_InitStruct = {0};

/* GPIO Ports Clock Enable */
__HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOF_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();

/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(LD2_GPIO_Port, LD2_Pin, GPIO_PIN_RESET);

/*Configure GPIO pin : B1_Pin */
GPIO_InitStruct.Pin = B1_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(B1_GPIO_Port, &GPIO_InitStruct);

/*Configure GPIO pin : LD2_Pin */
GPIO_InitStruct.Pin = LD2_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(LD2_GPIO_Port, &GPIO_InitStruct);

}

Where is my PA11 setup?