SPI Communication Issues with ESP32 and LED Drivers at Lower Speeds
Posted: 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
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