I recently found this function in the STM32Cube stm32f4xx_hal_sd.c file.
Code: Select all
/**
* @brief Switches the SD card to High Speed mode.
* This API must be used after "Transfer State"
* @note This operation should be followed by the configuration
* of PLL to have SDIOCK clock between 67 and 75 MHz
* @param hsd: SD handle
* @retval SD Card error state
*/
HAL_SD_ErrorTypedef HAL_SD_HighSpeed (SD_HandleTypeDef *hsd)
I can't find documentation about using STM32 with high speed SD cards so I just tried the ChibiOS 3.0 testhal SDC program.
I used a high speed microSD 16 GB card and tried different PLLQ values. I used a 32KB transfer size for multiple blocks.
Here is PLLQ = 7, the standard value that results in a 24 MHz clock at the SD card.
Connecting... OK
Card Info
CSD : 400E0032 5B590000 76B27F80 0A404012
CID : 03534453 4C313647 80254343 FC00E4AA
Mode : 11, SDV20
Capacity : 15193MB
Single block aligned read performance: 6392 blocks/S, 3272704 bytes/S
64 sequential blocks aligned read performance: 21760 blocks/S, 11141120 bytes/S
Single block unaligned read performance: 6407 blocks/S, 3280384 bytes/S
64 sequential blocks unaligned read performance: 6400 blocks/S, 3276800 bytes/S
Here is PLLQ = 5, for 33.6 MHz at the SD card.
Connecting... OK
Card Info
CSD : 400E0032 5B590000 76B27F80 0A404012
CID : 03534453 4C313647 80254343 FC00E4AA
Mode : 11, SDV20
Capacity : 15193MB
Single block aligned read performance: 6947 blocks/S, 3556864 bytes/S
64 sequential blocks aligned read performance: 29952 blocks/S, 15335424 bytes/S
Single block unaligned read performance: 6960 blocks/S, 3563520 bytes/S
64 sequential blocks unaligned read performance: 6976 blocks/S, 3571712 bytes/S
Finally I tried PLLQ = 4, for 42 MHz at the SD card. This is above the range of 67 to 75 MHz.
Connecting... OK
Card Info
CSD : 400E0032 5B590000 76B27F80 0A404012
CID : 03534453 4C313647 80254343 FC00E4AA
Mode : 11, SDV20
Capacity : 15193MB
Single block aligned read performance: 7270 blocks/S, 3722240 bytes/S
64 sequential blocks aligned read performance: 36928 blocks/S, 18907136 bytes/S
Single block unaligned read performance: 7277 blocks/S, 3725824 bytes/S
64 sequential blocks unaligned read performance: 7296 blocks/S, 3735552 bytes/S
The multiple block read speed is great. I will soon be trying this in a new C++ FAT library that I wrote. It is a follow on to the SdFat library I wrote for Arduino but is generic like FATFS.