Inconsistent outputs when using DAC1 and DAC2

Thread Starter

ApacheKid

Joined Jan 12, 2015
157
I have a very simple app that generates a sine wave, the scope trace is fine.

I decided to replicate the logic so I could generate two signals by leveraging the second DAC.

Problem is that the output from the 2nd DAC is clipped whereas the first is not.

This is running on a Nucleo F446RE board.

DHR12R1 appears a perfect looking sine but DHR12R2 has clipped (just the top) at slighly less than 3v.

Can anyone see anything in the code that might explain this?

(The writes to the 2nd DAC are "inverted" so that the two signals are 180 degrees out of phase just FYI).

Here's the code (the collapsed stuff is the sine table calculation, no IO at all).

DAC2CLIP.jpg

Writing to just DAC1 or DAC2 and the clipping is still present but only when writing to DAC2.
 
Last edited:

hexreader

Joined Apr 16, 2011
391
As you probably already guessed - I have no idea what I am talking about, but that won't stop me :)

No idea why you have delay(); call after first DAC setting, but seems morally wrong to have no second delay(); call after second DAC setting.

Somebody knowledgeable will be along soon....
 

Chris65536

Joined Nov 11, 2019
164
(The writes to the 2nd DAC are "inverted" so that the two signals are 180 degrees out of phase just FYI).
If the SINEWAVE function takes values of 0-4095, then 4096 - X is out of range for X=0. Maybe subtract from 4095 instead of 4096?

Edit: I should refresh before posting...
 

Thread Starter

ApacheKid

Joined Jan 12, 2015
157
As you probably already guessed - I have no idea what I am talking about, but that won't stop me :)

No idea why you have delay(); call after first DAC setting, but seems morally wrong to have no second delay(); call after second DAC setting.

Somebody knowledgeable will be along soon....
Simply to get the signals slightly out of phase, so I can visually compare them easily.
 

Thread Starter

ApacheKid

Joined Jan 12, 2015
157
OK the schematic for the board shows that PA5 is already connected to the Green LED...

I guess its acting like a kind of zener diode from what I can find on the web.
 
Last edited:

MrChips

Joined Oct 2, 2009
20,175
The DAC outputs can only drive 5kΩ or higher. Any excessive loading will cause the output to be clipped.

Edit: Remove SB21.
 
Top