cancel
Showing results for 
Search instead for 
Did you mean: 

ADC DC ''crosstalk'' between channels

mmensch
Associate II
Posted on July 19, 2016 at 16:53

Hello,

I use STM32L152 on STs Nucleo board.

I created a small progtam to test ADC. It is mainly a state machine that steps forward every 100msec, repeating after 10 steps. In step 1 I start a conversion sequence consisting of channel 19 (PB13), 20 (PB14), internal temp sensor and internal reference voltage. Data is transfered to a uint32 array via DMA. In step 3 I read out data and send them over UART to a terminal program.

I have 9 cycles samling time for ch19 and ch20 and 384 cycles for temp and ref.

These are my results

Ch 19 and 20 produce around 500 and 1200 counts with +/- 60 noise when left floating, temp is 1355 +/- 5 and reference is 1480 +/- 4 counts.Now when connecting a 1,5V battery between ch19 and Agnd I can see a good value (1630 for 1,317V ) on Ch 19 but Ch 20 shows almost the same (because still floating), temp goes to 1380 and ref goes to 1480. When I short Ch19 to Agnd Ch20 goes to about 750, temp goes to 1280 and ref goes to 1455, and even worse when I short Ch 20 to AGnd: Ch19 is about 1000, temp is about 900 and ref is 1330.

Any idea about the reasons and what I can do?

Thanks a lot

Martin
2 REPLIES 2
Danish1
Lead II
Posted on July 20, 2016 at 10:36

When you measure several voltages with a single ADC, as you can imagine, the ADC first measures the first voltage, then measures the second voltage and so on. This is all pretty automatic but you do have a lot of control over what is going on and a good understanding is helpful.

The ADC measures a voltage by first sampling the voltage by connecting its capacitor to the voltage and allowing the capacitor to charge up to that voltage.

Then in a second phase the capacitor is disconnected and the ADC then measures the voltage on its capacitor.

This sampling takes time, and if you set the time too short then you end up with the voltage-on-the-capacitor being somewhere between the voltage you want and what was on the capacitor beforehand.

Hence you see crosstalk.

What values have you programmed into ADC_SMPRx ? How do things change if you program in longer times?

Hope this helps,

Danish

mmensch
Associate II
Posted on July 20, 2016 at 15:15

Hello,

I found the mistake myself.

Because of the similiar structure of registers ADC_SQRx and ADC_SMPRx I misinterpreted the usage of ADC_SMPRx. I thought SMPy in ADC_SMPRx would correspond to SQy in ADC_SQRz. So I set sampling times for ADC input channel 0, 1, 2, 3 while I use 16, 17, 19 and 20, while leaving those at the minimum value which lead to the consequences Danish described.

Now I set sampling times properly and everything works fine.

Hope this helps somebody

Martin