I’m trying to pair my new Spark with a Freetronics Dot Matrix Display: http://www.freetronics.com/products/dot-matrix-display-32x16-red which requires porting the library (online here: https://github.com/freetronics/DMD2). I didn’t realize it would be so difficult, but shows what I know! I’ve been playing around in the online compiler, trying to get it to even verify. Right now it seems the hardest part is dealing with SPI. The compiler is currently choking on this code in DMD2.cpp:
I’m hoping someone with more experience than me can help with the steps needed to get this to work with Spark - from reading around it seems that the direct pin manipulation should be replaced with digitalWrite() commands, but I have know idea where to start.
archimag0, I am reviewing the code and I need to know if you wish to use hardware SPI instead of the software SPI? Are you trying to run a specific example that I can look at?
Hi peekay123; at this point I’m just trying to get the examples ( https://github.com/freetronics/DMD2/tree/master/examples ) to run to see that it actually works - once I have those going I plan to start developing my own project. What would the advantages/disadvantages be to hardware vs software?
Ok, so it seems all the examples use “SoftDMD” which is the software SPI. I will switch the examples to hardware SPI and port the library to the Spark so you can test. Stay tuned!
@archimag0, I have the library ported and compiling. I find parts to be “sloppy” but I believe we can get it working. I have to go over a couple of items and I will post it on my github later so you can test it.
UPDATE: I posted the (untested) library on my github. I used the Spark CLI to compile it as a single folder. Easy Peasy.
Things to know: I setup the example to use hadware SPI. The pins connect as follows:
Spark DMD
A5 R (MOSI)
A3 CLK (SCK)
A0 nOE (A0 supports PWM for brightness other than 255)
D4 A
D3 B
D2 SCK
The SPI clock is set to 4.5MHz. Let me know how it goes!
It’s a start! The library is setup to NOT use the hardware timer. Perhaps this is the problem. I may need to put a logic analyzer on the outputs to see what it’s doing. It just means more work
I also just realized that this DMD library is version 2 of the original library here, https://github.com/freetronics/DMD - perhaps the older version will provide some clues?
DMD2 is in beta so that may be an issue. @archimag0 did you check your wiring against the pins I set the defaults to? I will look at porting the older library and perhaps we can go from there. Stand by
UPDATE: I have the DMD library ported (using the IntervalTimer library to boot!). I will have it on github in the morning… I need sleep!
!!! NOTE: DMD reads the default SPI CS pin (A2) to see if another device is using the SPI bus. If the value read is not HIGH, the DMD will NOT refresh. This may need to be modified or the CS pin pulled HIGH for the code to function correctly. Keep me posted!
I just tested the DMD1 library and I get the same result. Hmm…
EDIT: Not sure if this is relevant, but I was playing with the wiring to see if that had anything to do with it, and if I pull the A and B wires and start playing with them it makes different LEDs light up. Something is happening…
@archimag0, I just realized that these are 5V displays! You will need to use level shifters (3.3v to 5V) between the Spark and the Freetronics unit. Are you using level shifters?