Noise when communicating with SPI device on Teensy 4.0

Status
Not open for further replies.

rafl

Member
I'm building a little gadget using an ILI9341 TFT display that i'm talking to using SPI on a Teensy 4.0. The display was easy to get working using the ILI9341_t3 library, However, I noticed the display backlight getting momentarily brighter whenever I'd update its contents, which is something I'd like to avoid.

After some measuring, I've noticed quite a bit of noise on the supply voltage for the LED backlighting, which would explain the increased brightness. From there I've tried to rule out possible sources of that noise, and ended up with a setup that just has the Teensy powered from a constant voltage power supply at 5V through Vin, and two oscilloscope probes directly on pin 13 / SCK and 3.3V out. The probes are grounded at the usb connector and DC-coupled.

In that setup, I'm able to measure an SCK waveform that overshoots up to 4.1V and undershoots down to -.8V. On the 3.3V output, I'm able to measure >1V of noise at the same frequency as SCK (~30MHz). The noise only appears when I'm performing SPI transactions through display operations - when no SPI communication is in progress there's no noticeable noise.

Is what I'm observing to be expected when doing SPI communication using ILI9341_t3? What is causing it? Is the hardwired LED on pin 13 a contributor? Is just adding more filtering the right approach to address this issue?

For reference, here's some code I can use to reproduce the issue. The way it's written it'll produce the noise continuously as it's constantly updating the display, making the display appear to have constant brightness. If the frequency the display is updated at is reduced (e.g. to only update when `val' changes via some event), the display will appear slightly dimmer most of the time, but appear brighter momentarily whenever the update happens.

Thanks!

Code:
#include <Arduino.h>
#include <Encoder.h>
#include <ILI9341_t3.h>

#define TFT_DC 21
#define TFT_CS 10
#define TFT_RST 255
#define TFT_MOSI 11
#define TFT_SCLK 13
#define TFT_MISO 12

ILI9341_t3 tft = ILI9341_t3(TFT_CS, TFT_DC, TFT_RST, TFT_MOSI, TFT_SCLK, TFT_MISO);

void setup() {
  tft.begin();
  tft.fillScreen(ILI9341_BLACK);
  tft.setTextColor(ILI9341_WHITE, ILI9341_BLACK);
}

int val = 42;

void loop() {
  tft.setCursor(0, 0);
  tft.printf("%05d", val);
}
 
Status
Not open for further replies.
Back
Top