Multiplexing Adventures: Stage One Complete


Achieved a 8×8 RGB matrix run by a single DM633 chip at good and healthy refresh rate of 122Hz. Which makes it possible to start designing new boards. Everyone loves video, so here it is, and then some explanations. (some flickering seen here is due to camera speed, it’s not present in real life)

 


The Background

The DM63x line of LED drivers sports an internal oscillator that provides ~18MHz frequency for the PWM. If no multiplexing is required, this is a very, very good thing, as it frees up controller pins and timers a major way, making it possible to do almost anything on it while being able to light up a lot of LEDs. Just for comparison: the popular TLC5940 doesn’t have any internal PWM engine, so the excellent tlc5940 library by Alex Leone not only utilizes 5 Arduino pins, but also grabs two out of three timers, making the microcontroller barely usable for anything except LED driving. (As a side note, I guess it could have been possible to use only one timer there in a rough mode, but still)

With multiplexing, though, this internal PWM is not so good. It still can (and should in some cases) be used, but with two restrictions:

  1. the multiplexing multiplier is lower than possible (like 8x for DM633/631 chip);
  2. each DM63x chip must run its own matrix, both anodes and cathodes.

 

The Problem

The reasons are simple, really:

  1. the oscillators on two DM63x chips are not and can not be synchronized. What’s more, they are not very accurate: the datasheet states they are roughly 18MHz, which in fact can be anything between 14.4 and 22MHz;
  2. the data on each LED driver is latched only after the PWM cycle completes.

That’s the reason for both-ways ghosting I experienced earlier: the frequency on two chips was different, which meant that their PWM cycles were not only unsynchronized, but also of different length; so sometimes the second chip turned on earlier than the first, some times later. As all the anodes were controlled by the first chip, this led to ghosting on the second one.

Also, unlike the TLC5940, the DM63x drivers do not have any BLANK or reset pin to make some brute force turning off/synchronizing. That’s the main reason I prefer to drive both cathodes and anodes off the LED drivers, so that they can be synched at least on a single chip. That and me wanting to keep as much microcontroller pins free as possible.

 

The Solution

Enter the GCK pin of the DM63x. It can be used as an external frequency input so that it is possible to make sure all the chips are synchronized, and also to make the cycles as short as possible (because now I can count exactly the length of the PWM cycle and then make the switch).

The downside is obvious: two timers are taken up, so basically the microcontroller possibilities are greatly reduced; also, the PWM frequency drops down to 8MHz (16MHz of Atmega328 / 2). Still, 8MHz in 12-bit mode means 122KHz of refresh rate in the 16×4 matrix, so it’s pretty good. In fact, theoretically you can drive even more RGB LEDs (like 160 in a 32×5 matrix) with a single DM633 if you are content with 60Hz refresh rate, but that will take even more pins of the microcontroller and will get rather ugly. Maybe I will test this at some later date (not 160, but at least 128).

I will post the code to the GitHub once I clean it a bit. Or once I make a library out of it.

 

The Conclusion

It is possible to multiplex DM63x chips, especially the 12-bit ones. Since they are not very well known and documented, I guess this is useful.

For me, multiplexing is just an interesting experiment. The devices I make do not require it: it is better to use three LED drivers instead if you don’t need a big shiny multicolored wall. Still, a good thing to know it works; widens the possibilities somewhat.

I like the fact that it is possible to still use internal PWM while multiplexing. I may even make some 4×4 RGB LED boards to this end. After all, in this mode, it will take only one Atmega328 timer for the ISR, not two.

PS. If you are in need of a quick fix for an 8×8 RGB LED matrix, feel free to contact me, I have some excess boards lying around.

Leave a comment

Your email address will not be published. Required fields are marked *