This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi Jason,
Attached is a Block diagram and schematic.
1. the GSCK for red green and blue are all tied together and all linked back to Pin 13 of Arduino. (Modified from Pin 9 of the Limb example)
2. Xblink are all tied together and connected to Pin 23 of arduino
3. GSLAT are all tied together and connected to Pin 22 of arduino
4. all GSSCK pins are tied together and connected to Pin 52 arduino
5. all GSSIN pins of each bank are tied together and connected to Pin 51 arduino. ( 7 X data-in lines driving 7 banks )
The arduino has a 16mhz clock the SPI bus is set to half that ( 8mHz) we are using this clock to send data to our led Board.
We clock in the data to the first chip of Bank 1, we then sent the same data again expecting it to shift into the second chip of bank 1... we repeat this a third time to shift the data into the third chip of bank.
the data we send to Chip # 1 seems to work correctly, ( All LEDS light).
We then send the same data again expecting to see the same data shifted to Chip # 2.. we see all leds lighting from Chip # 1 as expected , but Chip#2 does not consitantly light all leds. we do the same again and expect the data to be shifted accross to chip#3 ... but we see the same issue ... it seems that some of the data is not shifted accross correctly. always the first Chip # 1 is correct, but subsequent shifts from this to # 2 and 3 seems to not work correctly.
We see a similiar issue with bank 2 etc.. the first chip of each bank gets the correct data and lights all LEDS, but subsequent shifts to Chip # 2 and 3 do not always light all the LEDS.
Sometime the shift works correctly but other times some LEDS on Chip # 2 and 3 do not light.
Here is the code we modified to lshift to next chip and light all banks
// GSSCK and GSSIN are connected to SPI Clock and MOSI pins respectively
// GSLAT is on pin 22 and XBLNK to 23
// All the Grayscale clocks for Green, Red, and Blue (GSCKG, GSCKR, GSCKB)
// are connected to the same arduino pin (9)
//-------------------------------------------
#include "TLC5951.h"
#include <SPI.h>
#define GSLAT 22
#define XBLNK 23
#define GSCKGRB 13
#define start_color "red"
TLC5951 tlc;
void setup() {
// Set the timer to max speed for fastest PWM generation
// This is required so that the Grayscale clocks on the TLC5951 are fast enough to prevent visible jittering in the LEDS
// The current values are for a Arduino Mega 2560
// Link to find values for you arduino/pins: playground.arduino.cc/.../TimerPWMCheatsheet
TCCR0B = TCCR0B & 0b11111000 | 0x01; // Pins 9 & 10 @ 31250 Hz
// Now set the GSCKGRB to an output and a 50% PWM duty-cycle
// For simplicity all three grayscale clocks are tied to the same pin
pinMode(GSCKGRB, OUTPUT);
analogWrite(GSCKGRB, 127);
// The library does not ininiate SPI for you, so as to prevent issues with other SPI libraries
SPI.begin();
SPI.setClockDivider(SPI_CLOCK_DIV2);
// init(GSLAT pin, XBLNK pin, default grayscale values for all LEDS)
tlc.init(GSLAT, XBLNK, 0);
// setLED(Output number, Red value, Green value, Blue value)
// The next lines set all LED's to the brightest blue setting (0-4095)
// tlc.setLED(0, 0, 0, 4095);
// tlc.setLED(1, 0, 0, 4095);
// tlc.setLED(2, 0, 0, 4095);
// tlc.setLED(3, 0, 0, 4095);
// tlc.setLED(4, 0, 0, 4095);
// tlc.setLED(5, 0, 0, 4095);
// tlc.setLED(6, 0, 0, 4095);
// tlc.setLED(7, 0, 0, 4095);
// We must set dot correction values, so set them all to the brightest adjustment
tlc.setAllDCData(127);
// Set Function Control Data Latch values. See the TLC5951 Datasheet for the purpose of this latch.
// Data is input LSB first, ie bit 192 (for red DC range) is first, a 1
// bit 198 (0) is last, for the grayscale counter mode
tlc.setFunctionData(B1111100);
Serial.begin(115200);
for(int i = 0; i <= 7; i++){
tlc.setLED(i,0,0,0);
//Serial.println (i);
}
// set all brightness levels to max (127)
tlc.update();
delay(100000);
for(int i = 0; i <= 7; i++){
tlc.setLED(i,4095,4095,4095);
Serial.println (i);
}
// Finally, call the function to send the data to the TLC5951
// tlc.update();
// blue,x red
tlc.setBrightness(8,0,0);
tlc.update();
delay(100000);
tlc.setBrightness(0,8,0);
tlc.update();
delay(100000);
tlc.setBrightness(0,0,8);
tlc.update();
Thanks for your response,
We are sending the Functional Control data to the device via the GSSIN pin. As I understand it - doing it this way is possible.
We were formatting the Functional Control data ( 216 bits) , and sending it to the device ( via the GSSIN pin ), and then formatting the GSdata ( 288 bits)and then sending it to ( via the GSSIN pin ) latching each by clocking glat pin.
However I think our issue was that, because we have 3 devices daisy chained, we initially sent the Control data then the Device data to the first device, latched it, then did the exact same for the second, latched it, and then the same for the third.
What we should have done was format all the Control data ( 648 bits), send this to the 3 devices, then format the GSdata ( 864 bits) and send this to the 3 devices .. by doing this it now seems to work correctly.
Does this make sense ?
regards