cancel
Showing results for 
Search instead for 
Did you mean: 

Manual for flashing the eMMC with OpenSTLinux?

DMårt
Senior II

Hi!

I have made a simple computer with STM32MP151AAC3 processor.

I have modify so I can boot either from UART4 or eMMC. My question is:

When I want to flash OpenSTLinux onto the eMMC, can that be done via ST-Link and STM32CubeIDE? Just like regular STM32 programming via STM32CubeIDE?

If yes: Is there any manual how to flash the eMMC with OpenSTLinux via UART4 so my processor can boot from eMMC?

 

I have attached the schematic. Just tell me if I'm missing something. I have included:

  • LSE
  • HSE
  • Boot (Only BOOT1 can be set HIGH. BOOT0 and BOOT2 is default pull-down)
  • RESET
  • External ST-Link debug via 1.27 x 2 connector (I assuming that a Nucleo STM32 can be used as ST-Link programmer)
  • HDMI
  • DDR
  • eMMC
  • USBH 
  • USB OTG
  • Gigabit Ethernet
  • PMIC with 3.5 mm DC plug connector
10 REPLIES 10
PatrickF
ST Employee

HI @DMårt 

You cannot flash STM32MPx using neither STLINK nor CubeIDE (used only for debug purposes).
You should use CubeProgrammer on a PC connected to OTG high-speed port (at least USB_DP2/USB_DM2 + ground are needed).

https://wiki.st.com/stm32mpu/wiki/STM32CubeProgrammer#STM32CubeProgrammer_overview

UART could be used with CubeProgrammer, but due to size of images, it is useful only as workaround for early trials if USB is failing or to load minimum image (e.g. TF-A + uBoot) which is then able to load the remaining image using USB stick, Ethernet or else. This need some adaptation or development on your side.

If your platform has SD-Card slot, SD-Card could be populated on a PC and once the platform is started from it (need adequate BOOT pins), could be used to Flash internal memory such as eMMC.

 

Btw, in your schematics, you might have issues around 24MHz oscillator as you need to have HSE_OUT =0 to allows BootROM autodetection of digital bypass while the oscillator usually need a logic 1 to start (i.e. PWR_ON).

OTG_FS_DN/DP could be easily replaced by USB_DP2/DM2 to get high-speed and Flashload capabilities.

 

Please refer to AN5031 or existing boards such as STM32MP157F-DK2

Regards.

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.

Hi @PatrickF 




>> You cannot flash STM32MPx using neither STLINK nor CubeIDE (used only for debug purposes).

 

Ok! Good thing I included the debugging connector then.


>> You should use CubeProgrammer on a PC connected to OTG high-speed port (at least USB_DP2/USB_DM2 + ground are needed).

 

Ok! I assume that CubeProgrammer is the flashing-tool? Right? It will flash in the operative system onto eMMC?

By the way! I'm using OTG_VBUS -> VBUS, OTG_FS_DM -> D-, OTG_FS_DP -> D+, OTG_ID -> ID to a Micro USB connector, instead of USB_DP2/USB_DM2. Is that prefered?

 

Skärmbild 2024-04-30 100807.png

>> UART could be used with CubeProgrammer, but due to size of images, it is useful only as workaround for early trials if USB is failing or to load minimum image (e.g. TF-A + uBoot) which is then able to load the remaining image using USB stick, Ethernet or else. This need some adaptation or development on your side.

 

Ok! I understand. USB is much faster.

 

>> If your platform has SD-Card slot, SD-Card could be populated on a PC and once the platform is started from it (need adequate BOOT pins), could be used to Flash internal memory such as eMMC.

In my case, I only have eMMC and BOOT1 can be high or low. BOOT0 and BOOT2 is pull-down internally. 

 

>> Btw, in your schematics, you might have issues around 24MHz oscillator as you need to have HSE_OUT =0 to allows BootROM autodetection of digital bypass while the oscillator usually need a logic 1 to start (i.e. PWR_ON).

 

