January 27, 2020

STM32F407VET6 devel board from eBay: bad layout = adc noise

I'm measuring a potentiometer using 12-bit ADC on an STM32F4VE board I've got from eBay, and I get plenty of noise in range of about +/-30 units.

+/- 30 units is about 48mV: 60 * 3.3V / 4096 =0.048V.

I assume that ADC is very accurate. The datasheet claims typical accuracy of 2LSB and maximum of 5LSB, which would mean the error would range between 1.6 4mV (or +/-3 units). See "Table 68. ADC accuracy at fADC = 30 MHz" in the datasheet.

Searching on stackoverlow, eevblog and elsewhere on the internet suggests board layout problems.

Luckily the schematics for this board are available, and we can take a closer look:
https://os.mbed.com/media/uploads/hudakz/stm32f407vet6_black_sch.pdf.
The schematics shows a pair of decoupling capacitors between VDD and AMS1117.3-3, but shows no decoupling of VDDA from VDD: VDDA is simply tied to VDD. Same is true for VREF+:
Contrast this with the suggested wiring from the datasheet. VDDA, while is tied to VDD, it is also decoupled from VDD via a pair of caps: 100nF and 1uF:


Also, the datasheet states (emphasis mine):
Each power supply pair must be decoupled with filtering ceramic capacitors as shown above. These capacitors must be placed as close as possible to, or below, the appropriate pins on the underside of the PCB to ensure the good functionality of the device
The VDD is decoupled from the ground only on pin 19. Other VDD and VSS pins are connected to 3v3 and ground respectively. And the present decoupling caps don't appear to be placed as close as possible:

So what does all this amount to? Does this result in 48uV noise on VREF+? Here is how it shows on my scope:

Vpp = 51.6mV seems close enough to the 48mV noise measured by the ADC.

STMicroelectronics makes a development board for STM32F407: STM32F4DISCOVERY.
Let's take a look at how the discover board is wired:

While the discovery board doesn't have precision reference voltage, VREF+ and VDDA are properly decoupled from VDD. And here is the location of decoupling caps:
Many are much closer to the power rails than on the eBay board, but caps for the VDDA and VREF+ (C21, C23, C22, C25 in the top left corner) are at a similar distance.

I can't provide oscilloscope trace for comparison at this time, but I believe this wiring should provide lower noise on VREF+ line.

Mouser sells the discovery board for $20 + shipping $8. It has various peripheries among which are an audio DAC and a mic, LEDs, and a built-in debugger, has 1mb of program memory (twice as much as the eBay board). While overall cost appears to be 3 times more of the board from eBay, the quality of the board and extra options it provides are worth it.

However, eBay board served well: it made me learn so many things about ADCs, board layouts, and oscilloscopes. Low quality eBay components make electrical engineers out of software engineers.