Mixed signal PCB layout for PSoC

I am developing a PCB for an analogue sensing application. It uses the internal ADC on a PSoC3. As usual, the application is very space constrained (11mm x 21mm), so I have had to make some compromises in the PCB layout which I would not have done on a larger PCB.

The board is supplied by regulated 6v, and contains two 5v linear regulators. An MCP1702 for the digital supply, and an MIC5205 for the analogue supply. The board is sensing five A1324 Hall effect sensors. Each Hall effect output signal is filtered by a 100nF + 1k RC filter. One sensor is on the PCB itself (bottom right). The other 4 plug into the right hand 6-pin connector.

The chip is acting as an SPI slave, but ADC samples are always taken between SPI transactions, so the SPI should not interfere with the analogue signals.

Sadly, I am still seeing some noise (about 1.5 LSB at 12-bits) on the analogue signals, and I wonder if there is anything I could have done differently in the layout to improve it.

Please open the image in a new tab to see it in higher resolution.

Other PCB designs I have done using the MCP3208, and the same dual 5v supplies, same sensors, and same RC filters have achieved no noticeable noise at 12 bits.

The ADC on the PSoC3 is a delta sigma type. This version of the PSoC is limited to 12 bits, but another part number has a 16-bit ADC (although with a lower sample rate).

I do care about the noise, and would really like to push it a bit further towards 12 ENOB. The reason is not accuracy, but velocity measurement. Currently this level of noise is making it impossible to do accurate position and velocity control on a robot.

Schematic. Sorry it's a bit cramped, but you can just about read the values.

• Do you mean MCP3208?? That has a 72dB SINAD, or ENOB=11.7 – Scott Seidman Sep 13 '12 at 19:05
• Whoops. Yes. Corrected. – Rocketmagnet Sep 13 '12 at 20:31
• Forgot to ask: can you post a schematic? – stevenvh Sep 14 '12 at 8:22
• Also, STOP USING NET-LABELS! Your circuit is nowhere near complex enough to require them, and by not actually showing the connections, you make it much more difficult to trace connections out. Again, the purpose of the schematic is to make the intended function and functionality of the circuit visually apparent. You then let the computer translate the visual representation to the actual physical layout of the devices (which is something computers are very good at). – Connor Wolf Sep 15 '12 at 3:42
• @Rocketmagnet, Having a very small pcb area doesn't mean you can't draw your schematic on D-size paper. – The Photon Sep 25 '12 at 18:46

You'll always have some noise on an ADC, especially SA (Successive Approximation) types on the microcontroller die. Sigma-delta perform better for Gaussian noise, as they integrate it. Don't expect 12 ENOB from a 12-bit ADC.

The controller's noise is a reason why most microcontrollers don't give you a higher resolution than 10 bit, and the AVR offers the possibility to stop the microcontroller during the ADC's acquisition, which should confirm that at least some of the noise comes from the controller.

But the question is: do you care? 1.5 bit of noise on a 12-bit ADC still leaves you more than 10 bits, or better than 0.1 %. How accurate is your Hall sensor? Other components in the circuit?

edit
You seem to use the PSoC's internal oscillator, since I don't see any crystal on the schematic. It looks OK: you have the proper decoupling. Apart from the internal clock the only high speed part in the circuit seems to be the SPI, but you say that this will be silent during measurements. The rest of the board is DC or probably relatively low frequent like the Hall effect sensors. And it's a Damn Small™, which also helps: shorter traces will pick up less noise. Sure I could nitpick about the MCP1702, which I would rotate 90° CCW so that the output capacitor can be placed even closer to the pins, but that won't solve the problems.

I only see one change in the layout which might improve your S/N ratio:

In the datasheet split analog and digital ground planes are suggested for "Optimal Analog Performance" (page 10).

For the rest: it's a small board like I said, that means short traces and decoupling within a few mm. So I would like to have another look at the noise's source. Prime suspect is the PSoC's clock. The PSoC can run a very low supply voltage, and that would reduce its noise. Of course it would help much if VDDA has to be lowered as well, but I didn't read anywhere in the datasheet that VDDA shouldn't be higher than VDDD.

Next, the ADC. On page 55 of the datasheet it says 66 dB SINAD, that's 11 bits, close to what you get now. The A1324 datasheet gives us 7 mVpp noise on a quiescent voltage of 2.5 V. That's also far less than the 72 dB S/N ratio which 12-bit could give you. You may improve this a little bit with extra filtering.

You mention the better performance of the MCP3208, but that's an ADC away from the microcontroller, and that may explain how an SA ADC can do better than a sigma-delta with the same resolution.

So, the options I see: lower the digital power supply voltage and split analog and digital grounds.

• That is a very interesting idea about lowering the PSoC's digital supply voltage. VDDA certainly can be higher than VDDD. – Rocketmagnet Sep 14 '12 at 19:21
• So, do you think I should disconnect VSSA from the thermal pad? I have actually posted this as a whole new question. – Rocketmagnet Sep 14 '12 at 19:41

I agree with the above. 1.5LSB of noise is pretty reasonable. http://www.cypress.com/?docID=39346 shows a minimum SINAD of 66 dB in 12 bit mode, suggesting ENOB = 10.7.

I know this isn't a direct answer to your question, but I'm going to interpret the question as "how do I fix my problems with velocity control?" and not "How do I get more than 10.5 ENOB?".

How are you differentiating? Do you have enough spare clock ticks to do something a hair smoother than a two-point central difference? Maybe work out something 5 samples wide, optimized in Matlab?

Also, this might sound a bit funny, but velocity noise gets worse as you sample faster

$$\frac{1LSB}{\Delta t}$$ gets bigger as delta t gets smaller). Try sampling only as fast as you need to, not as fast as you can.

Not to be insulting, but also take a quick glance to make sure nothing silly is going on in your velocity control, like issues with conversions between signed and unsigned integers, and make sure that your integers are wide enough to avoid overflow errors when you differentiate. My own control equations often get complicated enough that I sometimes explicitly cast each operation.

Lastly, though perhaps most likely, are you losing effective bits off the top by not amplifying to near full scale? If so, you can amplify or perhaps provide a smaller Vref.

• We are calculating position and velocity using an Alpha Beta Filter. I understand that velocity noise increases as sample rate increases if done naively. I am sure that velocity noise is not due to a sign error. And we are already almost at full scale, so there is no more amplification I can do without risking hitting the top or bottom of the range. – Rocketmagnet Sep 13 '12 at 8:06
• Would you say that there are no improvements I can make to the layout? – Rocketmagnet Sep 13 '12 at 8:07
• Can't see anything yet. How are you amplifying the hall sensors? Have you actually looked at the output of the A-B filters and control eqns as a reality check? Peeked at noise on your regulator outs? It might be illuminating to do a formal noise budget for the whole system – Scott Seidman Sep 13 '12 at 11:14
• But! The other advantage of differential mode is that it lets me bump up the sample rate 4x, so I can do oversampling. This should bring the noise down a little. – Rocketmagnet Sep 13 '12 at 20:49
• Maybe a bypass cap on Vref (not sure how to do that, its in the datasheet). Other than that, I think you're extremely close to, if not at, the ideal ENOB for the PSOC 3 ADC at 12 bits, so you've done about as good as you could! – Scott Seidman Sep 13 '12 at 21:45