I want to drive/multiplex a given LED matrix using the ESP8266. I obviously don't want to bitbang in software, so I'm seeking your help to decide on what hardware features of the ESP8266 might be used and if it is even possible to drive the LED matrix with the ESP (while using its CPU for a nice Web-GUI ;))
The LED matrix basically has four input pins. A serial input with clock (SCK) and data (SDA), a latch input (RCK) and an input to turn the LEDs of the selected row on (LED).
The matrix has 18 rows, 288 LEDs each, controlled via shift registers. The row is selected by the last byte I shift into the registers, so I have to send 36+1 bytes of data for each row, latch the input and flash the LEDs.
The serial clock should be around 4MHz at least. Latch is on falling edge. LEDs should pulse HIGH for about 6µs and everything should repeat with about 10 kHz, cycling through the 18 rows
It is very important that the LED pin never is HIGH for a longer period or the LEDs might geht damaged, so I want to manage that in hardware too....
I'm pretty new to hardware programming. I successfully drove the LED matrix with an Atmega328P using SPI and a timer interrupt (RCK/LED done in software within the timer interrupt).
What hardware would you use to implement that?
The ESP8266 has SPI (HSPI?), I2S and UART available, right? I've done some research on the hardware available, but I don't know much about their limitations and configuration options so far. I hope you can help with that.
Would you use a timer (I've gotten different information about the esp having hardware timers or not...) for the 10kHz base interval? Or maybe use the I2S interface with a DMA loop (I've read somewhere this can be done?) to generate the LED puls with a 10kHz interval and fire an interrupt? At 2 MHz I could adjust the LED pulse width in 0.5µs increments and only need 25 bytes of ram for the whole interval.
I guess I can fire an interrupt on each I2S loop to initiate the SPI hardware to send a data row for the matrix to display?
I'm using a WeMos D1 mini and Arduino IDE / Visual Studio (with Arduino IDE plugin) most of the time because of the libraries available.
One problem might be that the I2S data pin is also the UART RX pin, right? So I won't be able to drive the matrix while the USB is plugged in AND I would also have to disconnect the matrix while programming via USB/UART, or the LED pin might get driven HIGH for too long ... Is that right? Any Ideas for that?
Thx for your help/ideas :)