rp2-sd-driver #9

Merged
matthias merged 3 commits from rp2-sd-driver into main 2025-03-10 19:16:28 +00:00
Owner

The builtin micropython SD card driver using the default micropython SPI
implementation suffered from very low read speeds. Add an optimized SD
card driver using rp2 PIO and DMA. Currently read only, write support to
be added later.

The builtin micropython SD card driver using the default micropython SPI implementation suffered from very low read speeds. Add an optimized SD card driver using rp2 PIO and DMA. Currently read only, write support to be added later.
matthias self-assigned this 2025-02-18 21:03:37 +00:00
matthias added 2 commits 2025-02-18 21:03:38 +00:00
The builtin micropython SD card driver using the default micropython SPI
implementation suffered from very low read speeds. Add an optimized SD
card driver using rp2 PIO and DMA. Currently read only, write support to
be added later.

Signed-off-by: Matthias Blankertz <matthias@blankertz.org>
test.py: Update to use rp2_sd module
All checks were successful
Check code formatting / Check-C-Format (push) Successful in 6s
Check code formatting / Check-Python-Flake8 (push) Successful in 9s
Check code formatting / Check-Bash-Shellcheck (push) Successful in 5s
Run unit tests on host / Run-Unit-Tests (push) Successful in 8s
18332475e5
Signed-off-by: Matthias Blankertz <matthias@blankertz.org>
matthias requested review from stefank 2025-02-18 21:03:39 +00:00
stefank approved these changes 2025-03-04 19:04:47 +00:00
@@ -0,0 +67,4 @@
mp_buffer_info_t bufinfo;
if (!mp_get_buffer(buf_obj, &bufinfo, MP_BUFFER_WRITE))
mp_raise_ValueError("Not a write buffer");
if (bufinfo.len % 512 != 0)
Member

Maybe introduce a constant SD_SECTIR_SIZE?

Maybe introduce a constant SD_SECTIR_SIZE?
matthias marked this conversation as resolved
@@ -0,0 +61,4 @@
static bool sd_send_op_cond(void)
{
uint8_t buf[1];
Member

Just 'uint8_t buf;' for consistency?

Just 'uint8_t buf;' for consistency?
matthias marked this conversation as resolved
matthias added 1 commit 2025-03-10 19:14:44 +00:00
rp2_sd: Cleanup and fixes
All checks were successful
Check code formatting / Check-C-Format (push) Successful in 6s
Check code formatting / Check-Python-Flake8 (push) Successful in 8s
Check code formatting / Check-Bash-Shellcheck (push) Successful in 5s
Run unit tests on host / Run-Unit-Tests (push) Successful in 8s
0d37001323
- Use SD_SECTOR_SIZE define instead of magic number 512
- Replace uint8_t buf[1] with plain uint8_t
- Check sd_spi_read_dma precondition that sd_dma_context state has to be
  DMA_IDLE explicitly and return false instead of relying on assert
- sd_spi_dma_isr is time critical
matthias force-pushed rp2-sd-driver from 0d37001323 to 98ecca0d09 2025-03-10 19:15:13 +00:00 Compare
matthias merged commit e07e42b9dc into main 2025-03-10 19:16:28 +00:00
matthias deleted branch rp2-sd-driver 2025-03-10 19:16:28 +00:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: TonBERRY/tonberry-pico#9