AnsweredAssumed Answered

Syrine

Question asked by britwa.boris on Jul 6, 2015
Thanks for the answer. But there is a lot of excess and used DMA. (STM32Cube_FW_F4_V1.6.0\Projects\STM32F4-Discovery\Examples\DAC )
I need a simple example generated in STM32Cube triangle generation.
void MX_DAC_Init(void)
{
 
  DAC_ChannelConfTypeDef sConfig;
 
    /**DAC Initialization
    */
  hdac.Instance = DAC;
  HAL_DAC_Init(&hdac);
 
    /**DAC channel OUT1 config
    */
  sConfig.DAC_Trigger = DAC_TRIGGER_T6_TRGO;
  sConfig.DAC_OutputBuffer = DAC_OUTPUTBUFFER_ENABLE;
  HAL_DAC_ConfigChannel(&hdac, &sConfig, DAC_CHANNEL_1);
 
    /**Configure Triangle wave generation on DAC OUT1
    */
  HAL_DACEx_TriangleWaveGenerate(&hdac, DAC_CHANNEL_1, DAC_TRIANGLEAMPLITUDE_4095);
  HAL_DAC_Start(&hdac,DAC_CHANNEL_1);
}
 
/* TIM6 init function */
void MX_TIM6_Init(void)
{
 
  TIM_MasterConfigTypeDef sMasterConfig;
 
  htim6.Instance = TIM6;
  htim6.Init.Prescaler = 0;
  htim6.Init.CounterMode = TIM_COUNTERMODE_UP;
  htim6.Init.Period = 500;
  HAL_TIM_Base_Init(&htim6);
 
  sMasterConfig.MasterOutputTrigger = TIM_TRGO_UPDATE;
  sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
  HAL_TIMEx_MasterConfigSynchronization(&htim6, &sMasterConfig);
  HAL_TIM_Base_Start(&htim6);
}

why does not work my code?

Generation there but it's not a triangle!!!



Attachments

Outcomes