TM1638 Display Driver for Stellaris Launchpad
October 11, 2012 19 Comments
Here I am, roughly 3 months after my last post…
Ok, ok, the video isn’t very interesting I have to admit… but this is because this post is not about some nice looking IKEA lamp that changes colours remotely (and made me famous in Germany for some reason 🙂 ) but about my first attempt at writing an actual library / driver for a nice little display board.
Another first is that I won’t be pasting my code here as I usually do, as this whole thing is intended to be re-used and improved.
So you can find it all here:
2 things are worth noticing on the hardware side:
- the TM1638 board is normally 5V but seems to be happily running on the 3.3V provided by the TI board
- beyond GND and VCC, you only need 3 wires, CLK, DATA (both input and output, you’ll notice in the code that we change the way of the pin) and STROBE.
It’s really simple to connect the 2 boards, you just connect these 5 wires together, with no other electronics parts. They also both seem to be happily running from my laptop’s USB port, which makes for a very quick and easy set up!
It’s already quite late and I need to go to bed before my son does his 3am wake up routine, so I’ll keep it brief… however, I can’t end without thanking the 2 guys that wrote similar libraries which I used as inspiration:
- Ricardo Batista that wrote the Arduino library http://code.google.com/p/tm1638-library/
- Evgeniy Chepelev that wrote a similar library for the MSP430 http://sourceforge.net/projects/msp430-tm1638/
I initially wanted to go down Evgeniy’s way and use the hardware SPI/SSI (there are 4 of them on the Stellaris Launchpad) as it felt like a shame to bit bang the communication when there’s specialised hardware available.
However, here are a few drawbacks:
- all the SSI configuration made the library less flexible (could not specify whatever pins you wanted)
- had to use 4 wires instead of 3
- had to use an extra 2 diodes and 1 resistor
- never really understood what the FSS pin in the SSI configuration was for…:)
And ultimately I had issues with making it work… which is an euphemist for “it was NOT working”…:)
So I decided to go gown Ricardo’s way, which to be honest works perfectly well !
If you guys have the necessary boards, please give it a try and let me know ! As usual, any feedback is welcome.