cancel
Showing results for 
Search instead for 
Did you mean: 

DAC outputs are weird ...

WQ
Associate III

Hi, I am trying to get DAC work on Nucleo-L432KC board, DAC 1 is activated, output on Pin PA4, normal mode, output buffer enabled, software trigger, no wave generation, and LL driver. I use LL_DAC_ConvertData12RightAligned or WRITE_REG(DACx->DHR12R1, dac_data) to write the dac output data with the voltages measured on PA4:

dac_data=0, VPA4=0.041V
dac_data=409, VPA4=2.992V
dac_data=819, VPA4=2.659V
dac_data=1228, VPA4=2.328V
dac_data=1638, VPA4=1.996V
dac_data=2047, VPA4=1.664V
dac_data=2457, VPA4=1.332V
dac_data=2866, VPA4=1.000V
dac_data=3276, VPA4=0.668V
dac_data=3685, VPA4=0.336V
dac_data=4095, VPA4=0.041V
dac_data=0,, VPA4=0.041V

VREF = VDDA = 3.323V. The data is 1/10th incremental from 0 to VDDA. I expected to see same increment on output voltage. However, it is backward from near VDDA (actually 2.992V, 9/10 of VDDA) to 0V. The output is reversed. It is also weird that the output is 0.041V when dac_data is 0 (if the dac is reversed, I expected to see near VDDA when dac_data=0). Any help is appreciated. -wq

1 ACCEPTED SOLUTION

Accepted Solutions

The buffer is an inverter, if you switch in on, the DAC goes into inverted state to compensate for it.

If the buffer is damaged, you see on the output the inverted raw DAC output.

We've discussed this on the forum before, that's why I know; I'm just lazy to search.

JW

[EDIT] https://community.st.com/s/question/0D50X00009XkZsSSAV/my-dac-outputs-inverted-values-0000-33v-and-4095-0v last post (below "More")

View solution in original post

8 REPLIES 8

Inverted DAC output indicates damaged buffer.

JW

LCE
Principal

What about leaving all LL functions and macros out?

Just write the register directly: DACx->DHR12R1 = dac_data;

And just for fun, try the left aligned register.

Maybe that STM has some inversion bit, or an inverting opamp? :D

The buffer is an inverter, if you switch in on, the DAC goes into inverted state to compensate for it.

If the buffer is damaged, you see on the output the inverted raw DAC output.

We've discussed this on the forum before, that's why I know; I'm just lazy to search.

JW

[EDIT] https://community.st.com/s/question/0D50X00009XkZsSSAV/my-dac-outputs-inverted-values-0000-33v-and-4095-0v last post (below "More")

Thanks all for help. I tried the second brand new Nucleo-L432KC. It is same: (1) the outputs are inverted, (2) Vout=0 when dac=0x0 (not inverted).

I think it is reasonable to believe the MCU got damaged. But how? They are brand new out of Mouser.

The bigger question is that if it is only the analog output pad got damaged, others remain functional and we can still use the MCU and PCB. I didn't know it had a DAC (actually two DACs) until I went through UART, I2C, SPI and RTC/Timers, etc. and began to look at how to bring-up the ADC. (all are LL driver). It was a small surprise and cheer when I found there was a DAC output pin still available just next to an ADC input pin. So I brought it up to be the variable signal source to the ADC.

-wq

I just tried the third one, same, damaged. We got 10. But I don't want to test each one. -wq

WQ
Associate III

I tried direct writing to DHR12R1 register. -wq

LCE
Principal

Maybe you check what else on this Nucleo the DAC pins are used for.

I have worked now with at least 10 Nucleo boards, and there was never a hardware problem or defect - and not really careful when handling these.

+1 - if it's on multiple boards, then it's more likely that I am wrong and the reason is something else.

Read out and check/post DAC registers content.

JW