cancel
Showing results for 
Search instead for 
Did you mean: 

USB2 - USB OTG (on stm32mp157x-DK2) - does it need Vbussx or CCxx connected to function as USB mass storage in U-Boot ?

Arnas Celkys
Associate II

I have custom stm32mp1 board and when running it as USB mass storage in U-Boot (ums 0 mmc 0), the USB driver is not detected nor by Linux nor by Windows. I am also attaching shematc comparison of eval-board VS my custom board. Also the USB-ORG is working in Engineering mode as DFU device - so I am guessing the soldering and USB pinouts are correct.

0693W00000HprgoQAB.pngPic.1. Custom board schematics of USB-OTG0693W00000HprgZQAR.png2.Pic. Eval-board schematic of USB-OTG.

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Arnas Celkys​ ,

Yes &usbotg_hs phandle can be used on purpose at any level of the dts structure to overwrite some properties set in previous level.

Actually the warning it's to not modified Soc level dtsi.

You are right that in our delivery ST used also a board factorization level (dkx.dtsi or evx.dtsi) you can change since you master what you are doing.

For a custom design I would be more incline to start from a MX generated DTS in order to have a flat board level dts.

Still refer to STM32MP15 device tree - stm32mpu

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

17 REPLIES 17
PatrickF
ST Employee

Hi @Arnas Celkys​ ,

I recommend to check your DT and set OTG node according to https://wiki.st.com/stm32mpu/wiki/How_to_configure_U-Boot_for_your_board#USB_OTG_node

With ecosystem V3.x, in order to force VBUS and ID pins to be ignored, it should have:

 &usbotg_hs {
 	u-boot,force-b-session-valid;
 	u-boot,force-vbus-detection;
 	dr_mode = "peripheral";
 };

Btw, the pull-down Rd resistor on CC lines should be 5.1k (but I think 4.7k might not explain why PC did not detect your device as 10% tolerance is allowed)

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.
Arnas Celkys
Associate II

Hey, @PatrickF​ ,

so I followed the 'stm32mp157c-dk2-u-boot.dtsi' include to file 'stm32mp157a-dk1-u-boot.dtsi' located in :<development-packet>/stm32mp1-openstlinux-5.10-dunfell-mp1-21-11-17/sources/arm-ostl-linux-gnueabi/u-boot-stm32mp-v2020.10-stm32mp-r2-r0/u-boot-stm32mp-v2020.10-stm32mp-r2/arch/arm/dts. Made the following changes:

-----------------------------------------------------------------------------------------------------------------------------------------------------------

&usbotg_hs {               //changes made my my, so that OTG-USB does not need Vbus, ID pins

    u-boot,force-b-session-valid;

    u-boot,force-vbus-detection;

    dr_mode = "peripheral";

};

also made a small change to 'stm32mp1.c', to printout the version of u-boot - and indicate that changes were made.

-----------------------------------------------------------------------------------------------------------------------------------------------------------

Then generated new u-boot.img and u-boot-spl.stm32, and uploaded them via USB-as-massstorage to eval-board - board performs as it used to. Then I slid the SD from eval-board to custom board, but still the same problem the masstorage is not detected after ums 0 mmc 0. Infact no USB is detected

STM32MP> ums 0 mmc 0

UMS: LUN 0, dev 0, hwpart 0, sector 0x0, count 0x7400000

Please connect USB cable.

USB cable not detected.

Command exit.

-----------------------------------------------------------------------------------------------------------------------------------------------------------

After making changes to 'stm32mp157a-dk1-u-boot.dtsi' do I need to follow any procedure other than

make stm32mp15_basic_defconfig and DEVICE_TREE=stm32mp157c-dk2 make ?

Olivier GALLIEN
ST Employee

Hi @Arnas Celkys​ ,

Your process to build and update uboot looks far from the mainstream.

You are on stm32mp1-openstlinux-5.10-dunfell-mp1-21-11-17 aka DV3.1.

Uboot-spl (aka basic) is not supported in this version. Do not use stm32mp15_basic_defconfig.

Also BSP partitioning use FIP by default.

Except if you set back to legacy mode the whole image and tsv on SDCard, you can't dd the uboot binary as such.

I recommend to use default configuration and refer to :

How to cross-compile with the Developer Package - stm32mpu

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.

Thanks, @Community member​ ,

so just to make sure i understood my mistake fully -

1.1.after saving changes to stm32mp157a-dk1-u-boot.dtsi in <development-packet>/stm32mp1-openstlinux-5.10-dunfell-mp1-21-11-17/sources/arm-ostl-linux-gnueabi/u-boot-stm32mp-v2020.10-stm32mp-r2-r0/u-boot-stm32mp-v2020.10-stm32mp-r2/arch/arm/dts.

