Skip to main content
jean_prieur
Associate III
July 14, 2014
Question

My DAC outputs inverted values (0000 = 3.3V and 4095 = 0V)

  • July 14, 2014
  • 29 replies
  • 6180 views
Posted on July 14, 2014 at 12:19

Hello,

I have a trouble with my DAC, for example when I set the DAC output (Channel1 orChannel2) to the maximum voltage, the DAC generate the minimum voltage:

DAC_SetChannel1Data(DAC_Align_12b_R, 4095);

Vout

~

0V

DAC_SetChannel1Data(DAC_Align_12b_R, 0);

Vout

~

3.3V

DAC_SetChannel1Data(DAC_Align_12b_R, 1000);

Vout

~

0.8V The strange thing is, I have two test boards, and the problem happens only on one board. The other board have a correct behavior, with the same project! Do you have any ideas? Thanks a lot!

DAC_SetChannel1Data(DAC_Align_12b_R, 4095);

Vout

~

0V

DAC_SetChannel1Data(DAC_Align_12b_R, 4095);

Vout

~

0V #whiskey-tango-foxtrot #oscar-mike-golf
    This topic has been closed for replies.

    29 replies

    Tesla DeLorean
    Guru
    July 15, 2014
    Posted on July 15, 2014 at 15:26

    Try using DAC_StructInit()

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    jean_prieur
    Associate III
    July 15, 2014
    Posted on July 15, 2014 at 16:39

    Try using DAC_StructInit()

    Actualy I already use this command:

    DAC_InitTypeDef DAC_InitStructure;
    ...
    DAC_InitStructure.DAC_Trigger = DAC_Trigger_None;
    DAC_InitStructure.DAC_WaveGeneration = DAC_WaveGeneration_None;
    DAC_InitStructure.DAC_OutputBuffer = DAC_OutputBuffer_Enable;
    DAC_StructInit(&DAC_InitStructure);

    Tesla DeLorean
    Guru
    July 15, 2014
    Posted on July 15, 2014 at 17:00

    DAC_InitTypeDef DAC_InitStructure;
    DAC_StructInit(&DAC_InitStructure); // Clear up structure
    DAC_InitStructure.DAC_Trigger = DAC_Trigger_None;
    DAC_InitStructure.DAC_WaveGeneration = DAC_WaveGeneration_None;
    DAC_InitStructure.DAC_OutputBuffer = DAC_OutputBuffer_Enable;
    DAC_Init(DAC_Channel_1, &DAC_InitStructure); // Initialize the channel

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    jean_prieur
    Associate III
    July 15, 2014
    Posted on July 15, 2014 at 17:27

    It was my first code implementation, it doesn't change anything...

    I will assemble some new boards during the next month, maybe I will try to do some destructive tests directly on DAC outputs pins to check if this problem appears again.

    
    

    John F.
    Associate III
    July 16, 2014
    Posted on July 16, 2014 at 09:45

    Configure your DAC output pin as a GPIO push pull output. Clear the pin and check if you get 0V or a high voltage from your circuit's output. Set the pin and check if you get 0V or a high voltage from your circuit's output. This will tell you if it's your hardware at fault.

    Check your measuring device too by probing 0V and the +3V3 supply.

    jean_prieur
    Associate III
    July 17, 2014
    Posted on July 17, 2014 at 16:43

    Configure your DAC output pin as a GPIO push pull output. Clear the pin and check if you get 0V or a high voltage from your circuit's output.

     

    Hi John, I configured my DAC outputs (PA3, PA4) as push-pull outputs GPIOs.

    - When I Set the pin, output voltage is high (3,3V)

    - When I Reset the pin, output voltage is low (0V)

    -> There is no hardware fault when the pins are not configured as analog outputs... (and yes, my mesuring devices are OK, I can probe the 0V, 3.3V and 5V on my board).
    bingojia4ever
    Associate II
    March 23, 2015
    Posted on March 23, 2015 at 08:17

    Hi Prieur,

    How are your new boards? Does the problem appear again? I have met the same problem that the DAC output for one board is okay and inverted on the other board.

    jean_prieur
    Associate III
    June 1, 2015
    Posted on June 01, 2015 at 18:55

    Hi,

    Yes the problem is still here on my board, but I builded other boards and the problem is never appeared again...

    Did you solve your problem?

    waclawek.jan
    Super User
    June 1, 2015
    Posted on June 01, 2015 at 22:32

    Looking at the original post:

    
     > DAC_SetChannel1Data(DAC_Align_12b_R, 1000);

    > Vout

    ~

    0.8V Doesn't this sound about right? JW

    DAC_SetChannel1Data(DAC_Align_12b_R, 4095);

    Vout

    ~

    0V

    DAC_SetChannel1Data(DAC_Align_12b_R, 4095);

    Vout

    ~

    0V
    bingojia4ever
    Associate II
    June 2, 2015
    Posted on June 02, 2015 at 13:23

    Hi,

    Me too. I have built around 10 boards with exact same configuration and 30 other boards using same design for DAC part after that but it never appeared.