Skip to main content
Visitor II
November 8, 2023
Question

Configuring SDcard interface voltage compatibility in stm32mp157f-evl

  • November 8, 2023
  • 9 replies
  • 4882 views

Hello,

I need to change the SD card interface voltage on stm32mp157f-evl board.

As per my understanding we can control this via uSD_LDO_SEL, it can be 2.9volts or 1.8 volts.

I need to change to 1.8 volts, how can one control this one via software?

Warm regards,

S

    This topic has been closed for replies.

    9 replies

    Super User
    November 8, 2023

    well i am not the professional to teach you about stm32mp157f and sd-card --- but afaik :

    sd-card always start communication in standard mode (at 3v3 vdd), then - if card allows this - is speed switched to uhs mode (at 1v8 then) and needs to switch supply to card to do this (special hi-speed driver / vdd power switch needed for this). look in ds of cpu/mpu , look at circuit stm32mp157f-evl , how this should work.

    from H743 ds (what i use)

    AScha3_0-1699465028730.png

    AScha3_1-1699465114555.png

     

    Technical Moderator
    November 9, 2023

    HI @Sean_62 ,

    System configuration provided with STM32MP157F-EV1 Starter Package together with Linux driver will make this for you if during SD-Card negotiation it detect a suitable mode requiring 1.8V I/Os (e.g. UHS-I in DDR50 mode)

    Maybe look at https://wiki.st.com/stm32mpu/wiki/SDMMC_device_tree_configuration

    For STM32MP157F-EV1, the uSD_LDO_SEL signal is controlled by GPIOF14 (defined in Linux as external regulator controlled by GPIO).
    https://github.com/STMicroelectronics/u-boot/blob/v2022.10-stm32mp/arch/arm/dts/stm32mp157f-ed1.dts#L98

    this regulator is tied to SDMMC1 IO voltage (and then managed by driver when needed)

    https://github.com/STMicroelectronics/u-boot/blob/v2022.10-stm32mp/arch/arm/dts/stm32mp157f-ed1.dts#L382

    Note that switching SD-Card IOs to 1.8V (SD-Card supply is always 3.3V) requires a very specific sequence to avoid voltage conflicts. This is defined in SD-Card standard.

    Regards.

    Sean_62Author
    Visitor II
    November 9, 2023

    Hi @PatrickF ,

    Thanks for your feedback, that was really helpful. I have more doubts about SD card interface on this evaluation board.

    1. As per UM2468, SD card interface supports 2.9Volts or 1.8 Volts. Can we use a SDIO device supporting 3.3Volts as well?  

    2. When I try to connect the device to the board I get following kernel logs, can some help us what could be wrong here?
    [ 197.573867] mmc0: error -84 whilst initialising SDIO card
    [ 198.661464] mmc0: Card stuck being busy! __mmc_poll_for_busy
    [ 198.702975] mmci-pl18x 58005000.mmc: card claims to support voltages below defined range
    [ 198.729900] mmc0: error -84 whilst initialising SDIO card
    [ 199.811495] mmc0: Card stuck being busy! __mmc_poll_for_busy

    Warm regards,

    S

    Sean_62Author
    Visitor II
    November 9, 2023

    When I connect the device with 3.3 volt support, I get following logs -

    [ 203.938400] mmci-pl18x 58005000.mmc: card claims to support voltages below
    defined range
    [ 203.964374] mmc0: error -84 whilst initialising SDIO card
    [ 203.969746] mmci-pl18x 58005000.mmc: card claims to support voltages below
    defined range
    [ 204.031577] mmc0: error -84 whilst initialising MMC card

    Above logs are for 1.8volts device.

    Regards,

    Technical Moderator
    November 9, 2023

    Hi,

    Starter package and boards HW are built to support SD-Card on SDMMC1.
    SDIO usually have a fixed IO voltage and the board HW is done for that.
    SDMMC2 used for WLAN chip on STM32MP157F-DK2 is an example of SDIO.

     

    I understand you are trying to plug an SDIO device on the SD-Card slot of STM32MP157F-EV1 board ?
    This is not supported with Starter Package and certainly requiring some change on the Device Tree which mean you have to build your own customized Flash image and maybe few HW modifications (or use SDMMC3 which is available on a connector of EV1 motherboard).

    Regards.

    Sean_62Author
    Visitor II
    November 9, 2023

    Hi @PatrickF ,

    Yes I am trying to plug in the SDIO device on the SD-Card slot of STM32MP157F-EV1 board, what kind of hardware changes and device tree? And I am using STM32MP15X-EVAL board, I did not find the SDMMC3 connector on the board. Do I need to use some other board for that?

    Regards,

    S

    Sean_62Author
    Visitor II
    November 9, 2023

    Hi @PatrickF ,

    I checked the schematics and SDMMC3 is available only on a GPIO expansion connector. Can we use an external expansion board, if yes which board will be suitable for this purpose?

    Warm regards,

    S

    Technical Moderator
    November 10, 2023

    Hi,

    Regarding SDIO support on existing SD-Card slot, I can't help you as I'm not SW expert.

    Start to have a look to https://wiki.st.com/stm32mpu/wiki/Main_Page.

    I fear there is no 'out of the box' board for SDMMC3 on GPIO expansion. You should likely prototype something using manual wiring (with all the restriction regarding high-speed signal integrity).
    Maybe look also at RPi HAT boards as the 'GPIO' expansion is somewhat compliant (need to carefully check if suitable signals are going to right position).

    But in all cases, rebuilding an image suitable to your HW needs is a must.

    Regards.

    Sean_62Author
    Visitor II
    November 14, 2023

    Hi,

    Based on the suggestion above I did modified the device tree and connected my SDIO peripheral and I am still getting the same error. Following is my device tree patch looks like -
    &sdmmc3 {
    broken-cd;
    st,neg-edge;
    bus-width = <4>;
    + non-removable;
    vmmc-supply = <&v3v3>;
    - status = "disabled";
    + status = "okay";
    +
    + wlcore: wlcore@0 {
    + compatible = "ti,cc33xx";
    + reg = <2>;
    + /* TODO: Fix the interrupt here */
    + /*interrupt-parent = <&gpio0>;
    + interrupts = <7 IRQ_TYPE_LEVEL_HIGH>;
    + irq-gpio = <&gpio0 7 GPIO_ACTIVE_HIGH>;*/
    + };
    +
    };

    Regards,

    S

    Sean_62Author
    Visitor II
    November 15, 2023

    For more information I have looked into more and I find that function "mmc_sdio_init_card" failes. Here "mmc_send_io_op_cond" is successful but function "mmc_io_rw_direct_host" fails.

    -S