SPI Communication Issues with ESP32 and LED Drivers at Lower Speeds

craigp
Posts: 1
Joined: Tue Mar 19, 2024 9:18 pm

SPI Communication Issues with ESP32 and LED Drivers at Lower Speeds

Postby craigp » Tue Mar 19, 2024 9:40 pm

Hello Espressif Community,

I'm currently facing a challenge with SPI communication between ESP32 and a series of LED drivers, which are tasked with controlling LEDs and detecting faults. Unlike other MCUs, where we've successfully controlled hundreds of LED drivers in series, the ESP32 is returning unexpected error data at SPI speeds below 6MHz.

Oddly, the issue seems counterintuitive, as one would typically anticipate errors at higher speeds rather than lower ones. To isolate the problem, we simplified our setup by connecting the ESP32 directly to a single LED driver. At speeds under 6MHz, we observed data corruption—receiving 0xAA instead of 0x55. Above 6MHz, however, the data is correct.

When replicating the setup and code with a Teensy 4.1 MCU, there were no errors, everything functioned perfectly. Additionally, conducting a direct loopback test (MOSI to MISO) on the ESP32 yielded the correct data at all speeds tested, which suggests the LED driver specifically affects the ESP32's SPI transmissions.

Upon reviewing the signals on a logic analyzer and comparing the ESP32 to the Teensy 4.1, the waveforms appeared identical. The notable difference was in the MOSI line's idle state—high on the Teensy and low on the ESP32. Even after adjusting the IDF code to ensure a high idle state for the ESP32's MOSI line, the errors persisted.

Would anyone have insights into why the ESP32 might be uniquely affected by the LED drivers? Any suggestions or recommendations to troubleshoot this issue would be greatly appreciated.

Thank you for your time and help.

Craig

Teensy - Logic Analyzer Sending and Receiving 0x55 at 2MHz through LED Driver.png
Teensy - Logic Analyzer Sending and Receiving 0x55 at 2MHz through LED Driver.png (19.08 KiB) Viewed 782 times
ESP32 - Logic Analyzer Sending 0X55 Receiving 0xAA at 2MHz through LED Driver.png
ESP32 - Logic Analyzer Sending 0X55 Receiving 0xAA at 2MHz through LED Driver.png (18.48 KiB) Viewed 782 times
ESP32 - Logic Analyzer Sending 0X55 Receiving 0xAA at 2MHz through LED Driver Using Espressif IDF.png
ESP32 - Logic Analyzer Sending 0X55 Receiving 0xAA at 2MHz through LED Driver Using Espressif IDF.png (17.06 KiB) Viewed 782 times

MicroController
Posts: 1702
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: SPI Communication Issues with ESP32 and LED Drivers at Lower Speeds

Postby MicroController » Sat Mar 23, 2024 11:31 am

You may want to verify that you are using the correct SPI mode (CPOL+CPHA) for the LED driver.

Who is online

Users browsing this forum: Majestic-12 [Bot], TRUEcabbage and 63 guests