Skip to content

Commit 95d1e92

Browse files
committed
mimxrt/sdcard: Add polling mode with scheduler yields.
Add MICROPY_HW_SDCARD_POLLING mode that uses DMA transfers with register polling instead of interrupts. This avoids cache coherency issues seen with interrupt-based transfers when SDRAM is disabled. The polling loops call mp_event_handle_nowait() to allow the MicroPython scheduler to run background tasks during SD card operations. Three transfer modes are now available: - Default: SDK's USDHC_TransferBlocking with Data0 ready polling - MICROPY_HW_SDCARD_NONBLOCKING=1: Interrupt-based (has cache issues) - MICROPY_HW_SDCARD_POLLING=1: DMA with polled status flags
1 parent 6234090 commit 95d1e92

File tree

3 files changed

+468
-12
lines changed

3 files changed

+468
-12
lines changed

ports/mimxrt/machine_sdcard.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,9 @@ static const mp_rom_map_elem_t sdcard_locals_dict_table[] = {
211211
{ MP_ROM_QSTR(MP_QSTR_readblocks), MP_ROM_PTR(&machine_sdcard_readblocks_obj) },
212212
{ MP_ROM_QSTR(MP_QSTR_writeblocks), MP_ROM_PTR(&machine_sdcard_writeblocks_obj) },
213213
{ MP_ROM_QSTR(MP_QSTR_ioctl), MP_ROM_PTR(&machine_sdcard_ioctl_obj) },
214+
#if !MICROPY_HW_SDCARD_NONBLOCKING && !MICROPY_HW_SDCARD_POLLING
215+
{ MP_ROM_QSTR(MP_QSTR_timing), MP_ROM_PTR(&sdcard_get_timing_stats_obj) },
216+
#endif
214217
};
215218
static MP_DEFINE_CONST_DICT(sdcard_locals_dict, sdcard_locals_dict_table);
216219

0 commit comments

Comments
 (0)