Skip to main content
SChen.11
Associate III
April 24, 2019
Solved

How to change emmc interface

  • April 24, 2019
  • 8 replies
  • 4700 views

Hi everyone,

The stm32mp1 use SDMMC2 as default emmc controller. Now, I need use SDMMC1 to connect emmc flash. And I saw the OTP need changed. Bud I am confuse about IOs of SDMMC1. Does it also need setting some OTP bits to pinmux CK, CMD, D0?

This picture show need change bit to chose SDMMC1.

0690X000008As5SQAS.png

This picture is confused me. When I use SDMMC1, is it need configure CMD, CK,D0 to default pinmux on SDMMC1? If it is needed, where to configure those?

0690X000008As5cQAC.png

Best answer by PatrickF

Hello,

You have already find most information, just missing to set in OTP5-6 the definition of new pins to be used during boot.

In order to use eMMC on SDMMC1 and using (for example) SDMMC1_CK = PC12, SDMMC1_D0 = PC8, SDMMC1_CMD = PD2 pins (only 3 pins used during BootROM first stage of boot), you need to program the following:

  • OTP3 = 0x00080002     disable SD boot, select eMMC_if_id = SDMMC1
  • OTP5 = 0x38C43CC1
    • SDMMC1_CK = PC12 (bits[15:0]: port0=3=GPIOC, pin0=12, afmux0=12, mode0=0=AF;no pull;medium-speed)
    • SDMMC1_D0 = PC8 (bits[31:16]: port1=3=GPIOC, pin1=8, afmux1=12, mode1=4=AF;pull-up;medium-speed)
  • OTP6 = 0x000042C4
    • SDMMC1_CMD = PD2 (bits[15:0]: port2=4=GPIOD, pin2=2, afmux2=12, mode2=4=AF;pull-up;medium-speed)

You should also update devicetree and rebuild all subsequent level of boot to use SDMMC1 interface and pins (including all eMMC data lines pins , as later stages use 8-bit data mode).

Currently only Toshiba eMMC references presents on STM32MP157x_EV1 boards (THGBMNG5D1LBAIL or THGBMDG5D1LBAIL) are validated with STM32MP1 series.

Some links to complete this post:

wiki/STM32MP15_ROM_code_overview#Boot_from_e-E2-80-A2MMC-E2-84-A2

wiki/How_to_cross-compile_with_the_Developer_Package

8 replies

PatrickF
PatrickFBest answer
Technical Moderator
April 26, 2019

Hello,

You have already find most information, just missing to set in OTP5-6 the definition of new pins to be used during boot.

In order to use eMMC on SDMMC1 and using (for example) SDMMC1_CK = PC12, SDMMC1_D0 = PC8, SDMMC1_CMD = PD2 pins (only 3 pins used during BootROM first stage of boot), you need to program the following:

  • OTP3 = 0x00080002     disable SD boot, select eMMC_if_id = SDMMC1
  • OTP5 = 0x38C43CC1
    • SDMMC1_CK = PC12 (bits[15:0]: port0=3=GPIOC, pin0=12, afmux0=12, mode0=0=AF;no pull;medium-speed)
    • SDMMC1_D0 = PC8 (bits[31:16]: port1=3=GPIOC, pin1=8, afmux1=12, mode1=4=AF;pull-up;medium-speed)
  • OTP6 = 0x000042C4
    • SDMMC1_CMD = PD2 (bits[15:0]: port2=4=GPIOD, pin2=2, afmux2=12, mode2=4=AF;pull-up;medium-speed)

You should also update devicetree and rebuild all subsequent level of boot to use SDMMC1 interface and pins (including all eMMC data lines pins , as later stages use 8-bit data mode).

Currently only Toshiba eMMC references presents on STM32MP157x_EV1 boards (THGBMNG5D1LBAIL or THGBMDG5D1LBAIL) are validated with STM32MP1 series.

Some links to complete this post:

