TLC59711 setPWM not working on ESP32

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
anglcruzr
 
Posts: 4
Joined: Fri Jul 16, 2021 3:46 am

TLC59711 setPWM not working on ESP32

Post by anglcruzr »

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

setPWM()
or

Code: Select all

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

#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();
}

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: TLC59711 setPWM not working on ESP32

Post by adafruit_support_mike »

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

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

Re: TLC59711 setPWM not working on ESP32

Post by anglcruzr »

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 240 times

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: TLC59711 setPWM not working on ESP32

Post by adafruit_support_mike »

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

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

Re: TLC59711 setPWM not working on ESP32

Post by anglcruzr »

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

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: TLC59711 setPWM not working on ESP32

Post by adafruit_support_mike »

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?

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

Re: TLC59711 setPWM not working on ESP32

Post by anglcruzr »

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 189 times

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: TLC59711 setPWM not working on ESP32

Post by adafruit_support_mike »

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.

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”