sipeed / MaixPy-v1_scripts

micropython scripts for MaixPy
https://maixpy.sipeed.com
MIT License
628 stars 432 forks source link

Maixduino SPI connection #63

Open nnn112358 opened 4 years ago

nnn112358 commented 4 years ago

The example of SPI is not communication on maixduino. https://github.com/sipeed/MaixPy_scripts/blob/master/hardware/demo_spi.py

Maixduino communication is follow,

K210-IO Function ESP32-IO Function
IO25 SPI_CS IO5 SPI_CS
IO26 SPI_MISO IO23 SPI0_MISO
IO27 SPI_SCLK IO18 SPI0_SCLK
IO28 SPI_MOSI IO14 SPI0_MOSI
IO09 GPIO IO25 ESP32_READY
IO08 GPIO Dedicated pin ESP32_EN

fm.register(25,fm.fpioa.SPI1_SS0)#cs fm.register(28,fm.fpioa.SPI1_D0)#mosi fm.register(26,fm.fpioa.SPI1_D1)#miso fm.register(27,fm.fpioa.SPI1_SCLK)#sclk spi01=SPI(SPI.SPI1,mode=SPI.MODE_MASTER,baudrate=10000000,polarity=0,phase=0,bits=8,firstbit=SPI.MSB,mosi=fm.fpioa.SPI1_D0,miso=fm.fpioa.SPI1_D1,sck=fm.fpioa.SPI1_SCLK,cs0=fm.fpioa.SPI1_SS0)

https://docid81hrs3j1.cloudfront.net/medialibrary/2019/07/Sipeed_Maixduino_Specifications_EN_V1.0.pdf

Neutree commented 4 years ago

direct use pin as parameters and try again ?

like:

spi1 = SPI(SPI.SPI1, mode=SPI.MODE_MASTER, baudrate=10000000, polarity=0, phase=0, bits=8, firstbit=SPI.MSB, sck=28, mosi=29, miso=30, cs0=27)