Hi Prelude On 1/10/23, prelude <wgz_z...@163.com> wrote: > I have now turned on the debug option, started the development board and > reported the following error: > > k210_sdinitialize: Initializing bit bang SPI for the MMC/SD slot > spi_setmode: mode=0 > k210_sdinitialize: Successfully initialized bit bang SPI for the MMC/SD slot > k210_sdinitialize: Binding bit bang SPI device to MMC/SD slot 0 > spi_lock: lock=1 > spi_setmode: mode=0 > spi_setmode: mode=0 exchange=0x8000f2a4 > spi_setbits: nbits=8 > spi_setfrequency: frequency=400000 holdtime=55 actual=401445 > spi_setfrequency: frequency=400000 holdtime=55 actual=401445 > mmcsd_mediainitialize: Send CMD0 > spi_select: devid=65536 selected=1 > mmcsd_sendcmd: ERROR: Failed: i=9 response=ff > spi_select: devid=65536 selected=0 > mmcsd_mediainitialize: Send CMD0 > spi_select: devid=65536 selected=1 > mmcsd_sendcmd: ERROR: Failed: i=9 response=ff > spi_select: devid=65536 selected=0 > mmcsd_mediainitialize: ERROR: Send CMD0 failed: R1=ffffffff > spi_select: devid=65536 selected=0 > spi_lock: lock=0 > spi_lock: lock=0 > k210_sdinitialize: Successfully bound bit bang SPI device to MMC/SD slot 0 > > I created a new k210_mmcsd.c file with reference to the sam_mmcsd.c file, > defined the spi_select, spi_status, and spi_cmddata functions in the file, > and defined the k210_mmcsd_spiinitialize function to configure and > initialize GPIO, and finally defined the k210_sdinitialize function, and > called k210_sdinitialize in the k210_bringup function.
It is working? The first error shows that SPI is returning an invalid value: mmcsd_sendcmd: ERROR: Failed: i=9 response=ff Maybe it is worth add native SPI support to K210 instead using bitbang SPI driver. BR, Alan