Noise on GND When Driving Display with SPI1 on Teensy4.1

Status
Not open for further replies.

prajtm

Member
I'm using a Teensy4.1 to drive a waveshare SSD1351 oled display attached to the SPI1 pins (just using adafruit ssd1351 library). The display works ok, but I'm getting a lot of noise on gnd (like 400mv pk-pk) whenever I try and talk to the display. This is pretty annoying as the noise is interfering with the stuff I have going on with the audio shield.

After reading a few other forum posts on similar problems, I tried turning the drive strength (IOMUXC_PAD_DSE) down on the SPI pins in SPI.cpp, but that doesn't seem to help. Setting IOMUXC_PAD_DSE(0) eliminates the noise, but the display stops working. Anything above 0 brings back the same amount of noise.

I'm having a lot of trouble tracking down the root cause of this noise problem, so I would appreciate any help.

I've attached a screenshot of the noise on my oscilloscope. I'm probing between one of the board's gnd and my battery gnd, which are both connected to the same groundplane. I'm updating the display every 10ms, which is why the noise appears periodically.
SPI1_Noise.png

Pin Connections
(Teensy) Pin 26 -> (Display) DIN
(Teensy) Pin 27 -> (Display) CLK
(Teensy) Pin 38-> (Display) CS
(Teensy) Pin 40-> (Display) DC
(Teensy) Pin 41-> (Display) RST
 
Last edited:
Hello. Can I ask you to do an experiment and try a 100ohm resistor on the CLK line close to the T4.1?
 
Hello. Can I ask you to do an experiment and try a 100ohm resistor on the CLK line close to the T4.1?

Sure. I tried again with a 100ohm resistor in series with the CLK line close to the Teensy, but I'm still getting the same result.

SPI_Noise2.png
 
Often these sorts of problems are an artifact of how you're measuring, especially the length of ground wires and the ground lead of your oscilloscope probe.
 
Just looking at the same issue here, soldering up a T4.0 and am wondering does it make sense to use the series 100R on any T4x digital output pin in use?
In my case, using SCL,SDA and TX3, the latter being direct connected to another board.
 
Often these sorts of problems are an artifact of how you're measuring, especially the length of ground wires and the ground lead of your oscilloscope probe.

This may have been partly to blame, so I tried measuring again using the little ground spring on my scope probe but I still see the problem. Here's a screenshot of the waveform across the audio board mic input with the display code running and without. The noise is still pretty large here and is overpowering any signal from the mic, resulting in just a loud buzzing.

With display/SPI code running:
Screen_on.png

With display/SPI code commented out:
Screen_off.png

I probably should mention this is all on a custom PCB. Could this be some kind of a layout issue?
 
Thanks Paul. I2c is driving 6x NeoTrellis so there's some length and inevitable stray C and the Trellis likes pullups at the far end. An LC needed pullups at the board end as well.
 
Might be. Ground loops are a very common problem.

Thanks Paul, I'm a noob at PCB design and definitely didn't consider this when laying out my board. At the moment, I'm rocking a 2 layer PCB with components/signals on both sides + ground pours on both sides. But now, from what I've read, this seems like pretty bad idea. I'm considering redoing this using a 4 layer PCB with a separate, uninterrupted ground plane so I can avoid any ground loops/long return paths.

Since I have both high speed digital signals (SPI, I2C) and analog signals (audio shield circiuit), is it necessary to have separate analog and digital grounds? Or will a single, well connected groundplane for everything do the trick? How does grounding work for example in the official audio shields from PJRC?
 
As with pretty much all analog design, "it depends" and there are no easy universal answers.

Usually an unbroken ground plane layer is better than 2 layer routing, especially if analog stuff is kept physically separated from everything else.

Separate analog & digital grounds can also work well. Sometimes a unified ground with a "star pattern" layout works just as well (assuming you have the willpower to route your PCB that way). The main issue with ground loops is where non-audio ground currents end up flowing through the ground wires used for audio. A ground plane doesn't necessarily prevent that. You also need to consider the relative placement of power sources and power consumers to anticipate the path audio & non-audio ground currents will follow.

Often ground loop problems have nothing to do with your PCB design at all, but rather how the grounds of power supplies and computers and test gear and other equipment you connect to the PCB are connected to each other. We get these problems reported regularly in projects using the audio shield. Often this ground loop isolator is the easy answer. PJRC stocks that item for a reason...

While ground loops are a very common problem, that's not necessarily the cause of what you're seeing on your oscilloscope. It might be, or it might not. High bandwidth oscilloscope measurements are notoriously tricky. It's why wide bandwidth scopes have button which turns on a ~20 MHz low-pass filter!

Analog noise and ground problems are tough. There are no easy universal answers.
 
If one is going to mix digital circuitry with analog audio, better to use differential/balanced for the audio. Or stick with digital audio (eg, an i2s microphone).
 
Status
Not open for further replies.
Back
Top