inkfish / lander-control

0 stars 0 forks source link

Bringup: SD card #9

Closed rgov closed 8 months ago

rgov commented 9 months ago
Function Pin
SPI1_RX (MISO) GP12
SPI1_CSn GP13
SPI1_SCK GP14
SPI1_TX (MOSI) GP15

MicroPython sdcard module

rgov commented 9 months ago

I have this working with the Adafruit breakout board+ (schematic), which additionally includes a CD74HC4050 IC to level shift the logic from 5V to 3.3V. This shouldn't be necessary on our board.

rgov commented 9 months ago

According to GPT4, writing to an SD card incurs 11 bytes of overhead per 512 bytes of data. Thus transferring 1 MB of data requires 8*1024*1024*(512+11)/512 = 8568832 bits.

This post says the bus should start at 400 kHz and then can later speed up to 25 MHz. This post mentions that the maximum speed (per the RP2040 data sheet) is 62.5 MHz.

At 25 MHz then we should be able to transfer 1 MB in 0.34s (2.94 MB/s). Which is to say, we should probably be able to just stream data directly to the SD card.

rgov commented 9 months ago

There's also a CircuitPython module from Adafruit.

rgov commented 8 months ago

In real life at 25 MHz:

Read (MB/s) Write (MB/s)
Direct (256 blocks) 1.91 1.88
FAT32 1.90 1.75