AnsweredAssumed Answered

SDHC configuration in MCUXpresso config tools

Question asked by Simon Haines on Oct 24, 2018
Latest reply on Nov 5, 2018 by Alice_Yang

I think there might be a couple of issues with the MCUXpresso config tools around the SDHC in the K64 (my project uses the part MK64FN1M0VLQ12).


Firstly, the Clocks tool does not allow a SDHC source clock greater than 50MHz (SDHCSRCSEL), generating the error "Input frequency must be lower than or equal to: 50 MHz". The SDHC has a pre-scaler and divider that handle source clocks faster than 50MHz, and these are correctly configured by the SDK function SDHC_SetSdClock. Even the SDK example 'frdmk64f_fatfs_sdcard' uses the system/core clock at 120MHz as input to the SDHC.


Secondly, the Pins tool does not completely configure the SDHC pins which need (at least) a fast slew rate to handle high signal frequencies, and possibly a high drive strength for some SD cards. Compare the code generated by the Pins tool for the SDHC pins:

/* PORTE0 (pin 1) is configured as SDHC0_D1 */
PORT_SetPinMux(PORTE, 0U, kPORT_MuxAlt4);

with the code used by the SDK example 'frdmk64f_fatfs_sdcard':

const port_pin_config_t porte0_pin1_config = {
kPORT_PullUp, /* Internal pull-up resistor is enabled */
kPORT_FastSlewRate, /* Fast slew rate is configured */
kPORT_PassiveFilterDisable, /* Passive filter is disabled */
kPORT_OpenDrainDisable, /* Open drain is disabled */
kPORT_HighDriveStrength, /* High drive strength is configured */
kPORT_MuxAlt4, /* Pin is configured as SDHC0_D1 */
kPORT_UnlockRegister /* Pin Control Register fields [15:0] are not locked */
PORT_SetPinConfig(PORTE, PIN0_IDX, &porte0_pin1_config); /* PORTE0 (pin 1) is configured as SDHC0_D1 */

This is the same for all SDHC pins.