2025-04-29 6:34 AM
Hi,
We have a custom carrier board based on STM32MP157DAC. We have built a custom yocto image.
I was able to get a EMMC binaries by adding below line in my local.conf
STM32MP_DT_FILES_EMMC += "stm32mp157f-dk2"
I have also attached the modified flashlayout for EMMC.
I came across a post here saying if default pins are changes we will have to do otp for emmc to be detected.
below are the pins we are using:-
PB14 | SDMMC2_D0 |
PB15 | SDMMC2_D1 |
PB3 | SDMMC2_D2 |
PB4 | SDMMC2_D3 |
PA8 | SDMMC2_D4 |
PA15 | SDMMC2_D5 |
PC6 | SDMMC2_D6 |
PC7 | SDMMC2_D7 |
PE3 | SDMMC2_CLK |
PG6 | SDMMC2_CMD |
Do we need to do otp for these pins or what can be done for EMMC to be detected during dfu(0,0,0) mode for flashing to emmc.
below is my flash layout file for emmc:-
#Opt | Id | Name | Type | IP | Offset | Binary |
- | 0x01 | fsbl-boot | Binary | none | 0x0 | arm-trusted-firmware/tf-a-stm32mp157f-dk2-usb.stm32 |
- | 0x03 | fip-boot | FIP | none | 0x0 | fip/fip-stm32mp157f-dk2-optee-emmc.bin |
P | 0x04 | fsbl1 | Binary | mmc1 | boot1 | arm-trusted-firmware/tf-a-stm32mp157f-dk2-optee-emmc.stm32 |
P | 0x05 | fsbl2 | Binary | mmc1 | boot2 | arm-trusted-firmware/tf-a-stm32mp157f-dk2-optee-emmc.stm32 |
P | 0x06 | metadata1 | FWU_MDATA | mmc1 | 0x00084000 | arm-trusted-firmware/metadata.bin |
P | 0x07 | metadata2 | FWU_MDATA | mmc1 | 0x00100000 | arm-trusted-firmware/metadata.bin |
P | 0x08 | fip-a | FIP | mmc1 | 0x00180000 | fip/fip-stm32mp157f-dk2-optee-emmc.bin |
PED | 0x09 | fip-b | FIP | mmc1 | 0x00580000 | none |
PED | 0x0A | u-boot-env | ENV | mmc1 | 0x00980000 | none |
P | 0x10 | bootfs | System | mmc1 | 0x00A00000 | st-image-bootfs-openstlinux-weston-stm32mp15-disco.ext4 |
P | 0x11 | vendorfs | FileSystem | mmc1 | 0x04A00000 | st-image-vendorfs-openstlinux-weston-stm32mp15-disco.ext4 |
P | 0x12 | rootfs | FileSystem | mmc1 | 0x05A00000 | st-image-qt-openstlinux-weston-stm32mp15-disco.ext4 |
Thanks.
Solved! Go to Solution.
2025-05-05 3:41 AM
Hi,
I was able to resolve this issue and the device to boot using EMMC By changing the MMC_DEFAULT_MAX_RETRIES in TFA_source/driver/mmc/mmc.c file from 5 to 10.
Below is the link to my other post where I was able to resolve it.
https://community.st.com/t5/stm32-mpus-embedded-software-and/not-able-to-boot-from-emmc-on-stm32mp157dac-panic-at-pc/m-p/799044#M4744
Thanks.
2025-04-29 7:26 AM
Hi @adnan_pasha
Regarding OTP for pin changes, they are required for Boot Phase on CMD/CK and D0 pins only (only those are used by BootROM).
The pins you listed above does not need OTP fusing according to the AN5031 and wiki Boot from e•MMC™
For uBoot or else, pins are defined by Device Tree pinmux, which might miss in your case as you seems to have started your config from stm32mp157f-dk2 which does not have eMMC.
In your case, better to look at STM32MP157D-ED1 or STM32MP157D-EV1. See https://wiki.st.com/stm32mpu/wiki/How_to_create_your_board_device_tree and https://github.com/STMicroelectronics/dt-stm32mp/tree/v5-stm32mp
For Flashlayout, please refer to Typical Flashlayout for e•MMC
Regards.
2025-04-29 7:55 AM
Hi @PatrickF
Thanks for clarification about opt configuration.
i have made the below change in my stm32mp15xx-dkx.dtsi device tree in kernel-source and modified stm32mp157f-dk2.dts where to use sdmmc3 instead of 2.
do I need to do these coniguration in STM32MP157D-ED1 or STM32MP157D-EV1 files ?
/* changed from 3 to 2 for emmc */
&sdmmc2 {
u-boot,dm-pre-reloc;
u-boot,dm-spl;
pinctrl-names = "default", "opendrain", "sleep";
pinctrl-0 = <&sdmmc2_b4_pins_a>;
pinctrl-1 = <&sdmmc2_b4_od_pins_a>;
pinctrl-2 = <&sdmmc2_b4_sleep_pins_a>;
non-removable;
no-sd;
no-sdio;
st,neg-edge;
bus-width = <8>;
vmmc-supply = <&v3v3>;
vqmmc-supply = <&vdd>;
mmc-ddr-3_3v;
status = "okay";
};
2025-04-29 8:00 AM
Hi @PatrickF ,
With the above configuration i was able to detect emmc in linux boot.
but when trying to flash OS image to emmc from stm32cubeprogrammer it shows no device found mmc1.
thanks,
2025-04-29 8:05 AM - edited 2025-04-29 8:07 AM
Hi,
you might miss the data 4-7 pinmux in your DT.
Regards.
2025-04-29 8:08 AM
Hi,
I had added all the 8 pins like below ,
sdmmc2_b4_pins_a: sdmmc2-b4-0 {
u-boot,dm-pre-reloc;
pins1 {
pinmux = <STM32_PINMUX('B', 14, AF9)>, /* SDMMC2_D0 */
<STM32_PINMUX('B', 15, AF9)>, /* SDMMC2_D1 */
<STM32_PINMUX('B', 3, AF9)>, /* SDMMC2_D2 */
<STM32_PINMUX('B', 4, AF9)>, /* SDMMC2_D3 */
<STM32_PINMUX('A', 8, AF9)>, /* SDMMC2_D4 */
<STM32_PINMUX('A', 15, AF9)>, /* SDMMC2_D5 */
<STM32_PINMUX('C', 6, AF10)>, /* SDMMC2_D6 */
<STM32_PINMUX('C', 7, AF10)>, /* SDMMC2_D7 */
<STM32_PINMUX('G', 6, AF10)>; /* SDMMC2_CMD */
slew-rate = <1>;
drive-push-pull;
bias-pull-up;
};
pins2 {
pinmux = <STM32_PINMUX('E', 3, AF9)>; /* SDMMC2_CK */
slew-rate = <2>;
drive-push-pull;
bias-pull-up;
};
};
sdmmc2_b4_od_pins_a: sdmmc2-b4-od-0 {
u-boot,dm-pre-reloc;
pins1 {
pinmux = <STM32_PINMUX('B', 14, AF9)>, /* SDMMC2_D0 */
<STM32_PINMUX('B', 15, AF9)>, /* SDMMC2_D1 */
<STM32_PINMUX('B', 3, AF9)>, /* SDMMC2_D2 */
<STM32_PINMUX('B', 4, AF9)>, /* SDMMC2_D3 */
<STM32_PINMUX('A', 8, AF9)>, /* SDMMC2_D4 */
<STM32_PINMUX('A', 15, AF9)>, /* SDMMC2_D5 */
<STM32_PINMUX('C', 6, AF10)>, /* SDMMC2_D6 */
<STM32_PINMUX('C', 7, AF10)>; /* SDMMC2_D7 */
slew-rate = <1>;
drive-push-pull;
bias-pull-up;
};
pins2 {
pinmux = <STM32_PINMUX('E', 3, AF9)>; /* SDMMC2_CK */
slew-rate = <2>;
drive-push-pull;
bias-pull-up;
};
pins3 {
pinmux = <STM32_PINMUX('G', 6, AF10)>; /* SDMMC2_CMD */
slew-rate = <1>;
drive-open-drain;
bias-pull-up;
};
};
sdmmc2_b4_sleep_pins_a: sdmmc2-b4-sleep-0 {
u-boot,dm-pre-reloc;
pins {
pinmux = <STM32_PINMUX('B', 14, ANALOG)>, /* SDMMC2_D0 */
<STM32_PINMUX('B', 15, ANALOG)>, /* SDMMC2_D1 */
<STM32_PINMUX('B', 3, ANALOG)>, /* SDMMC2_D2 */
<STM32_PINMUX('B', 4, ANALOG)>, /* SDMMC2_D3 */
<STM32_PINMUX('A', 8, ANALOG)>, /* SDMMC2_D4 */
<STM32_PINMUX('A', 15, ANALOG)>, /* SDMMC2_D5 */
<STM32_PINMUX('C', 6, ANALOG)>, /* SDMMC2_D6 */
<STM32_PINMUX('C', 7, ANALOG)>, /* SDMMC2_D7 */
<STM32_PINMUX('E', 3, ANALOG)>, /* SDMMC2_CK */
<STM32_PINMUX('G', 6, ANALOG)>; /* SDMMC2_CMD */
};
};
2025-04-29 8:23 AM
Hi @PatrickF ,
I would like some clarification on how modifying the Device Tree configuration impacts eMMC detection in DFU mode, given that there is no operating system running before the eMMC image is flashed. Do I need to update the Device Tree, flash the image to an SD card first, and then use that setup to flash the eMMC?
Thanks.
2025-04-29 8:46 AM - edited 2025-04-29 8:47 AM
Hi,
during first Flashload phase, the CubeProgrammer <-> BootROM in DFU will load two images ID = 0x01 (fsbl-boot in SYSRAM) and 0x03 (fip-boot in DDR). These are not loaded in any flash, they are the supporting SW to do the real flash later. Here DT is important mostly for DDR as uboot is loaded/running from DDR.
Then this loaded FIP/uBoot is started, will reconnect to CubeProgrammer in DFU for the real external flashing phase of other partitions as listed in the Flashlayout file (CubeProgrammer <-> uBoot in DFU <-> Flash). Here Device tree is important as uBoot need to configure correctly the external flash accesses (clock, IP, pins, etc..)
You don't need to Flash SD-Card if your target is to Flash the eMMC.
Maybe share your Cubeprogrammer error message and most important the board UART console messages.
Regards.
2025-04-30 10:58 AM
Hi @PatrickF
Thanks for the info.
Do I need to configure eMMC in the U-Boot Device Tree as well? If so, which Device Tree file should I modify?
Also, I attempted to clean and rebuild the U-Boot source, but in the process, I lost the files located at:
build-openstlinuxweston-stm32mp15-disco/tmp-glibc/work-shared/stm32mp15-disco/uboot-sources/
How can I recover these files?
Since modifying Device Tree files directly in the tmp directory isn't recommended (as they can be lost during cleans or rebuilds), what's the correct way to apply these changes from my custom layer?
I’m aware that one approach is to use patches, but when I try to generate a patch using git diff, I receive an error saying the directory is not a Git repository.
Thanks.
2025-05-01 1:20 AM
Hi @PatrickF
I was able to get the source files back after runnning below commands
bitbake -ccleansstate <package_name> bitbake <package_name>
Right now I'm looking into how I can modify my u-boot and tf-a device tree files from a custom layer.
Thanks.