adafruit / Adafruit_Blinka

Add CircuitPython hardware API and libraries to MicroPython & CPython devices
https://learn.adafruit.com/circuitpython-on-raspberrypi-linux
MIT License
439 stars 328 forks source link

AML-S905X-CC - SPI Issues : SPI1_SCLK = GPIO223 not GPIO290 ?? #654

Closed Iainrach closed 10 months ago

Iainrach commented 1 year ago

I'm attempting to run the Max 7219 custom matrix example from : -

https://github.com/adafruit/Adafruit_CircuitPython_MAX7219/tree/1.5.9/examples and the program is stock apart from cs = digitalio.DigitalInOut(board.P29)

and get the following error : -

%Run BlinkaMax7219.py Traceback (most recent call last): File "/home/pi/Iain/BlinkaMax7219.py", line 11, in spi = board.SPI() File "/usr/local/lib/python3.9/dist-packages/board.py", line 359, in SPI return busio.SPI(SCLK, MOSI, MISO) File "/usr/local/lib/python3.9/dist-packages/busio.py", line 295, in init for portId, portSck, portMosi, portMiso in spiPorts: TypeError: cannot unpack non-iterable int object

I have SPI enabled : - pi@PotatoPi2:~/Iain $ ls /dev/spi* /dev/spidev0.0

and Matrix on the Le Potato operates fine using luma.led_matrix

I'm pretty sure the pin mapping should be SPI1_SCLK = GPIO290 ?? in the file below not GPIO223 but it doesn't fix the error above.

https://github.com/adafruit/Adafruit_Blinka/blob/main/src/adafruit_blinka/microcontroller/amlogic/s905x/pin.py

i2c and digitalio work perfectly on the Le Potato under Blinka but not the SPI interface ? Code seems pretty standard for different boards so I can't see what the problem is ??

......................................................And a little later on in pin.py added square brackets to spiPorts

SPI0_SCLK = GPIO290 SPI0_MISO = GPIO288 SPI0_MOSI = GPIO287 SPI0_CS = GPIO289

i2cPorts = ( (0, I2C0_SCK, I2C0_SDA), (1, I2C1_SCK, I2C1_SDA), )

spiPorts = [(0, SPI0_SCLK, SPI0_MOSI, SPI0_MISO)]


in aml_s905x_cc_v1.py

SCLK = pin.SPI0_SCLK MOSI = pin.SPI0_MOSI MISO = pin.SPI0_MISO SPI_CS = pin.SPI0_CS

and we have some flashing lights.

makermelissa commented 1 year ago

Awesome, would you like to submit a Pull Request with the correct pin numbers and we can take a look?

makermelissa commented 10 months ago

Fixed by #655.