1.2. and optionally making changes to  'stm32mp1.c'

1.3.I should use

make -f $PWD/../Makefile.sdk all UBOOT_CONFIG=trusted UBOOT_DEFCONFIG=stm32mp15_trusted_defconfig UBOOT_BINARY=u-boot.dtb DEVICETREE="<xxxxxxx-custom>"

----- and this will generate fip-<xxxx-custom>-trusted.bin, and this .bin file is the only file that I need to upload (to fip dir on the pcb) to make changes to U-boot source and DT in U-boot, right?

Also am I correct in assuming all these changes will only affect DT in U-boot? - and therefore if I want to make changes on running OS (for example to use the USB-OTG with no ID or Vbuss pins when Os is runing), I will have to update the DT on the TF-A and/or Kernel? :)

also is is per-say I need to enter interactive DDR mode on stm32mp157c-dk2" eval board would this syntax be correct? I do not get any error notifications (when using make ....), but I am not sure if i interpret it correctly

make -f $PWD/../Makefile.sdk all UBOOT_CONFIG=trusted UBOOT_DEFCONFIG=stm32mp15_trusted_defconfig UBOOT_BINARY=u-boot.dtb DEVICETREE="stm32mp157c-dk2" DDR_INTERACTIVE=1

**************************************************update*****************************************************

when trying to boot it into board i get a fault, and for some reason board is detected as STM32MP157F. It would appear it is loading an old U-boot for some reason, I don't understand why file fip-stm32mp157c-dk2-trusted.bin is re-generated but somehow contains old code...

U-Boot 2020.10-stm32mp-r2 (Dec 22 2021 - 16:30:09 +0200)

CPU: STM32MP157CAC Rev.B

Model: STMicroelectronics STM32MP157F eval daughter on eval mother

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

my custom boot v3-----------------

Board: MB1272 Var2.0 Rev.C-01

DRAM: ERROR:  Illegal access to 0xf3afffb0:

ERROR:         FAIL_ID = 0x4a0

ERROR:         Non-Secure

ERROR:         Privilege

ERROR:         Read

PANIC at PC : 0x2ffc9b61

Exception mode=0x00000016 at: 0x2ffc9b61

----------------------------------------------------------------------------------------------

this is the make log:

#

# configuration written to .config

#

make[2]: Leaving directory '/home/arnas/STM32/stm32mp1-openstlinux-5.10-dunfell-mp1-21-11-17/sources/arm-ostl-linux-gnueabi/u-boot-stm32mp-v2020.10-stm32mp-r2-r0/build/stm32mp15_trusted_defconfig'

make[1]: Leaving directory '/home/arnas/STM32/stm32mp1-openstlinux-5.10-dunfell-mp1-21-11-17/sources/arm-ostl-linux-gnueabi/u-boot-stm32mp-v2020.10-stm32mp-r2-r0/u-boot-stm32mp-v2020.10-stm32mp-r2'

make[1]: Entering directory '/home/arnas/STM32/stm32mp1-openstlinux-5.10-dunfell-mp1-21-11-17/sources/arm-ostl-linux-gnueabi/u-boot-stm32mp-v2020.10-stm32mp-r2-r0/u-boot-stm32mp-v2020.10-stm32mp-r2'

make[2]: Entering directory '/home/arnas/STM32/stm32mp1-openstlinux-5.10-dunfell-mp1-21-11-17/sources/arm-ostl-linux-gnueabi/u-boot-stm32mp-v2020.10-stm32mp-r2-r0/build/stm32mp15_trusted_defconfig'

 GEN    ./Makefile

scripts/kconfig/conf --syncconfig Kconfig

 CFG    u-boot.cfg

 GEN    include/autoconf.mk

 GEN    include/autoconf.mk.dep

 CFGCHK u-boot.cfg

 Using /home/arnas/STM32/stm32mp1-openstlinux-5.10-dunfell-mp1-21-11-17/sources/arm-ostl-linux-gnueabi/u-boot-stm32mp-v2020.10-stm32mp-r2-r0/u-boot-stm32mp-v2020.10-stm32mp-r2 as source for U-Boot

 /home/arnas/STM32/stm32mp1-openstlinux-5.10-dunfell-mp1-21-11-17/sources/arm-ostl-linux-gnueabi/u-boot-stm32mp-v2020.10-stm32mp-r2-r0/u-boot-stm32mp-v2020.10-stm32mp-r2 is not clean, please run 'make mrproper'

 in the '/home/arnas/STM32/stm32mp1-openstlinux-5.10-dunfell-mp1-21-11-17/sources/arm-ostl-linux-gnueabi/u-boot-stm32mp-v2020.10-stm32mp-r2-r0/u-boot-stm32mp-v2020.10-stm32mp-r2' directory.