I have followed the schematic from AN5031.

Skärmbild 2024-04-30 102000.pngSkärmbild 2024-04-30 102035.png

Also I have made a cut for the LSE crystal.

Skärmbild 2024-04-30 103004.png

 

>> OTG_FS_DN/DP could be easily replaced by USB_DP2/DM2 to get high-speed and Flashload capabilities.

 

But is not OTG_FS important if I want to flash the eMMC with the operative system(Linux) via CubeProgrammer?

I have not found any OTG_HS_DN and OTG_HS_DP.

Skärmbild 2024-04-30 104449.png

 

Edit:

I found that DM2_DP is pin AB16 and DM2_DN is AC16!

I will change OTG_FS_DP/DM to OTG_HS_DP/DM. Thank you for noticing that!

Skärmbild 2024-04-30 105014.png

Hi,

It seems the HSE oscillator is not wired as expected from AN5031 (PWR_ON and OSC_OUT are never linked, either R2 or R3 is open)

PatrickF_0-1714471170913.png

Regards

 

 

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.

@PatrickF 

It's routed as the Dev-kit example. I have following the AN5031 as you see. No R0 resistors. Oh! I see, I need to remove the 6.8 pF capacitors?

 

Skärmbild 2024-04-30 211103.png

Skärmbild 2024-04-30 213332.png

Done!

Skärmbild 2024-05-01 134242.png

Hi.

This is still not OK IMHO.

Regards.

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.

@PatrickF 

 

But it's exactly the same as the board STM32MP157F-DK2.

 

VCC has a low pass filter of 10 nF and 10 Ohm.

HSE_OUT is connected to ST/EN.

Just like the STM32MP157F-DK2.

 

So I don't see what's wrong.

Not Really, please check carefully.

on STM32MP157F-DK2

- HSE_OUT is connected to ground with 1K to tell BootROM we are in digital bypass mode (i.e. external digital clock on HSE_IN)

- Oscillator enable (EN) is connected to PWR_ON (to enable oscillator at power up, but shutdown it during low power modes to save power)

- In all cases, HSE_OUT and PWR_ON have no electrical connections on PCB (either one or the other resistor is not present).

 

In your schematics, I see HSE_OUT grounded with 1k (OK), but oscillator Enable will always receive a 0 (as 1K to ground) and so will never start.

PWR_ON will not have any action in your schematics.

In your schamtics, you have to move the HSE_OUT and the 1K out of oscillator scope.

Regards.

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.

Hi @PatrickF 

 

>> HSE_OUT is connected to ground with 1K to tell BootROM we are in digital bypass mode (i.e. external digital clock on HSE_IN)

 

Yes.

 

>> Oscillator enable (EN) is connected to PWR_ON (to enable oscillator at power up, but shutdown it during low power modes to save power)

 

No. The EN is connected to HSE_OUT and a 10 kOhm resistor and 1 kOhm resistor, if we looking at the reference design from ST. 

 

>> In all cases, HSE_OUT and PWR_ON have no electrical connections on PCB (either one or the other resistor is not present).

 

I have not connected HSE_OUT and PWR_ON, as you can see in my schematics.

 

>> In your schematics, I see HSE_OUT grounded with 1k (OK), but oscillator Enable will always receive a 0 (as 1K to ground) and so will never start.

 

But HSE_OUT is connected to 10 kOhm resistor and that resistor is connected to PWR_ON.

 

>> PWR_ON will not have any action in your schematics.

 

Why not?

 

>> In your schamtics, you have to move the HSE_OUT and the 1K out of oscillator scope.

 

But then I don't following the reference design from AN5031.

Or do you mean that I should ship the pull-down of 1 kOhm resistor and not connect HSE_OUT to EN? Only PWR_ON to 10 kOhm resistor and that resistor to EN?