SD Card Logical Blocks

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SD Card Logical Blocks

373 Views
audim
Contributor I

I am working with...
MCUXpresso IDE v24.9 [Build 25][2024-09-26]
FreeRTOS Kernel V10.3.0
SDK 2.9.0
K64 processor

I have setup my SDHC something like this...

// global variables
static sd_card_t g_sdCard;
SDK_ALIGN(uint8_t g_dataBuf[DATA_BUFFER_SIZE], BOARD_SDMMC_DATA_BUFFER_ALIGN_SIZE);

// configure SD card descriptor, include card detect ISR
BOARD_SD_Config(&g_sdCard, isr_SDHC_CD, BOARD_SDMMC_SD_HOST_IRQ_PRIORITY, NULL);
SD_HostInit(&g_sdCard);
SD_SetCardPower(&g_sdCard, false);
SD_SetCardPower(&g_sdCard, true);
SD_CardInit(&g_sdCard);

To read block 0, I issue the following command...
SD_ReadBlocks(&g_sdCard, g_dataBuf, 0U, 1U);

Unfortunately, this is returning data from the physical block, not the logical block.

I don't care which physical block the Flash controller in the SD card is using to store my data.
When I say I need "block 0," I need the data in logical block 0.

How do I read logical blocks from an SD card?

0 Kudos
Reply
1 Reply

331 Views
Habib_MS
NXP Employee
NXP Employee

Hello @audim,

I will ask internally if there is any recommendation for using logic blocks. However, this API is propably not currently implemented. In that case, the application will implement itself.

BR
Habib

0 Kudos
Reply