Hello. I welcome you to forum post describing my next experiment with Würth Elektronik WL-ICLEDs. In this forum post I will look at opportunity to combine 24-bit and 48-bit LEDs on single chain. It can be quite useful if you work on project which has several types of LED like some LED matrix and diagnostic LEDs. In such project it makes sense to make LED matrix from more advanced 48-bit LEDs (Würth number 1312121320437) while diagnostics RGB LEDs can be just simple classic 24-bit LEDs (Würth number 1315050930002). Normally you would need to control two buses, but if you read datasheets carefully, you notice that timing of the signal is almost the same. Just amount of data transferred per LED and data encoding differs. For classic LEDs (like 1315050930002), the timing requirements for signalling are:

For 48-bit LEDs like 1312121320437, signalling requirements are:

They use different unit, so it may look confusing at the first look, but actually times are very similar. Actually, it is not possible to find any single value, which satisfies all minimum and maximum when implementing using SPI peripheral. But class 24-bit LEDs are much more tolerant. I stick to following typical values for 48-bit LEDs and slightly violate 24-bit signalling because they are more tolerant. In practice, it works.
I experimentally tested it by simple “snake”. It works. Let’s see:
On video above, I have two PCBs with different LEDs. Left one is PCB with 48-bit LEDs. Right, one is PCB with 24-bit LEDs. On my PCB for 48-bit LEDs I exposed DOUT signal from last LED. This I interconnected on breadboard to DIN of next PCB. It does not need to be in this order necessarily, but on my older PCB for classic LED I did not expose DOUT from last LED. You can also switch between types of LED as many times as you want. You will just need write them in firmware properly.
Little bit more complicated it is on firmware side. But since I make my own library, it is manageable. If you remember my second forum post Testing BI pin, I designed my library in a way that I have following functions:
void LEDS_Init(); void LEDS_SetLed24(size_t index, uint8_t r, uint8_t g, uint8_t b); void LEDS_SetLed48(size_t index, uint8_t rI, uint16_t rPWM, uint8_t gI, uint16_t gPWM, uint8_t bI, uint16_t bPWM); void LEDS_Transmit();
Important part is to properly maintain indexing and take in account that every 48-bit takes 2 slots in internal buffer. Firmware for moving green on video look as follows:
int main(void) {
cy_rslt_t result;
result = cybsp_init();
CY_ASSERT(result == CY_RSLT_SUCCESS);
__enable_irq();
cyhal_system_delay_ms(100);
LEDS_Init();
int led = 0;
while (1) {
int iGain = 1;
LEDS_SetLed48(0, iGain, 0, iGain, 0, iGain, 0);
LEDS_SetLed48(2, iGain, 0, iGain, 0, iGain, 0);
LEDS_SetLed48(4, iGain, 0, iGain, 0, iGain, 0);
LEDS_SetLed48(6, iGain, 0, iGain, 0, iGain, 0);
LEDS_SetLed48(8, iGain, 0, iGain, 0, iGain, 0);
LEDS_SetLed48(10, iGain, 0, iGain, 0, iGain, 0);
LEDS_SetLed24(12, 0, 0, 0);
LEDS_SetLed24(13, 0, 0, 0);
LEDS_SetLed24(14, 0, 0, 0);
LEDS_SetLed24(15, 0, 0, 0);
if (led < 6) {
LEDS_SetLed48(led * 2, iGain, 0, iGain, 255, iGain, 0);
} else {
LEDS_SetLed24(led + 6, 0, 15, 0);
}
LEDS_Transmit();
cyhal_system_delay_ms(100);
led++;
if (led >= 10) {
led = 0;
}
}
}
At the beginning there is some system initialization. Led variable is counter holding index to active LED. But it is physical index, it does not worry about underlaying LED type. In every iteration of infinite loop, I reset all LEDs to zero. First, I reset 48-bit LEDs first because they are first in chain. I need to increment index by two for every LED because 48-bit LEDs occupies 2 slots. Then I reset 24-bit LEDs. In this case index increment by one. After turning all off, I enable one depending on counter value. If the value is less than 6, I enable some of first 48-bit LEDs. Again, I need to index them with taking into account that they occupy two slots, so physical led index is actually multiplied twice. In case of later 24-bit LEDs, I need to index them with offset. They start at position 12, but because there is additional 6 “unwanted” entries before that, 12 – 6 is 6 and this is offset which I add to led index counter passed to LEDS_SetLed24. Finally, after buffer is setup, I send the new data to strip suing LEDS_Transmit() and then there is just some delay for defining speed of animation and incrementation of physical led counter.
Note that it works even 2 LEDs in 48-bit part of chain are missing. How is that possible I descibred in previous forum post: Testing BI pin
Conclusion
That’s it. Outcome is that combining different types of LED on single bus is possible and works. It was not that hard, because I already prepared library with keeping this use case in mind. Next time I will look to final piece I need before I move to making final project.