Chat here about code rewrites, mods, etc... with respect to the github project

Moderator: igrr

User avatar
By h4rm0n1c
#22592 Hello,

I've tried porting the DMD2 Library for the Freetronics DMD, which is an LED Dot Matrix Display, I thought it would be cool to make wifi enabled dot matrix displays with minimal parts count and cost, hence my attraction to the ESP8266.

It uses a number of gpio pins and the spi bus's MOSI and clock signal to control a number of 7400 series shift registers, which are connected to an array of LEDs in a 32 x 16 matrix.

Unfortunately I'm not experienced enough to do this code port successfully, I've tried a lot of fiddling around with this over the last few days but I'm kind of at a loss as to what to do now, I've hit a wall, it's giving me a headache, I'm just not knowledgeable enough.

I'll post link to code, please feel free to do as you please with this, I'm not getting anywhere with this any time soon:

I'm not even sure if the pins I'm using are able to be used as I wish, I fear that I may be causing some kind of conflict by using the "wrong" pins, is it ok to use only half of the HSPI pins as actual SPI pins whilst using the ones I don't need as GPIO?

a = GPIO16 (row selector a)
b = gpio12 (row selector b)
sck = gpio15 (latches the shift registers to display)
clk = gpio14 (HSPICLK)
r = gpio13 (MOSI)
noe = gpio0 (screen on or off, can be pwmed for brightness control)

These pins are all connected to a level shifter, with some slightly stronger pullups/pulldowns on the ESP8266's startup mode gpios to counter the level shifter's allegedly "smart" pullup/pulldown resistors. (the shifter is a TXS0108E).

I was hoping to avoid using gpio4 and 5 so I can use i2c at some point.

I have a mega that I've rigged as a cheap logic analyser, all I seem to be getting from this code at the moment is a square wave on either gpio12 or gpio0 and nothing else, this results in garbage on the display.

I've gotten this working now, leaving this here for posterity. Scroll down for updates.
Last edited by h4rm0n1c on Thu Jul 09, 2015 4:51 pm, edited 1 time in total.
User avatar
By h4rm0n1c
#22863 Ok, I've been looking VERY closely at the SPI library, SPI.cpp, learning a little about the registers, some other projects online have helped with my understanding of this, along with some forum posts here.

As far as I can tell, it enables duplex mode by default, meaning the spi register is expecting data in too, correct?

If this is true, and I'm trying to re use gpio12 as an output, whilst the SPI library is configuring the ESP to use duplex mode, I imagine it wouldn't be too happy with that contradiction, would it?

I'm going to try changing the line in SPI.cpp (around line 50, function SPIClass::begin()):
Code: Select allSPI1U = SPIUMOSI;

Apparently this is all that is required to put SPI in simplex mode, I know, I could probably use some dummy spi read() calls, but this way I also get the use of gpio12.

If this works, I might make some changes to allow for selection of simplex and duplex mode and make a pull request to the main project, assuming that is welcomed.
Last edited by h4rm0n1c on Thu Jul 09, 2015 4:53 pm, edited 1 time in total.