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.

17 REPLIES 17

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?

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.

@Community member​ - thanks for clarification. I cleaned and remade the entire source-boot dir, and made changes to UBOOT-spl succesfully to enter the DDR interactive mode. So the error was indeed caused by corrupt files on the directory.

Next i tried to make the DT changes on FIP:

printf('-----------\n')  /// in U-boot source 'stm32mp1.c'

and

    &usbotg_hs {

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

       u-boot,force-vbus-detection;

       dr_mode = "peripheral";

    };                  /// in U-boot device-tree <board>-u-boot.dtsi == 'stm32mp157a-dk1-u-boot.dtsi'

Then continue with FIP generation:

>>make stm32mp15_trusted_defconfig

>>

 HOSTCC scripts/basic/fixdep

 HOSTCC scripts/kconfig/conf.o

 YACC   scripts/kconfig/zconf.tab.c

 LEX    scripts/kconfig/zconf.lex.c

 HOSTCC scripts/kconfig/zconf.tab.o

 HOSTLD scripts/kconfig/conf

#

# configuration written to .config

#

>>export FIP_DEPLOYDIR_ROOT=$PWD/../../FIP_artifacts

<<

>>export FIP_DEPLOYDIR_FIP=$PWD/../deploy/fip

<<

>> make clean && make mrproper

<<

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

 <<

[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

<<

****************

Updated: I have to use '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" ', or else there are issues with u-boot-<>-trsuted.dtb file detection in <development-distribution>stm32mp1-openstlinux-5.10-dunfell-mp1-21-11-17/sources/arm-ostl-linux-gnueabi/FIP_artifacts/u-boot

This generates the file but when I upload it the usb is still not 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.

I have even tried making syntax faults i the file I am using to make sure I have made adjustments to correct file. Syntax errors on 'stm32mp157a-dk1-u-boot.dtsi' did promp EERORS when trying to make u-boot image using FIP - so my guess is I am adding code on correct file.

Is there any way to make sure that my changes on stm32mp157a-dk1-u-boot.dtsi - were used in this boot?

You were correct, @Community member​  - thanks!

UBOOT with SPL and FIP is working! But after making those changes I still can detect the USB:

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.

I have even tried making syntax errors in the file I am using to make sure I have made adjustments to correct file. Syntax errors on 'stm32mp157a-dk1-u-boot.dtsi' did prompt ERRORS when trying to make u-boot image using FIP - so my guess is I am adding code on correct file.

Is there any way to make sure that my changes on stm32mp157a-dk1-u-boot.dtsi - are being used in this uboot?

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

Changes in question:

&usbotg_hs {

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

u-boot,force-vbus-detection;

dr_mode = "peripheral";

};

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

Hi @Arnas Celkys​ ,

Again,

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

To be sure what is embed in your dtb you can use "dtc" command to uncompile it and get readable flat .dts format.

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.

Hey, @Community member​ , great information!

So if I understood correctly - all peripherals nodes can be configured, by making changes to arch/arm/boot/dts/stm32mp15xxxx.dts files instead of .dtsi (following the warning).

But 'stm32mp157x-dk2.dts' does not contain the &usbotg node, only &cryp1/&dsi/&i2c1 /&ltdc/&rtc/&sdmmc2/&usart2 nodes... Can it be added to device-tree-source (xx.dts)file? Will I need to make any changes to (<dts-file-name>-u-boot.dtsi) device-tree-source-include also?

Thanks for the support! 🙂

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.

Thanks @Community member​ 

Issue was solved by editing the &usbotg_hs according to your recommendations and also removing the sub-node stusb1600 in &i2c4 node. Then re-built new device tree blog, and now it works on both the custom and eval boards.

Thanks for the help! 🙂