2014-04-20 10:55 PM
Hi,
I am using STM32F303 to generate 2 sine-waves on DAC_Channel1 and DAC_Channel2.I use one lookup table to generate the sine-wave. And I succeded to generate sine-waves on both channels, but the generated signals have the same frequency.Since I want to have 2 different sine-waves with 2 different frequencies, I want to trigger each DMA channels independently. (ie,DAC_Trigger_T6_TRGO for
DAC_Channel1 andDAC_Trigger_T7_TRGO for DAC_Channel2). According to the reference manual, it seems possible. But when I make such configuration DAC stops working I think; because no signals are generated on both channels.
Does it possible to trigger DAC channels independently? #stm32-dac_trigger2014-04-21 08:08 AM
Does it possible to trigger DAC channels independently?
Yes, I believe it should be
2014-04-27 12:04 AM
Thank you Clive.
After you confirmed that it is possible, I inspected my code line-by line and found the problem:
/* DAC CONFIG */
/* DAC Periph clock enable */
RCC_APB1PeriphClockCmd(RCC_APB1Periph_DAC, ENABLE);
/* DAC Channel1 Configuration ******************/
DAC_DeInit();
DAC_InitStructure.DAC_Trigger = DAC_Trigger_T6_TRGO;
DAC_InitStructure.DAC_WaveGeneration = DAC_WaveGeneration_None;
DAC_InitStructure.DAC_LFSRUnmask_TriangleAmplitude = DAC_LFSRUnmask_Bits11_0;
//This line determines the amplitude of SineWave
DAC_InitStructure.DAC_OutputBuffer = DAC_OutputBuffer_Enable;
/* DAC Channel1 Init */
DAC_Init(DAC_Channel_1, &DAC_InitStructure);
/* Enable DAC Channel1 */
DAC_Cmd(DAC_Channel_1, ENABLE);
/* Enable DMA for DAC Channel1 */
DAC_DMACmd(DAC_Channel_1, ENABLE);
/* DAC Channel2 Configuration ***********************************************************************/
//DAC_DeInit(); // This line SHOULD NOT be executed again, otherwise previous definitions made for configuring DAC_CH1 will be deleted.
DAC_InitStructure.DAC_Trigger = DAC_Trigger_T7_TRGO;
DAC_InitStructure.DAC_WaveGeneration = DAC_WaveGeneration_None;
//DAC_WaveGeneration_Triangle;
DAC_InitStructure.DAC_LFSRUnmask_TriangleAmplitude = DAC_LFSRUnmask_Bits11_0;
//This line determines the amplitude of SineWave
DAC_InitStructure.DAC_OutputBuffer = DAC_OutputBuffer_Enable;
/* DAC Channel2 Init */
DAC_Init(DAC_Channel_2, &DAC_InitStructure);
/* Enable DAC Channel2 */
DAC_Cmd(DAC_Channel_2, ENABLE);
/* Enable DMA for DAC Channel2 */
DAC_DMACmd(DAC_Channel_2, ENABLE);