PWM TIM15 CH2 CCR1/CCR2 STM32CUBEIDE
Hello guys
My microcontroller is: STM32L432KCU6 - nucleo board
I have a problem with PWM. I need to change TIM16 to TIM15 because TIM16 collides with I2C

So thats why I have to use TIM15... I need him to handle micro servo. When i use TIM16, everything works, the pulses and the duty cycle are correct, but when i use TIM15, unfortunately the duty cycle is still 0
TIMx configurations:

Clock configuration:


There is a code that i use to handle micro servo, for TIM16 it works
int main(void) { /* USER CODE BEGIN 1 */ /* USER CODE END 1 */ /* MCU Configuration--------------------------------------------------------*/ /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ HAL_Init(); /* USER CODE BEGIN Init */ /* USER CODE END Init */ /* Configure the system clock */ SystemClock_Config(); /* USER CODE BEGIN SysInit */ /* USER CODE END SysInit */ /* Initialize all configured peripherals */ MX_GPIO_Init(); MX_DMA_Init(); MX_TIM16_Init(); MX_TIM15_Init(); /* USER CODE BEGIN 2 */ HAL_TIM_PWM_Start(&htim16, TIM_CHANNEL_1); HAL_TIM_PWM_Start(&htim15, TIM_CHANNEL_2); /* USER CODE END 2 */ /* Infinite loop */ /* USER CODE BEGIN WHILE */ while (1) { // TIM 16 ####################### htim16.Instance->CCR1 = 25; // 0 stopni HAL_Delay(2000); htim16.Instance->CCR1 = 50; // 45 stopni HAL_Delay(2000); htim16.Instance->CCR1 = 75; // 90 stopni HAL_Delay(2000); htim16.Instance->CCR1 = 110; // 153 stopnie HAL_Delay(2000); htim16.Instance->CCR1 = 125; // 180 stopni HAL_Delay(5000); // TIM 15 ####################### htim15.Instance->CCR2 = 25; // 0 stopni HAL_Delay(2000); htim15.Instance->CCR2 = 50; // 45 stopni HAL_Delay(2000); htim15.Instance->CCR2 = 75; // 90 stopni HAL_Delay(2000); htim15.Instance->CCR2 = 110; // 153 stopnie HAL_Delay(2000); htim15.Instance->CCR2 = 125; // 180 stopni HAL_Delay(5000); /* USER CODE END WHILE */ /* USER CODE BEGIN 3 */ } /* USER CODE END 3 */ } |
Is anyone know what going on?