cancel
Showing results for 
Search instead for 
Did you mean: 

EMMC Questions

Eldam
Senior

Hi ST Teams!

We've made a custom board with sdcard and mmc, all these device can be viewed from uboot/linux userspace. We are mainly using starter kit (v1.2) with modified tfa/uboot.

For mmc programming, using Cube Programmer CLI(v2.5) we have only uart option available.

I've got few questions about emmc:

**What is the maximum baudrate we can have on UART boot in order to program emmc (921600)? We manage to begin to program at 115200 but it takes far too long time.

At higher speed we have an error message stating:

File download complete

Time elapsed during download operation: 00:00:04.221

RUNNING Program ...

 PartID:     :0x01

Start operation done successfully at partition 0x01

GETPHASE command not acknowledged!

Reemission of GetPhase command

GETPHASE command not acknowledged!

Reemission of GetPhase command

GETPHASE command not acknowledged!

We tried to add "-tm 1000" option in command line but doesn't help.

Any hints?

**Does we have to erase it (emmc) before any update?

if yes, and if I understand docs, I have to made a special tsv file, with "ped" in specials fields, is this correct?

Have a nice day!

1 ACCEPTED SOLUTION

Accepted Solutions
Olivier GALLIEN
ST Employee

Hi @Eldam​ 

I understand you intend to flash your Emmc from SDCard.

This topic has already been covered in following post :

https://community.st.com/s/question/0D50X0000BiBhHQSQ0/stm32mp153a-failed-to-boot-from-emmc

I copy here the most interesting part which is the detailed procedure

8. Prepare eMMC

===============

You can use U-Boot to copy binary in eMMC.

 

In the next example, you need to boot from SDCARD and the images (tf-a-stm32mp157c-ev1-trusted.stm32, u-boot-stm32mp157c-ev1-trusted.stm32)

are presents on SDCARD (mmc 0) in ext4 partition 4 (bootfs). From the starter package of EV1, you can simply copy the 2 binaries in “/boot�? directory of your board.

 

To boot from SDCard, select BootPinMode = 1 0 1 and reset.

 

Then you update the eMMC with the next U-Boot command :

 

a) prepare GPT on eMMC,

               example with 4 partitions, bootfs, rootfs, userfs and vendorfs:

 

               # setenv emmc_part "name=ssbl,size=2MiB;name=bootfs,type=linux,bootable,size=64MiB;name=vendorfs,type=linux,size=16MiB;name=rootfs,type=linux,size=640MiB;name=userfs,type=linux,size=64MiB "

               # gpt write mmc 1 ${emmc_part}

 

b) copy SPL on eMMC on first boot partition

               (SPL max size is 256kB, with LBA 512, 0x200)

 

               # ext4load mmc 0:4 0xC0000000 tf-a-stm32mp157c-ev1-trusted.stm32

               # mmc dev 1

               # mmc partconf 1 1 1 1

               # mmc write ${fileaddr} 0 200

               # mmc partconf 1 1 1 0

 

c) copy U-Boot in first GPT partition of eMMC

 

               # ext4load mmc 0:4 0xC0000000 u-boot-stm32mp157c-ev1-trusted.stm32

               # mmc dev 1

               # part start mmc 1 1 partstart

               # part size mmc 1 1 partsize

               # mmc write ${fileaddr} ${partstart} ${filesize}

 

To boot from eMMC, select BootPinMode = 0 1 0 and reset.

Here is the boot result (I started from an empty emmc):

NOTICE: CPU: STM32MP157CAA Rev.B

NOTICE: Model: STMicroelectronics STM32MP157C eval daughter on eval mother

NOTICE: Board: MB1263 Var1 Rev.C-01

INFO:  Reset reason (0x14):

INFO:   Pad Reset from NRST

INFO:  Using EMMC

INFO:   Instance 2

INFO:  Boot used partition fsbl1

INFO:  BootROM: 252928 (0x3dc00) bytes copied from eMMC

NOTICE: BL2: v2.0-r1.5(debug):

NOTICE: BL2: Built : 13:13:37, Oct 2 2018

INFO:  BL2: Doing platform setup

INFO:  PMIC version = 0x10

INFO:  RAM: DDR3-1066/888 bin G 2x4Gb 533MHz v1.45

INFO:  Memory size = 0x40000000 (1024 MB)

INFO:  BL2 runs SP_MIN setup

INFO:  BL2: Loading image id 4

INFO:  Loading image id=4 at address 0x2fff0000

INFO:  Image id=4 loaded: 0x2fff0000 - 0x30000000

INFO:  BL2: Loading image id 5

INFO:  Loading image id=5 at address 0xc0100000

INFO:  STM32 Image size : 810110

