0

TLC59711 setPWM not working on ESP32
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

TLC59711 setPWM not working on ESP32

by anglcruzr on Fri Jul 16, 2021 9:17 pm

Hello,
I want to use the TLC59711 to drive 12 separate LEDS using an ESP32. When I upload the test sketch that comes with the Adafruit library everything works fine but when I want to address an individual LED using
Code: Select all | TOGGLE FULL SIZE
setPWM()
or
Code: Select all | TOGGLE FULL SIZE
setLED()
nothing happens. I have everything wired correctly and I even tried it with an Arduino Uno and it works correctly. Can someone help me figure out why it doesn't work with the ESP32?
This is my test code that works on the Arduino Uno but not on the ESP32:
Code: Select all | TOGGLE FULL SIZE
#include "Adafruit_TLC59711.h"
#include <SPI.h>

#define NUM_TLC59711 2

#define data   26
#define clock  25


Adafruit_TLC59711 tlc = Adafruit_TLC59711(NUM_TLC59711, clock, data);


void setup()
{
  Serial.begin(9600);
 
  Serial.println("TLC59711 test");

  tlc.begin();
  tlc.write();
}

void loop()
{

  tlc.setPWM(0, 65535);
  tlc.setPWM(1, 65535);
  tlc.setPWM(2, 65535);
  tlc.setPWM(3, 65535);
  tlc.write();
}

anglcruzr
 
Posts: 4
Joined: Fri Jul 16, 2021 3:46 am

Re: TLC59711 setPWM not working on ESP32

by adafruit_support_mike on Tue Jul 20, 2021 2:36 am

Post a photo showing your hardware and connections and we'll take a look. 800x600 images usually work best.

adafruit_support_mike
 
Posts: 63679
Joined: Thu Feb 11, 2010 2:51 pm

Re: TLC59711 setPWM not working on ESP32

by anglcruzr on Tue Jul 20, 2021 8:07 pm

Thank you for helping. This is how I have everything connected (only one led is shown for simplification). The ESP32 is powered by USB.
Attachments
TLC59711 test_bb.jpg
TLC59711 test_bb.jpg (221.6 KiB) Viewed 116 times

anglcruzr
 
Posts: 4
Joined: Fri Jul 16, 2021 3:46 am

Re: TLC59711 setPWM not working on ESP32

by adafruit_support_mike on Tue Jul 20, 2021 10:43 pm

Post a photo of the actual hardware please. Diagrams show how things are supposed to be. Hardware shows how things really are.

adafruit_support_mike
 
Posts: 63679
Joined: Thu Feb 11, 2010 2:51 pm

Re: TLC59711 setPWM not working on ESP32

by anglcruzr on Wed Jul 21, 2021 3:02 am

Here are the photos of the hardware.
Attachments
Hardware 2.jpg
Hardware 2.jpg (317.11 KiB) Viewed 109 times
Hardware 1.jpg
Hardware 1.jpg (488.22 KiB) Viewed 109 times

anglcruzr
 
Posts: 4
Joined: Fri Jul 16, 2021 3:46 am

Re: TLC59711 setPWM not working on ESP32

by adafruit_support_mike on Thu Jul 29, 2021 3:01 pm

Thank you.

I don’t see a power connection to the ESP32 board. Does the power LED on the TLC59711 light when you connect power?

adafruit_support_mike
 
Posts: 63679
Joined: Thu Feb 11, 2010 2:51 pm

Re: TLC59711 setPWM not working on ESP32

by anglcruzr on Thu Jul 29, 2021 4:14 pm

Hello,
The ESP32 is powered via USB and the TLC59711 is powered via the ESP32 3.3V pin. The TLC59711 power led does turn on. I already tested this circuit with an Arduino Uno and it works correctly. I'm just not sure why it doesn't work with the esp32.
Attachments
hardware 3.jpg
hardware 3.jpg (354.53 KiB) Viewed 65 times

anglcruzr
 
Posts: 4
Joined: Fri Jul 16, 2021 3:46 am

Re: TLC59711 setPWM not working on ESP32

by adafruit_support_mike on Sun Aug 01, 2021 4:34 am

The two major differences between the ESP32 and an Arduino would be signal voltage and clock speed.

The TLC59711 is spec’d to work at 3.3V, so I’m inclined to think it’s a timing issue.

The ESP32’s SPI bus can hit 80MHz, but the TLC59711 maxes out at 10MHz.

The TLC59711 library uses our BusIO library, specifically the Adafruit_SPIDevice class. The code calls for an SPI speed of 1MHz, but I don’t know if the ESP32 obeys that limit.

That would be easiest to check with an oscilloscope or a logic analyzer, but both are still a bit pricey.

The next best option would be to check the ESP32 documentation for ways to limit the SPI bitrate, and try forcing a slower rate in your base code.

adafruit_support_mike
 
Posts: 63679
Joined: Thu Feb 11, 2010 2:51 pm

Please be positive and constructive with your questions and comments.