Skip to main content
Arnas Celkys
Associate III
December 27, 2021
Solved

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

  • December 27, 2021
  • 5 replies
  • 5045 views

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.

This topic has been closed for replies.
Best answer by Olivier GALLIEN

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

5 replies

PatrickF
Technical Moderator
January 3, 2022

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.NEW ! Sidekick STM32 AI agent, see here
Arnas Celkys
Associate III
January 4, 2022

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
Technical Moderator
January 4, 2022

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.
Arnas Celkys
Associate III
January 4, 2022

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? :)

Olivier GALLIEN
Technical Moderator
January 5, 2022

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.
Arnas Celkys
Associate III
January 6, 2022

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
Technical Moderator
January 6, 2022

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.
Arnas Celkys
Associate III
January 6, 2022

oh yeah, @Community member​  it does i missed it. So to enter DDR interactive I have to use the U-Boot SPL - got it now.

And getting back to the original questions I should be using the FIP - to make any other changes related to DT or software of U-boot.

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

I am getting the same  'ofnode.c' redefinition error when trying the U-Boot SPL - perhaps I have corrupted the uboot-source directory somehow - what else could cause it?

Olivier GALLIEN
Technical Moderator
January 6, 2022

Not clue for this specific issue.

But might be probably good to restart for a fresh installation of Uboot source directory.

Since you have made several trials, even clean and mrproper may not be enough to put back all things right.

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.