make[2]: *** [/home/arnas/STM32/stm32mp1-openstlinux-5.10-dunfell-mp1-21-11-17/sources/arm-ostl-linux-gnueabi/u-boot-stm32mp-v2020.10-stm32mp-r2-r0/u-boot-stm32mp-v2020.10-stm32mp-r2/Makefile:1813: prepare3] Error 1

make[2]: Leaving directory '/home/arnas/STM32/stm32mp1-openstlinux-5.10-dunfell-mp1-21-11-17/sources/arm-ostl-linux-gnueabi/u-boot-stm32mp-v2020.10-stm32mp-r2-r0/build/stm32mp15_trusted_defconfig'

make[1]: *** [Makefile:167: sub-make] Error 2

make[1]: Leaving directory '/home/arnas/STM32/stm32mp1-openstlinux-5.10-dunfell-mp1-21-11-17/sources/arm-ostl-linux-gnueabi/u-boot-stm32mp-v2020.10-stm32mp-r2-r0/u-boot-stm32mp-v2020.10-stm32mp-r2'

FIP_DEPLOYDIR_UBOOT=/home/arnas/STM32/stm32mp1-openstlinux-5.10-dunfell-mp1-21-11-17/sources/arm-ostl-linux-gnueabi/u-boot-stm32mp-v2020.10-stm32mp-r2-r0/u-boot-stm32mp-v2020.10-stm32mp-r2/../deploy FIP_DEVICETREE="stm32mp157c-dk2" fiptool-stm32mp

fiptool-stm32mp config:

 optee:

   bl32 config value: optee

   devicetree config: stm32mp157c-dk2

 trusted:

   bl32 config value: tfa

   devicetree config: stm32mp157c-dk2

 FIP_DEPLOYDIR_FIP  : /home/arnas/STM32/stm32mp1-openstlinux-5.10-dunfell-mp1-21-11-17/sources/arm-ostl-linux-gnueabi/u-boot-stm32mp-v2020.10-stm32mp-r2-r0/u-boot-stm32mp-v2020.10-stm32mp-r2/../deploy/fip

 FIP_DEPLOYDIR_TFA  : /home/arnas/STM32/stm32mp1-openstlinux-5.10-dunfell-mp1-21-11-17/sources/arm-ostl-linux-gnueabi/u-boot-stm32mp-v2020.10-stm32mp-r2-r0/u-boot-stm32mp-v2020.10-stm32mp-r2/../../FIP_artifacts/arm-trusted-firmware/bl32

 FIP_DEPLOYDIR_FWCONF: /home/arnas/STM32/stm32mp1-openstlinux-5.10-dunfell-mp1-21-11-17/sources/arm-ostl-linux-gnueabi/u-boot-stm32mp-v2020.10-stm32mp-r2-r0/u-boot-stm32mp-v2020.10-stm32mp-r2/../../FIP_artifacts/arm-trusted-firmware/fwconfig

 FIP_DEPLOYDIR_OPTEE : /home/arnas/STM32/stm32mp1-openstlinux-5.10-dunfell-mp1-21-11-17/sources/arm-ostl-linux-gnueabi/u-boot-stm32mp-v2020.10-stm32mp-r2-r0/u-boot-stm32mp-v2020.10-stm32mp-r2/../../FIP_artifacts/optee

 FIP_DEPLOYDIR_UBOOT : /home/arnas/STM32/stm32mp1-openstlinux-5.10-dunfell-mp1-21-11-17/sources/arm-ostl-linux-gnueabi/u-boot-stm32mp-v2020.10-stm32mp-r2-r0/u-boot-stm32mp-v2020.10-stm32mp-r2/../deploy

[fiptool] Create fip-stm32mp157c-dk2-optee.bin fip binary into 'FIP_DEPLOYDIR_FIP' folder...

[fiptool] Done

[fiptool] Create fip-stm32mp157c-dk2-trusted.bin fip binary into 'FIP_DEPLOYDIR_FIP' folder...

[fiptool] Done

Ok just to make sure that i have left-over configuration I tired to 'make clean' - that did not work so I deleted and re-extracted entire boot source directory.

1.step. Deleted and reextracted boot source .../u-boot-stm32mp-v2020.10-stm32mp-r2.

2.step.

>>make stm32mp15_trusted_defconfig

<<#

<<# configuration written to .config

<<#

3.step.

Configured $FIP_DEPLOYDIR_ROOT and $FIP_DEPLOYDIR_FIP - according to my source locations

4.step.

>>make -f $PWD/../Makefile.sdk all UBOOT_CONFIG=trusted UBOOT_DEFCONFIG=stm32mp15_trusted_defconfig UBOOT_BINARY=u-boot.dtb DEVICETREE="stm32mp157c-dk2" DDR_INTERACTIVE=1

