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.
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: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.