Xinyuan-LilyGO/T-Dongle-S3

apa102 module not implemented in firmware - potential fix

Xendi opened this issue · 6 comments

Xendi commented

apa102 module is not available in firmware.

Uploading a generic Dotstar driver (https://github.com/RobertJBabb/micropython_generic_apa102/blob/master/generic_dotstar.py) allows the LED to be accessed easily like so:

import time
from generic_dotstar import SpiDotStar as SPIDotStar
from machine import SPI, Pin

clock = Pin(39)
data = Pin(40)
num_pixels = 1

print('Testing MicroPython 1.10 SPI DotStar Compatibility Class')

spi = SPI(2, sck=clock, mosi=data, baudrate=1000000)
pixelp = SPIDotStar(spi, num_pixels)
pixelp[0] = (0, 255, 0)
pixelp.show()
r, g, b = pixelp[0]
time.sleep(2)
pixelp.deinit()

Best not to use the HW SPI as it is also defined in tft_config.py for use with st7735. Better to use SoftSPI instead.

Maybe this SPI is already occupied by the screen. Modifying the SPI index number may solve it.

I did try using the other SPIs.
but two of them are used by the board (for flash/mem IIRC) the other one returned with an 'invalid configuration' no matter what I tried.

could you provide a working example using one of the other HW SPIs ?

SPI0 has been occupied by flash, you can use SPI1 or SPI2 or directly use the ready-made driver library
https://github.com/Xinyuan-LilyGO/T-Dongle-S3/tree/main/lib/FastLED

Ah yes, FastLED, but I'm using micropython.

I can't get SPI1 to work though, it returns with invalid configuration...

Thank you for the hint. I use SoftSPI with MISO=37 and everything works fine at the same time with a display.