WARNING: Skip signature check (header option)

INFO:  Image id=5 loaded: 0xc0100000 - 0xc01c5c7e

INFO:  read version 0 current version 0

NOTICE: BL2: Booting BL32

INFO:  Entry point address = 0x2fff0000

INFO:  SPSR = 0x1d3

INFO:  PMIC version = 0x10

NOTICE: SP_MIN: v2.0-r1.5(debug):

NOTICE: SP_MIN: Built : 13:13:37, Oct 2 2018

INFO:  ARM GICv2 driver initialized

INFO:  stm32mp HSI (18): Secure only

INFO:  stm32mp HSE (20): Secure only

INFO:  stm32mp PLL2 (27): Secure only

INFO:  stm32mp PLL2_R (30): Secure only

INFO:  SP_MIN: Initializing runtime services

INFO:  SP_MIN: Preparing exit to normal world

U-Boot 2018.11-stm32mp-r3 (Nov 14 2018 - 16:10:06 +0000)

CPU: STM32MP157CAA Rev.B

Model: STMicroelectronics STM32MP157C eval daughter on eval mother

Board: stm32mp1 in trusted mode (st,stm32mp157c-ev1)

Board: MB1263 Var1 Rev.C-01

DRAM: 1 GiB

Clocks:

- MPU : 650 MHz

- MCU : 208.878 MHz

- AXI : 266.500 MHz

- PER : 24 MHz

- DDR : 533 MHz

NAND: 1024 MiB

MMC:  STM32 SDMMC2: 0, STM32 SDMMC2: 1

Loading Environment from EXT4... 

** Unable to use mmc 1:auto for loading the env **

In:  serial

Out:  serial

Err:  serial

Net:  eth0: ethernet@5800a000

Hit any key to stop autoboot: 0 

Boot over mmc1!

Saving Environment to EXT4... 

** Unable to use mmc 1:auto for saveenv **

Failed (1)

switch to partitions #0, OK

mmc1(part 0) is current device

** Unrecognized filesystem type **

STM32MP> 

Hope it help

Olivier

Olivier GALLIEN
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.

View solution in original post

6 REPLIES 6
Olivier GALLIEN
ST Employee

Hi @Eldam​ 

Can you please share which STM32CubeProgrammer version you are using ?

I will check maximal baud rate which can be achieved but for sure UART load will never reach performance you can get on USB.

Which constraint prevent you to use an USB ?

Any chance you add one to your design ?

Olivier

Olivier GALLIEN
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.
Eldam
Senior

Well, first of all, Thanks for answering me.

Version of Cube programmer is 2.5, linux version ubuntu 16.04

Which constraint prevent you to use an USB ? -->Boards already built

Any chance you add one to your design ? --> praise Nyarlatothep

By the way, I'm looking to program EMMC via uboot for partitionning as a first step,

and with booting with SDCard+Usb key for uploading to emmc, but its (very) confusing for me.

I'm mixing tutorials from:

https://www.emcraft.com/som/stm32mp1/booting-linux-from-emmc

https://github.com/STMicroelectronics/u-boot/tree/v2018.11-stm32mp/board/st/stm32mp1

Dam.

Olivier GALLIEN
ST Employee

Hi @Eldam​ 

I understand you intend to flash your Emmc from SDCard.

This topic has already been covered in following post :

https://community.st.com/s/question/0D50X0000BiBhHQSQ0/stm32mp153a-failed-to-boot-from-emmc

I copy here the most interesting part which is the detailed procedure

8. Prepare eMMC

===============

You can use U-Boot to copy binary in eMMC.

 

In the next example, you need to boot from SDCARD and the images (tf-a-stm32mp157c-ev1-trusted.stm32, u-boot-stm32mp157c-ev1-trusted.stm32)

are presents on SDCARD (mmc 0) in ext4 partition 4 (bootfs). From the starter package of EV1, you can simply copy the 2 binaries in “/boot�? directory of your board.

 

To boot from SDCard, select BootPinMode = 1 0 1 and reset.

 

Then you update the eMMC with the next U-Boot command :

 

a) prepare GPT on eMMC,

               example with 4 partitions, bootfs, rootfs, userfs and vendorfs:

 

               # setenv emmc_part "name=ssbl,size=2MiB;name=bootfs,type=linux,bootable,size=64MiB;name=vendorfs,type=linux,size=16MiB;name=rootfs,type=linux,size=640MiB;name=userfs,type=linux,size=64MiB "

               # gpt write mmc 1 ${emmc_part}

 

