cancel
Showing results for 
Search instead for 
Did you mean: 

Reading Analog signals with a voltage offset on the ADC of STM32H747

DBaba.1
Associate II

Hi, we're trying to port an application from a F7 chip to the STM32H7 mostly for the purpotedly better performance of the ADC on the H7. However, we've run into an issue I'm not sure I can explain. I'm using the H747 Disocvery board as a prototype at the moment.

The signal coming into the board is a single ended signal from 0 - 3.3V centred at 1.65V. I'm using an example sine wave at with an amplitude of 0.5V as a test signal here. When I apply this offset to the input of the ADC, the signal saturates at -1.5V to +1.5V as shown below and a quick FFT (130kHz signal) seems to confirm that as well. 0693W000006EW6hQAG.png0693W000006EVpNQAW.png 

If I don't apply the offset and I let the signal swing from 0 to 0.5V, i get the expected output shown here:

0693W000006EVt5QAG.png0693W000006EWAPQA4.png 

I use HAL and I'm not sure if I'm missing a setting or something. This behaviour is not seen on the F7 board and I'm not sure what could be causing the spikes to occur here.

Any tips appreciated

1 ACCEPTED SOLUTION

Accepted Solutions

Figured it out thanks, Turns out Matlab audioread function casts to signed 16bit integers. Converting to uint16t in matlab fixed it.

View solution in original post

4 REPLIES 4
TDK
Guru

> Why VREF- in this case?

VREF- = VSSA = VSS. That's just the lower limit of the range.

Was there another question? Are you asking about the off-peak spikes in the FFT?

If you feel a post has answered your question, please click "Accept as Solution".

Hi yes, I'm not sure why the spikes occur as I try to read 1.65V.

TDK
Guru

Well, your input signal isn't a pure sine wave. I can tell that just by eyeballing it. Some periods of the sine wave are cut short, which is likely what is causing the additional harmonics in the FFT plot.

0693W000006EX9NQAW.png 

Perhaps you are not sampling it at even intervals. I have to imagine this is a test setup issue and/or you're not using the same code in both cases.

If you feel a post has answered your question, please click "Accept as Solution".

Figured it out thanks, Turns out Matlab audioread function casts to signed 16bit integers. Converting to uint16t in matlab fixed it.