AnsweredAssumed Answered

STM32F103 + PWM+ DMA + HAL?

Question asked by Charles on Nov 26, 2015
Latest reply on Nov 28, 2015 by Clive One
I have STM32F103 working on 8MHz.
If I Init PWM on Ch1 Tim3 
void MX_TIM3_Init(void)
  TIM_ClockConfigTypeDef sClockSourceConfig;
  TIM_MasterConfigTypeDef sMasterConfig;
  TIM_OC_InitTypeDef sConfigOC;
  htim3.Instance = TIM3;
  htim3.Init.Prescaler = 0;
  htim3.Init.CounterMode = TIM_COUNTERMODE_UP;
  htim3.Init.Period = 9;
  htim3.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
  sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL;
  HAL_TIM_ConfigClockSource(&htim3, &sClockSourceConfig);
  sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
  sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
  HAL_TIMEx_MasterConfigSynchronization(&htim3, &sMasterConfig);
  sConfigOC.OCMode = TIM_OCMODE_PWM1;
  sConfigOC.Pulse = 1;
  HAL_TIM_PWM_ConfigChannel(&htim3, &sConfigOC, TIM_CHANNEL_1);
and star ti with
HAL_TIM_PWM_Start_IT(&htim3, TIM_CHANNEL_1);

all working OK and output generate 125ns pulse on 800kHz (1.25us)

If replace Start_IT with DMA version
uint32_t pData[1]={6};
HAL_TIM_PWM_Start_DMA(&htim3, TIM_CHANNEL_1,pData,1);
all working OK and output generate 70ns pulse on 800kHz (1.25us),but if use
uint32_t pData[16]={3,3,3,3,3,3,3,3,0,0,0,0,0,0,0,0};
HAL_TIM_PWM_Start_DMA(&htim3, TIM_CHANNEL_1,pData,16);
this genreate 375ns its OK but frequency is  400kHz (2,5us)
If I trace and look on reg CCR1 I see
What'swrong,what's the problem?