b) copy SPL on eMMC on first boot partition

               (SPL max size is 256kB, with LBA 512, 0x200)

 

               # ext4load mmc 0:4 0xC0000000 tf-a-stm32mp157c-ev1-trusted.stm32

               # mmc dev 1

               # mmc partconf 1 1 1 1

               # mmc write ${fileaddr} 0 200

               # mmc partconf 1 1 1 0

 

c) copy U-Boot in first GPT partition of eMMC

 

               # ext4load mmc 0:4 0xC0000000 u-boot-stm32mp157c-ev1-trusted.stm32

               # mmc dev 1

               # part start mmc 1 1 partstart

               # part size mmc 1 1 partsize

               # mmc write ${fileaddr} ${partstart} ${filesize}

 

To boot from eMMC, select BootPinMode = 0 1 0 and reset.

Here is the boot result (I started from an empty emmc):

NOTICE: CPU: STM32MP157CAA Rev.B

NOTICE: Model: STMicroelectronics STM32MP157C eval daughter on eval mother

NOTICE: Board: MB1263 Var1 Rev.C-01

INFO:  Reset reason (0x14):

INFO:   Pad Reset from NRST

INFO:  Using EMMC

INFO:   Instance 2

INFO:  Boot used partition fsbl1

INFO:  BootROM: 252928 (0x3dc00) bytes copied from eMMC

NOTICE: BL2: v2.0-r1.5(debug):

NOTICE: BL2: Built : 13:13:37, Oct 2 2018

INFO:  BL2: Doing platform setup

INFO:  PMIC version = 0x10

INFO:  RAM: DDR3-1066/888 bin G 2x4Gb 533MHz v1.45

INFO:  Memory size = 0x40000000 (1024 MB)

INFO:  BL2 runs SP_MIN setup

INFO:  BL2: Loading image id 4

INFO:  Loading image id=4 at address 0x2fff0000

INFO:  Image id=4 loaded: 0x2fff0000 - 0x30000000

INFO:  BL2: Loading image id 5

INFO:  Loading image id=5 at address 0xc0100000

INFO:  STM32 Image size : 810110

WARNING: Skip signature check (header option)

INFO:  Image id=5 loaded: 0xc0100000 - 0xc01c5c7e

INFO:  read version 0 current version 0

NOTICE: BL2: Booting BL32

INFO:  Entry point address = 0x2fff0000

INFO:  SPSR = 0x1d3

INFO:  PMIC version = 0x10

NOTICE: SP_MIN: v2.0-r1.5(debug):

NOTICE: SP_MIN: Built : 13:13:37, Oct 2 2018

INFO:  ARM GICv2 driver initialized

INFO:  stm32mp HSI (18): Secure only

INFO:  stm32mp HSE (20): Secure only

INFO:  stm32mp PLL2 (27): Secure only

INFO:  stm32mp PLL2_R (30): Secure only

INFO:  SP_MIN: Initializing runtime services

INFO:  SP_MIN: Preparing exit to normal world

U-Boot 2018.11-stm32mp-r3 (Nov 14 2018 - 16:10:06 +0000)

CPU: STM32MP157CAA Rev.B

Model: STMicroelectronics STM32MP157C eval daughter on eval mother

Board: stm32mp1 in trusted mode (st,stm32mp157c-ev1)

Board: MB1263 Var1 Rev.C-01

DRAM: 1 GiB

Clocks:

- MPU : 650 MHz

- MCU : 208.878 MHz

- AXI : 266.500 MHz

- PER : 24 MHz

- DDR : 533 MHz

NAND: 1024 MiB

MMC:  STM32 SDMMC2: 0, STM32 SDMMC2: 1

Loading Environment from EXT4... 

** Unable to use mmc 1:auto for loading the env **

In:  serial

Out:  serial

Err:  serial

Net:  eth0: ethernet@5800a000

Hit any key to stop autoboot: 0 

Boot over mmc1!

Saving Environment to EXT4... 

** Unable to use mmc 1:auto for saveenv **

Failed (1)

switch to partitions #0, OK

mmc1(part 0) is current device

** Unrecognized filesystem type **

STM32MP> 

Hope it help

Olivier

Olivier GALLIEN
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.
Eldam
Senior

Well thanks for your infos.

I followed all commands and still have problems booting. (like : ERROR: stm32_sdmmc2_read: timeout 1s (status = 281000))

A simple question:

If a (uboot and tf-a) works with an sd card, does the same files will work with an emmc?

thanks, see u tomorow!

Eldam
Senior

After hours of struggle, we managed to make things works...

Issues was due to dts (tfa+uboot) errors in mmc pinout description...

So it seems (at least for V1.2 SDK) that we can use the same tfa+uboot for both emmc or sdcard.

thanks for all help received.

Have a nice day!

I have the same issue do you can put the details of your solutions please?