Associate III
November 2, 2023
Question
Trying to make a PWM (2 channel + 2 Channel Complimentory) by using DMA
- November 2, 2023
- 1 reply
- 1151 views
I am trying to make a pwm signal ,with Lookup table for duty cyle .
Here using TIM1 of stm32nucleoF070.
I am here using DMA ,reffered a lot of from google and just worte as follows
No variying singal is getting
SystemClock_Config();
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_DMA_Init();
MX_TIM1_Init();
/* USER CODE BEGIN 2 */
HAL_TIM_PWM_Start_DMA(&htim1, TIM_CHANNEL_1, (uint32_t *)sin_table, 32);
HAL_TIM_PWM_Start_DMA(&htim1, TIM_CHANNEL_2, (uint32_t *)sin_table, 32);
HAL_TIM_Base_Start_IT(&htim1);
HAL_TIM_PWM_Start_IT(&htim1, TIM_CHANNEL_1);
HAL_TIMEx_PWMN_Start_IT(&htim1, TIM_CHANNEL_1);
HAL_TIM_PWM_Start_IT(&htim1, TIM_CHANNEL_2);
HAL_TIMEx_PWMN_Start_IT(&htim1, TIM_CHANNEL_2);
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_5);
HAL_Delay(80);
//
}is it correct way ,
any help is appriciated