wiki/STM32MP15_ROM_code_overview#Boot_from_e-E2-80-A2MMC-E2-84-A2

wiki/How_to_cross-compile_with_the_Developer_Package

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.NEW ! Sidekick STM32 AI agent, see here
Associate II
January 13, 2025

Hi Patrick,

 

I am trying to do a similar this for the stm32mp2x platform. Do you know what the registers and values I would need to to use emmc on sdmmc1?

 

Thanks.

SMich.1
Senior
July 17, 2020

hi, i have some issue with that answer .

i updated the OTP3 , 5, 6 like PAtrik said and my emmc connected to those pins. and i managed to write via stm32Programmer and flash layouts mmc to this emmc so it working but the boot didn't start

what i missed?

PatrickF
Technical Moderator
July 17, 2020

Hello,

Which eMMC reference are you using ?

Which silicon revision are you using ? See datasheet (e.g. DS12505) to see where the revision is located on package marking.

There is a know bug on STM32MP15x silicon Rev.B which avoid some(most) eMMC reference to boot correctly, this is solved in Rev.Z silicon revision.

Meanwhile, as an indication, Toshiba THGBMNG5D1LBAIL, THGBMDG5D1LBAIL, and Kingston EMMC04G-M627-X03U have shown to operate correctly on the STM32MP157C-EV1 board which are using Rev.B silicon.

Rev.Z is in production from some months (there could still be some Rev.B in stock at distributors, so you should ask before placing order).

See ES0438: STM32MP151x/3x/7x device limitations

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.NEW ! Sidekick STM32 AI agent, see here
SMich.1
Senior
July 17, 2020

KLMBG2JENB emmc i using stm32mp153aaa3 rev B

 may be i need to change the pins to no pull ?

PatrickF
Technical Moderator
July 17, 2020

Hello,

As stated above, I fear the issue come from the Samsung eMMC together with the STM32MP1 silicon Rev.B .

There is no workaround except changing the eMMC to a Toshiba or Kingston (recommended reference stated above, but other might work) or much better to latest STM32MP1 silicon Rev.Z.

Changing pin settings will not help, it is a matter of timing response from eMMC.

As an ugly workaround (just to confirm it could fly), issuing a manual NRST_CORE low pulse might work.

This will restart the boot process (without any power cycle nor eMMC reset) and could allow to boot correctly as the eMMC memory might respond faster the second time the boot sector content is requested.

I understand it could be a frustrating issue.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.NEW ! Sidekick STM32 AI agent, see here
SMich.1
Senior
July 17, 2020

can i boot the emmc from UBOOT that i uploaded through usb dfu?

SMich.1
Senior
July 17, 2020

tnx. i will replace the emmc it would be faster.

SMich.1
Senior
July 20, 2020

hey patric we switched the emmc to emmc that in the EV board and the board resets itself all the time. do you have suggestions ?

PatrickF
Technical Moderator
July 20, 2020

Hi, hard to give any clues without more details.

If reboot, I assume there is message on the console UART. Could you share ?

Btw, do you use STPMIC1 ?

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.NEW ! Sidekick STM32 AI agent, see here
SMich.1
Senior
July 20, 2020

on the console i got nothing nothing and yes i use STPMIC1.

with the old eMMC the board jumped to usb boot and flashed the A13 red led . now woth the TOSHIBA eMMC there only resets.

PatrickF
Technical Moderator
July 24, 2020

Hi,

Do you succeed to flash the eMMC using CubeProgrammer and your customized TF-A and uBoot (especially for the interface and pin changes for eMMC) ?

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.NEW ! Sidekick STM32 AI agent, see here
SMich.1
Senior
July 24, 2020

yes, i managed to boot with usb to uboot and then upload the kernel from the emmc to ddr and start linux. everything working except from boot with boot pins from emmc.

We suspect that our PMIC have some issues with power to emmc may be something with power sequence.