cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with DAC stm32f103rd

dnm_es
Associate
Posted on January 12, 2015 at 18:29

Hello, I would like generate two different signal with the channel 1 and 2 of DAC. I've used two different timer (TIM6 and TIM2) and one DMA address (DAC_DHR12RD_Address    0x40007420). I can generate the signals separate but I try to generate the together (each signal with different DAC) It don't work.

Any ideas??

Thank you

2 REPLIES 2
Posted on January 12, 2015 at 18:59

Any ideas??

Like pointing each DMA to the appropriate DAC register?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
dnm_es
Associate
Posted on January 13, 2015 at 08:51

This is my code. I generate one signal with DAC1, this is works, but when I try to generate the signal with DAC2 this is works and the signal of DAC1 stops workings

#define         DAC_DHR12R1_Adress             0x40007408

#define         DAC_DHR12R2_Adress             0x40007414

const           uint8_t                 Escalator8bit[2] = {0x0, 0xFF};

void DMA_Setup(int dec_channel, int8_t DMA_Class, )

{

      DMA_Channel_TypeDef* DMA_Channel;

          

          DMA_InitStructure.DMA_Mode = DMA_Mode_Circular;                             /* DMA operation mode */

          DMA_InitStructure.DMA_Priority = DMA_Priority_High;                         /* Specifies the priority for the DMA Channel */

          DMA_InitStructure.DMA_M2M = DMA_M2M_Disable;                                /* Specifies if the DMAy Channelx will be used in memory-to-memory transfer */

          DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;            /* Specifies whether the Peripheral address register is incremented or not */

          DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;

 

              if(dec_channel==0)                                                      /* If dec_channel=0 I use DAC1 */

              {

                    DMA_InitStructure.DMA_PeripheralBaseAddr = DAC_DHR12R1_Adress;

            DMA_Channel=DMA2_Channel3;    

              }

              else

              {

                    DMA_InitStructure.DMA_PeripheralBaseAddr = DAC_DHR12R2_Adress;

            DMA_Channel=DMA2_Channel4;

              }

 

          DMA_InitStructure.DMA_MemoryBaseAddr = (uint32_t)&Escalator8bit;

          DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralDST;

          DMA_InitStructure.DMA_BufferSize = 2;

          DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte;

          DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte;

      DMA_DeInit(DMA_Channel);               

          DMA_Init(DMA_Channel, &DMA_InitStructure);

          

             /* Enable Channely for DMAx */

          DMA_Cmd(DMA_Channel, ENABLE);

 

}