cancel
Showing results for 
Search instead for 
Did you mean: 

Can't get out of DFU mode.

Golgepapaz
Associate II

Hello,

Using a custom board loosely based on STM32mp157F-DK2

we are using boot0 and boot2 pins.According to documentation,

boot mode configuration is as follows;

Boot Mode     BOOT2  BOOT0

Recov/DFU        0      0

Nor              0      1

Reserved(DEV)    1      0

SD-Card           1      1

Whereas with our board,I get a table like this 

Boot Mode     BOOT2  BOOT0

DFU              0      0

DFU              0      1

Reserved(DEV)   1      0

DFU              1      1

Since the board is in perpetual DFU mode I can't

boot from SD-card. Our HW engineer assured me that the

boot pins are connected correctly (1K resistors through VDD and dip switches)

Is there a way to force the board to boot from SD-card in that case

or is there something else that I might be missing?

Thanks in advance,

1 ACCEPTED SOLUTION

Accepted Solutions
PatrickF
ST Employee

Hi,

If BootROM does not found a valid FSBL in SD-Card, there is a fall back in DFU.

https://wiki.st.com/stm32mpu/wiki/STM32_MPU_ROM_code_overview#Boot_device_selection

So, your SD-Card is either not reachable (HW issue) or it's content is not well formed

check

  • Correct default pins used for SD-Card
  • Supplies
  • Signal toggling on SD-Card CLK/CMD/D0
  • Check SD-Card FSBL content well formed (e.g. header, location in SD-Card)

You could also check BootROM trace to get more insight on what going wrong https://wiki.st.com/stm32mpu/wiki/STM32_MPU_ROM_trace_analyzer

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.

View solution in original post

6 REPLIES 6
PatrickF
ST Employee

Hi,

If BootROM does not found a valid FSBL in SD-Card, there is a fall back in DFU.

https://wiki.st.com/stm32mpu/wiki/STM32_MPU_ROM_code_overview#Boot_device_selection

So, your SD-Card is either not reachable (HW issue) or it's content is not well formed

check

  • Correct default pins used for SD-Card
  • Supplies
  • Signal toggling on SD-Card CLK/CMD/D0
  • Check SD-Card FSBL content well formed (e.g. header, location in SD-Card)

You could also check BootROM trace to get more insight on what going wrong https://wiki.st.com/stm32mpu/wiki/STM32_MPU_ROM_trace_analyzer

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 there,

Ok BootRom falling back to USB boot mode has opened a can of worms for me.Although

it should be obvious since I've read that wiki page countless times.Somehow I'd always

thought DFU is something different from Serial boot. I've checked with DK2 board and

 you are right.it falls back to DFU mode if sd card is removed from the board.

So let me explain my situation in a litte bit more detail with due consideration

with the points you have made.

I can download the tf-a and uboot binaries to the board using the DFU mode with

the a simple TSV file with help of STM32Programmer_CLI and can run FSBL and SSBL

Here is the console output of u-boot mmc commands

STM32MP> mmc list       

STM32 SD/MMC: 0 (eMMC)

STM32 SD/MMC: 1 (SD)

STM32MP> mmc info       

Device: STM32 SD/MMC

Manufacturer ID: 2

OEM: 544d

Name: SA08G

Bus Speed: 50000000

Mode: SD High Speed (50MHz)

Rd Block Len: 512

SD version 3.0

High Capacity: Yes

Capacity: 7.2 GiB

Bus Width: 4-bit

Erase Group Size: 512 Bytes

As you can see the SD card is detected (I can also read the contents)

but you should also notice that the our configuration is different from the standard

configuration. We have a 8bit e-mmc at SDMMC1 and SD card at SDMMC2.DTS is

generated by STMCube from the ICO file and modified accordingly.

I've set the otp word 3 to 0x00000010 to set SD card memory interface to SDMMC2

but since our pinmux is different from "default pins" I have to set AFMUX configuration

as per https://wiki.st.com/stm32mpu/wiki/STM32_MPU_ROM_code_overview#Boot_from_SD_card

(it is coming together as I write this.)

AFMUX configuration seems arcane to me and I'm not sure how to set it up. Below is t

he pinmux configuration for SDMMC2 in our board.

	sdmmc2_pins_mx: sdmmc2_mx-0 {
		pins1 {
			pinmux = <STM32_PINMUX('B', 3, AF9)>, /* SDMMC2_D2 */
					 <STM32_PINMUX('B', 4, AF9)>, /* SDMMC2_D3 */
					 <STM32_PINMUX('B', 14, AF9)>, /* SDMMC2_D0 */
					 <STM32_PINMUX('B', 15, AF9)>, /* SDMMC2_D1 */
					 <STM32_PINMUX('G', 6, AF10)>; /* SDMMC2_CMD */
			bias-pull-up;
			drive-push-pull;
			slew-rate = <1>;
		};
		pins2 {
			pinmux = <STM32_PINMUX('E', 3, AF9)>; /* SDMMC2_CK */
			bias-pull-up;
			drive-push-pull;
			slew-rate = <2>;
		};
	};

l

Since Otp is one time (I've already bricked one board ) I need a little help as how to translate the pinmux to configuration words.Documentation about it non-existent and simple example would go beyond words.

As for ROM traces, ST-link port is not exposed to outside world for this revision so I can't check

but I've discussed this with our HW designer to include it in the next revision.

Thanks

PatrickF
ST Employee

Hi @Golgepapaz​ 

to inform BootROM to use SD-Card over SDMMC2 CLK, CMD, D0 (sufficient for BootROM), respectively on pins PE3 PG6 and PB14, you should setup the following OTPs:

  • WORD3 = 0x00000010
  • WORD5 = 0x76A45391
  • WORD6 = 0x00002E94

You could double check values above using https://wiki.st.com/stm32mpu/wiki/STM32MP15_OTP_mapping#AFmux_configuration

Regards,

In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'

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.
Golgepapaz
Associate II

Ok just to be sure I'm going to break down the OTP for SDMMC2_CK given by the definition

pins2 {
	pinmux = <STM32_PINMUX('E', 3, AF9)>; /* SDMMC2_CK */
	bias-pull-up;
	drive-push-pull;
	slew-rate = <2>;
};

5391 assuming LSB is rightmost bit

15-12 (4 bits) Bank id; 5 => E;

11-8 (4 bits) Pin id; 3 => 3;

7-4 (4 bits) AFmux value; 9 => AF9

3-0 (4 bits) Pin Mode ; 1 :AF, No pull, Medium speed => bias-pull-up

The same logic can be applied to other pins as well. Only difference is pin mode is set to 4 (AF, Pull up, Medium speed) for other pins. Is this deliberate? I'd expect this one would be set to 4 as well because of the bias-pull-up property in the DTS or it has to be this way since it's a clock signal.it's also strongly probable there is no relation between DTS property and pin mode as well.

Thanks in advance again.

Hurcan

PatrickF
ST Employee

Hi,

pull-up or not on SDMMC2 CLK should not make any difference for BootROM as it is push-pull during whole boot sequence.

Maybe useful for Device Tree as pin could de deallocated by Linux.

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.
Golgepapaz
Associate II

Board now boots from sd-card . Thank you for your help. though kernel fails to load with panic I'll make another post if I am unable to resolve it.