Hello,
I am using a single 5951 to control 8 RGB leds.
ISSUE:
As GS values (for all LEDs) are raised from 0 to 4095, the LEDs brightness rises from zero to full on (100% duty cycle) every 256 steps (not 4096 as expected). This repeats, immediately falling from 100% duty cycle to 0% and starting to ramp up again for the next 256 counts (256 to 512). This causes it to ramp up to maximum duty cycle 16 times before it gets to a GS count of 4095.This is frustrating as the FC bits 197/198 are set to zero.
My setup is below. The code is a short version of the 5951 Arduino code. Any assistance would be appreciated. All other functions work (DC, BC, FC bits (except possibly for 197/198). Thanks!
SETUP
I am using GSSin for ALL data, not DCSin. Iref set to 20ma. Vcc is 3.3V. DCSin and DCSCK are grounded.
Function control register set to B1111100 to get a repeating GS of 4095. DC set to max at 127, BC all set to 255. GSKR,G,B all tied to a 31.25k clock.
UCONTROLLER AND CODE
- Arduino Nano. This code only controls RGB LED 0.
#include <TLC5951.h>
#include <SPI.h>
// DEFINE CONTROL PINS
#define GSLAT 5
#define XBLNK 6
#define GSCKGRB 9
TLC5951 tlc;
void setup() {
// TIE GSCKR, GSCKG, AND GSCKB TOGETHER
// SET ARDUINO GSCK R, G, B TO 31.25KHZ
TCCR1B = TCCR1B & 0b11111000 | 0x01; // Pins 9 & 10 @ 31250 Hz
pinMode(GSCKGRB, OUTPUT);
analogWrite(GSCKGRB, 127);
tlc.init(GSLAT, XBLNK, 0);
// START SPI
SPI.begin();
SPI.setClockDivider(SPI_CLOCK_DIV2);
Serial.begin(115200);
// SET REGISTERS - DC, FC, BC
tlc.setAllDCData(127);
tlc.setFunctionData(B1111100); // 7 BIT FUNCTION REGISTER - bits 0 and 1 set to 4095 GS (0,0)
tlc.setBrightness(255, 255, 255);
tlc.update();
}
void loop() {
// CYCLE LED 0 GS VALUES FROM 0 TO 4095
for (uint16_t i = 0; i < 4095; i += 1) {
tlc.setLED(0, i, i, i); // TRICOLOR LED 0 only
tlc.updateGS();
Serial.println(i);
delay(200);
}
}
Thank you again for your assistance.
Thank you!
Eric Frische