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.

TLC5957: 3 Daisy Chained TLC in a multiplex application

Part Number: TLC5957

Hello I have to drive 3 dasy chained TLC5957 in a 40x25 RGB matrix. I adaped the code of the "TIDA-01615 Reference Code" to my needs.

The first TLC is working properly as expected, so the 16x25 maxtrix is working. Now I need to shift the bit pattern for the GS data latch  through all the 3 devices.

As in the example I use the 9bit poker mode to reduce the data. Now I'm strugling how to shift the 9bit patterns through the devices.

Can you give me any advice for this?

Here is my  adapted code to write  the GS data:

void WriteGSData_Poker3(int *temp1, int *temp2, int *temp3) {

	int *DataArray[] = { temp1, temp2, temp3 };
	LAT(0);
	// loop 3x time to shift the GS data pattern through all the devices
	for (int device = 0; device < 3; ++device) {

		for (i = 8; i >= 0; i--) {
			for (j = 47; j >= 0; j--) {
				// get the data with the right offset
				if ((DataArray[device][j] & (1 << i)) == (1 << i))
					SIN(1);
				else
					SIN(0);
				SCLK(0);
				SCLK(1);
				if (device == 2 && j == 3 && i == 0) //LATGS Command
					LAT(1);

				else if (device == 2 && j == 1)   //WRTGS Command
					LAT(1);

			}
			if (device == 2 && i == 0) {
				//before to outpus are enabled with the new LED pattern, switch off the previous line
				mcp23s17_disable_lines();
			}
			LAT(0);
		}
	}
}

Other question, as in the example the communication is implemented with bit banging of  each dedicated GPIO Pin.

Is it possible to implment this with real  hardware SPI-Modules in an MCU? Can you provide an example SPI project for the TLC59XX

Thanks & best regards Stefan 

  • Hi, Stefan,

    Let us take a look at this and reply you next Monday.

    Thanks.
    Regards,
    Kenneth
  • Hi Stefan,

    1) it seems there is a problem about the sequence for cascading three devices with 9 bits poker mode,

    For the data:

    1st Sending MSB: 48 bits(IC2)+48 bits (IC1)+48bits (IC0)

    2nd MSB-1 bits:48 bits(IC2)+48 bits (IC1)+48bits (IC0)

    '

    '

    '

    9th LSB: 48 bits(IC2)+48 bits (IC1)+48bits (IC0)

    2) MCU with standard SPI cannot be used to communicate with this device, as you can see, there are two parallel inputs SIN, LAT signal for the sequence, but the standard SPI just has one input SDI.

  • Hello Shawn

    Yes I think you are right, there is a problem with the 9 bit poker mode. But this answer brings my not any step further.

    I found another possible solution by myself:

    I arrange the 3 TLC5957 in a virtual parallel mode, so not daisy chain them.

    Each device has its own SIN Data GPIO from the MCU. SCLK, LAT and GCLK are connected together, 

    In my WriteGSData_Poker3p() routine, I set the three SIN() GPIO Pins according the data for each device, then I toggle the SCLK for all devices.

    With this configuration I can feed the data into all 3 devices simultaneously:

    Please can you tell me, is this a suitable solution, or are there any disadvantages I can't see at the moment?

    BR Stefan

    /// @brief send the LED data for all 3 TLC5957 into the GS data memory
    /// @param temp1 data for TLC5957 No1
    /// @param temp2 data for TLC5957 No2
    /// @param temp3 data for TLC5957 No3
    void WriteGSData_Poker3p(int *temp1, int *temp2, int *temp3) {
    	LAT(0);
    	for (i = 8; i >= 0; i--) {
    		for (j = 47; j >= 0; j--) {
    			// send SIN data for device 1
    			SIN(temp1[j]>> i);
    			// send SIN data for device 2
    			SIN2(temp2[j]>> i);
    			// send SIN data for device 3
    			SIN3(temp3[j]>> i);
    
    			//clock for all 3 devices simultaneously
    			SCLK(0);
    			SCLK(1);
    			if (j == 3 && i == 0) //LATGS Command
    				LAT(1);
    			else if (j == 1)   //WRTGS Command
    				LAT(1);
    		}
    		// before activate the new data, disable the line drivers
    		if (i == 0) {
    			mcp23s17_disable_lines();
    		}
    		LAT(0);
    	}
    }





  • Hi Stefan,

    That is good news, thanks for the feedback.

    If the MCU GPIO resource is enough, it will be fine.

    Regards,
    Shawn.
  • Hi Stefan,

    Have you solved this issue?
    I will close this thread temporary, if you have more questions or concerns, pls let us known.

    Thanks!

    Regards,
    Shawn