Hello everyone,
I’m facing issues with the TLC5973 LED driver when paired with the WT32-ETH01 microcontroller. In my project, I use the TLC5973 to control LEDs. When I try dimming just one color, everything works perfectly. However, as soon as I dim two or three colors, at high brightness flickering starts to occur.
I have a stable power supply and adding a capacitor didn’t make a difference. After some debugging and using an oscilloscope, I noticed that some of the PWM pulses from the TLC appear shorter than they should be. This might explain the flickering.
I’ve attempted several things but turning off the WiFi and Bluetooth on the WT32-ETH01 with WiFi.mode(WIFI_OFF); and btStop(); commands seemed to help a lot, but the flickering is still not entirely gone. Therefore I assume it could be an Issue with the timing or Interrupts which occur.
Has anyone had experience with this hardware combination or can offer tips on optimizing the timing? Is it feasible to rewrite the library to be better suited for the TLC5973 and the WT32-ETH01?
My code looks like this:
#include <TLC5973.h>
#include <WiFi.h>
#include "esp_bt.h"
byte LED = 4;
uint16_t N = 1; // One LED on each output
TLC5973 strip = TLC5973(N, LED);
int fadeValue = 0; // Start with LED off
bool increasing = true; // Direction of fade
const long intervalFade = 10; // interval for fading (milliseconds)
unsigned long previousMillis = 0;
void setup() {
// WiFi.mode(WIFI_OFF); //To turn Wifi off
// btStop();
Serial.begin(9600);
strip.begin();
strip.setPixelColor(0, 0, 0, 0);
strip.show();
}
void loop() {
unsigned long currentMillis = millis();
if (currentMillis - previousMillis >= intervalFade) {
if (increasing) {
fadeValue += 1;
if (fadeValue >= 4095) {
increasing = false;
}
} else {
fadeValue -= 1;
if (fadeValue <= 0) {
increasing = true;
}
}
strip.setPixelColor(0, fadeValue, fadeValue, fadeValue);
strip.show();
previousMillis = currentMillis;
}
}
The routine which sends the data looks like this:
void TLC5973::show(){
noInterrupts(); // Need 100% focus on instruction timing
for(uint16_t i = 0; i < numWords; i=i+3){
writeWord( 0x03AA); //Start
writeWord( pixels[i] );
writeWord( pixels[i+1] );
writeWord( pixels[i+2] );
waitGSLAT(4);
}
waitGSLAT(4);
interrupts();
}
I already deactivated Interrupts before the communication but when WIFI and bluetooth are ON there is massive Flickering at the LEDs.
Any help or recommendations would be greatly appreciated!
Thanks in advance.