cancel
Showing results for 
Search instead for 
Did you mean: 

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

jean_prieur
Associate III
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
29 REPLIES 29
jean_prieur
Associate III
Posted on July 15, 2014 at 14:54

If your 'problematic' board and the reference board are identical in both software and hardware...

Yes they are! :)

Have you tried the other DAC channel/output instead, does it behave the same way ?

 

Yes, the Channel 2 is inverted, like the Channel 1. They have the same behavior. This enhances the strangeness of the problem.
Posted on July 15, 2014 at 15:26

Try using DAC_StructInit()

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
jean_prieur
Associate III
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);

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
Up vote any posts that you find helpful, it shows what's working..
jean_prieur
Associate III
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.
Senior
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
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
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
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?

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