<< /.../

[fiptool] Create fip-stm32mp157c-dk2-optee.bin fip binary into 'FIP_DEPLOYDIR_FIP' folder...

[fiptool] Done

[fiptool] Create fip-stm32mp157c-dk2-trusted.bin fip binary into 'FIP_DEPLOYDIR_FIP' folder...

[fiptool] Done

5.step.

connect board in mmc mode via USB-ORG and store file fip-stm32mp157c-dk2-trusted.bin from the fip dir in my u-boot source directory and reboot the board.

 ---------------------------------------------------------------------------------------------------

Also tried using :

>>make clean && make mrproper

before

>>make -f $PWD/../Makefile.sdk all UBOOT_CONFIG=trusted UBOOT_DEFCONFIG=stm32mp15_trusted_defconfig UBOOT_BINARY=u-boot.dtb DEVICETREE="stm32mp157c-dk2" DDR_INTERACTIVE=1

But it still does not entirely clean old models, what should be procedure to clean DT and source of U-boot fully before making changes?

Olivier GALLIEN
ST Employee

Hi @Arnas Celkys​ ,

Sorry for my previous comment which have confused you.

uboot-spl is supported ONLY for DDR_INTERACTIVE support.

For such please follow strictly the wiki page :

U-Boot SPL: DDR interactive mode - stm32mpu

Else to manage USB mass storage - original question - it's recommended to use default Trusted/ FIP configuration.

In this case generation of proper uboot follow guideline in

How to cross-compile with the Developer Package - stm32mpu

Else, for your point :

1.1.after saving changes to stm32mp157a-dk1-u-boot.dtsi 

It's not recommanded to change .dtsi files. All customization might be done at board level ( .dts)

cf warning in page OTG device tree configuration - stm32mpu

And read here to get full structure of DT :

STM32MP15 device tree - stm32mpu

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.

Thanks, @Community member​ 

Could you help me out with this issue:

First I would like to ended DDR interactive mode using "stm32mp15_trusted_defconfig" rather then "stm32mp15_basic_defconfig".

So I proceed like so :

>>make clean && make mrproper

<<

   CLEAN  scripts/basic

   CLEAN  scripts/kconfig

   CLEAN  .config

>>make stm32mp15_trusted_defconfig

<<

   #

   # configuration written to .config

   #

>>DEVICE_TREE=stm32mp157c-dk2 DDR_INTERACTIVE=1 make

<<

 CC     drivers/core/simple-bus.o

 CC     drivers/core/dump.o

 CC     drivers/core/regmap.o

 CC     drivers/core/syscon-uclass.o

 CC     drivers/core/of_extra.o

 CC     drivers/core/ofnode.o

drivers/core/ofnode.c:239:6: error: redefinition of ‘ofnode_is_enabled’

 239 | bool ofnode_is_enabled(ofnode node)

     |     ^~~~~~~~~~~~~~~~~

drivers/core/ofnode.c:229:6: note: previous definition of ‘ofnode_is_enabled’ was here

 229 | bool ofnode_is_enabled(ofnode node)

     |     ^~~~~~~~~~~~~~~~~

make[2]: *** [scripts/Makefile.build:266: drivers/core/ofnode.o] Error 1

make[1]: *** [scripts/Makefile.build:419: drivers/core] Error 2

make: *** [Makefile:1780: drivers] Error 2

and get this wierd error of double definition of 'ofnode_is_enabled', was my 'ofnode.c' file corrupted? Should I re-download it?

----------------------------------------------------------------------------------------------------------

Also after successful "DEVICE_TREE=stm32mp157c-dk2 DDR_INTERACTIVE=1 make", should I upload u-boot-spl.stm32 and u-boot.img to /fip + /fsbl1 + /fsbl2 ? Or should I follow different steps?

It does not define it in U-Boot SPL: DDR interactive mode - stm32mpu

----------------------------------------------------------------------------------------------------------

Olivier GALLIEN
ST Employee

Hi @Arnas Celkys​ 

DDR_INTERACTIVE=1 is only supported in "stm32mp15_basic_defconfig" not with "stm32mp15_trusted_defconfig" .

----------------------------------------------------------------------------------------------------------

Also after successful "DEVICE_TREE=stm32mp157c-dk2 DDR_INTERACTIVE=1 make", should I upload u-boot-spl.stm32 and u-boot.img to /fip + /fsbl1 + /fsbl2 ? Or should I follow different steps?

It does not define it in U-Boot SPL: DDR interactive mode - stm32mpu

----------------------------------------------------------------------------------------------------------

Yes it is. See chapter 3 Load the SPL into embedded RAM

You can ignore FIP in this case. Uboot spl will come in fsbl partition.

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.