2023-05-08 07:14 AM
Hi all,
I updated my project from Morty (2.2) to Kirkstone (4.1). After doing the required fixes/updates on the recipes, I have problems booting the FSBL. I am using the Cube Programmer to flash the image. Below is the log:
STM32CubeProgrammer API v2.13.0 | Windows-64Bits
Read TSV File: C:\temp\stm32mp1-customized-img-kirkstone-alpha2\flashlayout_custom-os-image-debug\trusted\FlashLayout_nand-4-256_stm32mp153a-customized-img-cubemx-mx-trusted.tsv
Number of partitions: 11
UR connection mode is defined with the HWrst reset mode
Device Descriptor:
|_bLength : 0x12
|_bDescriptorType : 0x01
|_bcdUSB : 0x0200
|_bDeviceClass : 0x00
|_bDeviceSubClass : 0x00
|_bDeviceProtocol : 0x00
|_bMaxPacketSize : 0x40
|_idVendor : 0x0483
|_idProduct : 0xdf11
|_bcdDevice : 0x0200
|_iManufacturer : 0x01
|_iProduct : 0x02
|_iSerialNumber : 0x03
|_bNumConfigurations : 0x01
Configuration Descriptor:
|_bLength : 0x09
|_bDescriptorType : 0x02
|_wTotalLength : 0x48
|_bNumInterfaces : 0x01
|_bConfigurationValue : 0x01
|_iConfiguration : 0x02
|_bmAttributes : 0xc0
|_bMaxPower : 0x01
Interface Descriptor Alternate Settings: 0x00
|_bLength : 0x09
|_bDescriptorType : 0x04
|_bInterfaceNumber : 0x00
|_bAlternateSetting : 0x00
|_bNumEndpoints : 0x00
|_bInterfaceClass : 0xfe
|_bInterfaceSubClass : 0x01
|_bInterfaceProtocol : 0x02
|_iInterface : 0x06
Interface Descriptor Alternate Settings: 0x01
|_bLength : 0x09
|_bDescriptorType : 0x04
|_bInterfaceNumber : 0x00
|_bAlternateSetting : 0x01
|_bNumEndpoints : 0x00
|_bInterfaceClass : 0xfe
|_bInterfaceSubClass : 0x01
|_bInterfaceProtocol : 0x02
|_iInterface : 0x07
Interface Descriptor Alternate Settings: 0x02
|_bLength : 0x09
|_bDescriptorType : 0x04
|_bInterfaceNumber : 0x00
|_bAlternateSetting : 0x02
|_bNumEndpoints : 0x00
|_bInterfaceClass : 0xfe
|_bInterfaceSubClass : 0x01
|_bInterfaceProtocol : 0x02
|_iInterface : 0x08
Interface Descriptor Alternate Settings: 0x03
|_bLength : 0x09
|_bDescriptorType : 0x04
|_bInterfaceNumber : 0x00
|_bAlternateSetting : 0x03
|_bNumEndpoints : 0x00
|_bInterfaceClass : 0xfe
|_bInterfaceSubClass : 0x01
|_bInterfaceProtocol : 0x02
|_iInterface : 0x09
Interface Descriptor Alternate Settings: 0x04
|_bLength : 0x09
|_bDescriptorType : 0x04
|_bInterfaceNumber : 0x00
|_bAlternateSetting : 0x04
|_bNumEndpoints : 0x00
|_bInterfaceClass : 0xfe
|_bInterfaceSubClass : 0x01
|_bInterfaceProtocol : 0x02
|_iInterface : 0x0a
Interface Descriptor Alternate Settings: 0x05
|_bLength : 0x09
|_bDescriptorType : 0x04
|_bInterfaceNumber : 0x00
|_bAlternateSetting : 0x05
|_bNumEndpoints : 0x00
|_bInterfaceClass : 0xfe
|_bInterfaceSubClass : 0x01
|_bInterfaceProtocol : 0x02
|_iInterface : 0x0b
Functional Descriptor :
|_bLength : 0x09
|_bDescriptorType : 0x21
|_bmAttributes : 0x0f
|_wDetachTimeOut : 0xff
|_wTransferSize : 0x0400
|_bcdDFUVersion : 0x0110
USB speed : High Speed (480MBit/s)
Manuf. ID : STMicroelectronics
Product ID : DFU in HS Mode @Device ID /0x500, @Revision ID /0x0000
SN : 002A00253430510537333734
DFU protocol: 1.1
Board : --
Device ID : 0x0500
Start Embedded Flashing service
sending a set alternate setting request with index: 5
receiving packet
DFU status = 0
DFU State = 2
UpLoading data
DFU status = 0
DFU State = 2
sending a set alternate setting request with index: 1
Memory Programming ...
Opening and parsing file: tf-a-stm32mp153a-customized-img-cubemx-mx-usb.stm32
File : tf-a-stm32mp153a-customized-img-cubemx-mx-usb.stm32
Size : 220.82 KB
Partition ID : 0x01
Download in Progress:
Size : 226117 Bytes
sending packet nbr: 0
DFU status = 0
DFU State = 2
Status: 0, State: 2
DFU status = 0
DFU State = 4
DFU status = 0
DFU State = 5
sending packet nbr: 1
DFU status = 0
DFU State = 5
Status: 0, State: 5
DFU status = 0
DFU State = 4
DFU status = 0
DFU State = 5
sending packet nbr: 2
DFU status = 0
DFU State = 5
Status: 0, State: 5
DFU status = 0
DFU State = 4
DFU status = 0
DFU State = 5
sending packet nbr: 3
DFU status = 0
DFU State = 5
Status: 0, State: 5
DFU status = 0
DFU State = 4
DFU status = 0
DFU State = 5
sending packet nbr: 4
DFU status = 0
DFU State = 5
Status: 0, State: 5
DFU status = 0
DFU State = 4
DFU status = 0
DFU State = 5
/*...*/
/* skipped */
/*...*/
sending packet nbr: 216
DFU status = 0
DFU State = 5
Status: 0, State: 5
DFU status = 0
DFU State = 4
DFU status = 0
DFU State = 5
sending packet nbr: 217
DFU status = 0
DFU State = 5
Status: 0, State: 5
DFU status = 0
DFU State = 4
DFU status = 0
DFU State = 5
sending packet nbr: 218
DFU status = 0
DFU State = 5
Status: 0, State: 5
DFU status = 0
DFU State = 4
DFU status = 0
DFU State = 5
sending packet nbr: 219
DFU status = 0
DFU State = 5
Status: 0, State: 5
DFU status = 0
DFU State = 4
DFU status = 0
DFU State = 5
sending packet nbr: 220
DFU status = 0
DFU State = 5
Status: 0, State: 5
DFU status = 0
DFU State = 4
DFU status = 0
DFU State = 5
Segment[0] downloaded successfully
File download complete
Time elapsed during download operation: 00:00:01.186
RUNNING Program ...
PartID: :0x01
DFU status = 0
DFU State = 5
sending a dfu end of download request
DFU status = 0
DFU State = 7
DFU status = 0
DFU State = 2
sending a set alternate setting request with index: 5
receiving packet
sending a clear status request
an error occured after sending the clear status request
Status: errUNKNOWN, State: dfuERROR
sending a clear status request
an error occured after sending the clear status request
Status: errUNKNOWN, State: dfuERROR
sending a clear status request
an error occured after sending the clear status request
Status: errUNKNOWN, State: dfuERROR
sending a clear status request
an error occured after sending the clear status request
Status: errUNKNOWN, State: dfuERROR
sending a clear status request
an error occured after sending the clear status request
Status: errUNKNOWN, State: dfuERROR
sending a clear status request
an error occured after sending the clear status request
Status: errUNKNOWN, State: dfuERROR
sending a clear status request
an error occured after sending the clear status request
Status: errUNKNOWN, State: dfuERROR
sending a clear status request
an error occured after sending the clear status request
Status: errUNKNOWN, State: dfuERROR
sending a clear status request
an error occured after sending the clear status request
Status: errUNKNOWN, State: dfuERROR
sending a clear status request
an error occured after sending the clear status request
Status: errUNKNOWN, State: dfuERROR
unable to switch the device to dfuIDLE state
Error: an error occured while uploading data from the virtual partition 0xF1
Error: Start operation failed at partition 0x01
Error: TSV flashing service failed
I checked the FAQ-STM32MP1-bring-up-troubleshooting-guide, but it didn't help.
I think the "unable to switch the device to dfuIDLE state" might be caused by the TF-A not executing properly rather than some device-host communication issue.
Some repo versions:
Does anyone have some idea how to proceed ?
Best Regards.
Solved! Go to Solution.
2023-05-26 01:44 AM
Hi @Vinícius Franchini ,
In your DT I notice there's no node in fmc node
nand-controller@4,0 {
status = "okay";
}
While it seems to be required for FMC NAND configuration
FMC device tree configuration - stm32mpu
Olivier
2023-05-26 02:00 AM
Hi @Community member
I saw this before and I gave a try already for the following:
&fmc{
pinctrl-names = "default";
pinctrl-0 = <&fmc_pins_mx>;
status = "okay";
/* USER CODE BEGIN fmc */
#address-cells = <1>;
#size-cells = <0>;
nand-controller@4,0 {
status = "okay";
nand@0 {
reg = <0>;
nand-on-flash-bbt;
#address-cells = <1>;
#size-cells = <1>;
};
};
/* USER CODE END fmc */
};
However, the error was the same.
I am trying to understand what causes the nand0 device to not be registered. By what I have read, it points to either wrong dts or wrong pinout. I have double check both and also compared with the previous working version. So clearly there is some unnoticed detail I am not seen.
Thank you.
Best Regards.
2023-05-26 02:29 AM
Hi @Vinícius Franchini ,
Please confirm you applied change in U-boot DTS right ?
Else, more than usual for DTS syntax ... devil can be in the details. ( eg some syntax may have changed from - to _ or vice-versa )
I understand you compared dunfell and kirkstone dts .. but did you try to compare kirkstone with for exemple STM32MP157F-EV1 board generated by CubeMX ?
Olivier
2023-05-26 02:44 AM
Hi @Community member
I edited just the TF-A, as the `uclass_get_device_by_phandle_id: err=-19` error appears before the U-Boot initialization. But I can also try this on the U-Boot dts.
I compared only with the STM32MP153AABx code generated by the CubeMX. I will also try the STM32MP157F-EV1
Thank you.
2023-05-26 02:50 AM
Hi @Vinícius Franchini ,
In this previous post, I explained how ST recommends to handle the migration from an ecosystem to another from a DTS point of view: https://community.st.com/s/question/0D53W00001Xwf71SAB/unable-to-initialize-usb-otg
It is recommended to compare with a board delivered by ST.
I would advise to follow these steps (with your CubeMX versions, not the ones of the previous post) to be sure that you are not missing a change between the two versions of your DTS files.
Best Regards,
Kevin
2023-05-26 07:55 AM
Hi @Community member
I did as suggested. I am comparing my kirkstone update with the example STM32MP157F-EV1 board generated by CubeMX. So I updated the dts for TF-A, U-Boot and Kernel. The only differences now seem the pin configurations and labels. The entries syntax seem similar now.
Now the system manages to identify the NAND and boot from the USB in order to flash the bootloader and the partitions :).
However after that when booting from the NAND, the bootloader cannot find the UBI partition (where the STLinux image itself is stored). The log is below.
Now I think the problem not related to some configuration on the dts anymore but to some partition issue. As the bootloader from the NAND is working, I think it is properly set on the dts. The tsv file for the kirkstone version is quite different from the dunfell. I thought this would be enough to setup the partitions, but probably I am wrong. I also didn't have any partition setup on the dts before and the STM32MP157F-EV1 also has none.
I was checking for some similar issue here https://community.st.com/s/question/0D53W00000rY82xSAC/still-unable-to-boot-from-qspinand. Do I need to patch the meta-st-stm32mp recipes even if the UBI sizes where tuned at the Dunfell?
How could I proceed?
Thank you.
NOTICE: CPU: STM32MP153AAB Rev.B
NOTICE: Model: STMicroelectronics custom STM32CubeMX board - openstlinux-5.15-yocto-kirkstone-mp1-v22.11.23
INFO: PMIC version = 0x21
INFO: Reset reason (0x14):
INFO: Pad Reset from NRST
INFO: FCONF: Reading TB_FW firmware configuration file from: 0x2ffe2000
INFO: FCONF: Reading firmware configuration information for: stm32mp_io
INFO: Using FMC NAND
INFO: Instance 1
INFO: Boot used partition fsbl1
NOTICE: BL2: v2.6-stm32mp1-r1.0(debug):v2.6-dirty
NOTICE: BL2: Built : 13:14:26, Nov 23 2021
INFO: BL2: Doing platform setup
INFO: RAM: DDR3-DDR3L 16bits 533000kHz
INFO: Memory size = 0x10000000 (256 MB)
INFO: BL2: Loading image id 31
INFO: Loading image id=31 at address 0x2ffff000
INFO: Image id=31 loaded: 0x2ffff000 - 0x2ffff226
INFO: FCONF: Reading FW_CONFIG firmware configuration file from: 0x2ffff000
INFO: FCONF: Reading firmware configuration information for: dyn_cfg
INFO: FCONF: Reading firmware configuration information for: stm32mp1_firewall
INFO: BL2: Loading image id 4
INFO: Loading image id=4 at address 0x2ffc5000
INFO: Image id=4 loaded: 0x2ffc5000 - 0x2ffd9820
INFO: BL2: Skip loading image id 21
INFO: BL2: Skip loading image id 22
INFO: BL2: Loading image id 23
INFO: Loading image id=23 at address 0xc0500000
INFO: Image id=23 loaded: 0xc0500000 - 0xc0512958
INFO: BL2: Loading image id 26
INFO: Loading image id=26 at address 0x2ffc0000
INFO: Image id=26 loaded: 0x2ffc0000 - 0x2ffc3d64
INFO: BL2: Loading image id 5
INFO: Loading image id=5 at address 0xc0100000
INFO: Image id=5 loaded: 0xc0100000 - 0xc01ece88
NOTICE: BL2: Booting BL32
INFO: Entry point address = 0x2ffc5000
INFO: SPSR = 0x1d3
NOTICE: SP_MIN: v2.6-stm32mp1-r1.0(debug):v2.6-dirty
NOTICE: SP_MIN: Built : 13:14:26, Nov 23 2021
INFO: ARM GICv2 driver initialized
INFO: ETZPC: UART1 (3) could be non secure
INFO: ETZPC: SPI6 (4) could be non secure
INFO: ETZPC: HASH1 (8) could be non secure
INFO: ETZPC: CRYP1 (9) could be non secure
INFO: ETZPC: I2C6 (12) could be non secure
INFO: SP_MIN: Initializing runtime services
INFO: SP_MIN: Preparing exit to normal world
serial_stm32 serial@40018000: pinctrl_select_state_full: uclass_get_device_by_phandle_id: err=-19
U-Boot 2021.10-stm32mp-r1 (Oct 04 2021 - 15:09:26 +0000)
CPU: STM32MP153AAB Rev.B
Model: STMicroelectronics custom STM32CubeMX board - openstlinux-5.15-yocto-kirkstone-mp1-v22.11.23
Board: stm32mp1 in trusted mode (st,stm32mp153a-customized-img-cubemx-mx)
DRAM: 256 MiB
Clocks:
- MPU : 650 MHz
- MCU : 200 MHz
- AXI : 266.500 MHz
- PER : 24 MHz
- DDR : 533 MHz
WDT: Started with servicing (32s timeout)
NAND: 512 MiB
MMC:
Loading Environment from UBI... ubi0 error: vtbl_check: too large reserved_pebs 3049, good PEBs 1972
ubi0 error: vtbl_check: volume table check failed: record 3, error 9
Volume table record 3 dump:
reserved_pebs 3049
alignment 1
data_pad 0
vol_type 1
upd_marker 0
name_len 6
name rootfs
crc 0x9da1325c
ubi0 error: ubi_attach_mtd_dev: failed to attach mtd9, error -22
UBI error: cannot attach mtd9
UBI error: cannot initialize UBI, error -22
UBI init error 22
Please check, if the correct MTD partition is used (size big enough?)
** Cannot find mtd partition "UBI"
In: serial
Out: serial
Err: serial
invalid MAC address 0 in OTP 00:00:00:00:00:00
Net:
Error: ethernet@5800a000 address not set.
No ethernet found.
No autoboot delay. Start Custom OSBoot over nand0!
Saving Environment to UBI... ubi0 error: vtbl_check: too large reserved_pebs 3049, good PEBs 1972
ubi0 error: vtbl_check: volume table check failed: record 3, error 9
Volume table record 3 dump:
reserved_pebs 3049
alignment 1
data_pad 0
vol_type 1
upd_marker 0
name_len 6
name rootfs
crc 0x9da1325c
ubi0 error: ubi_attach_mtd_dev: failed to attach mtd9, error -22
UBI error: cannot attach mtd9
UBI error: cannot initialize UBI, error -22
UBI init error 22
Please check, if the correct MTD partition is used (size big enough?)
** Cannot find mtd partition "UBI"
Failed (1)
ubi0 error: vtbl_check: too large reserved_pebs 3049, good PEBs 1972
ubi0 error: vtbl_check: volume table check failed: record 3, error 9
Volume table record 3 dump:
reserved_pebs 3049
alignment 1
data_pad 0
vol_type 1
upd_marker 0
name_len 6
name rootfs
crc 0x9da1325c
ubi0 error: ubi_attach_mtd_dev: failed to attach mtd9, error -22
UBI error: cannot attach mtd9
UBI error: cannot initialize UBI, error -22
UBI init error 22
Please check, if the correct MTD partition is used (size big enough?)
STM32MP>
2023-05-26 08:31 AM
Hi @Kevin HUBER .
I checked your recommendations and it is somehow where I am now as described in my latest reply after the @Community member suggestion to compare my project with the STM32MP157F-EV1 board. My issue now is related to the UBI partition. Could you take a look on the reply?
Thank you
2023-05-26 09:50 AM
Hello @Vinícius Franchini ,
Good to know that you are making progress.
The TSV file that you sent previously looks good and is similar to the one provided by ST as an example.
To help you on the UBI partition, I will need:
STM32MP> env print
As explained here: ttps://wiki.st.com/stm32mpu/wiki/STM32CubeProgrammer_flashlayout#MTD_partition_sizes
You must be sure to have in "CONFIG_MTDPARTS_NAND0_BOOT" the correct configuration of your partitions size and order.
The way to proceed to update this variable is explained in the wiki: ttps://wiki.st.com/stm32mpu/wiki/How_to_configure_U-Boot_for_your_board#MTD_partitions
Best Regards,
Kevin
2023-05-29 11:48 PM
Hello @Kevin HUBER.
Please see the environment log below and the Uboot dts attached.
STM32MP> env print
arch=arm
autoload=no
baudrate=115200
board=stm32mp1
board_name=stm32mp153a-customized-os-cubemx-mx
boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} ${prefix}${script}; source ${scriptaddr}
boot_device=nand
boot_efi_binary=load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} efi/boot/bootarm.efi; if fdt addr ${fdt_addr_r}; then bootefi ${kernel_addr_r} ${fdt_addr_r};else bootefi ${kernel_addr_r} ${fdtcontroladdr};fi
boot_efi_bootmgr=if fdt addr ${fdt_addr_r}; then bootefi bootmgr ${fdt_addr_r};else bootefi bootmgr;fi
boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any ${scriptaddr} ${prefix}${boot_syslinux_conf}
boot_instance=0
boot_net_usb_start=true
boot_prefixes=/ /boot/
boot_script_dhcp=boot.scr.uimg
boot_scripts=boot.scr.uimg boot.scr
boot_syslinux_conf=extlinux/extlinux.conf
boot_targets=ubifs0
bootcmd=run bootcmd_stm32mp
bootcmd_mmc0=devnum=0; run mmc_boot
bootcmd_mmc1=devnum=1; run mmc_boot
bootcmd_mmc2=devnum=2; run mmc_boot
bootcmd_pxe=run boot_net_usb_start; dhcp; if pxe get; then pxe boot; fi
bootcmd_stm32mp=echo "Boot over ${boot_device}${boot_instance}!";if test ${boot_device} = serial || test ${boot_device} = usb;then stm32prog ${boot_device} ${boot_instance}; else run env_check;if test ${boot_device} = mmc;then env set boot_targets "mmc${boot_instance}"; fi;if test ${boot_device} = nand || test ${boot_device} = spi-nand ;then env set boot_targets ubifs0; fi;if test ${boot_device} = nor;then env set boot_targets mmc0; fi;run distro_bootcmd;fi;
bootcmd_ubifs0=devnum=0; run ubifs_boot
bootcmd_usb0=devnum=0; run usb_boot
bootdelay=1
bootubipart=UBI
bootubivol=boot
console=ttySTM0
cpu=armv7
distro_bootcmd=for target in ${boot_targets}; do run bootcmd_${target}; done
efi_dtb_prefixes=/ /dtb/ /dtb/current/
env_check=if env info -p -d -q; then env save; fi
fdt_addr_r=0xc4000000
fdtcontroladdr=cdefc530
fdtfile=stm32mp153a-raichu-cubemx-mx.dtb
fdtoverlay_addr_r=0xc4300000
kernel_addr_r=0xc2000000
load_efi_dtb=load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${prefix}${efi_fdtfile}
loadaddr=0xc2000000
mmc_boot=if mmc dev ${devnum}; then devtype=mmc; run scan_dev_for_boot_part; fi
mtdids=nand0=nand0
mtdparts=mtdparts=nand0:512k(fsbl1),512k(fsbl2),512k(metadata1),512k(metadata2),4m(fip-a1),4m(fip-a2),4m(fip-b1),4m(fip-b2),-(UBI)
partitions=name=ssbl,size=2M;name=bootfs,size=64MB,bootable;name=vendorfs,size=16M;name=rootfs,size=746M;name=userfs,size=-
pxefile_addr_r=0xc4200000
ramdisk_addr_r=0xc4400000
scan_dev_for_boot=echo Scanning ${devtype} ${devnum}:${distro_bootpart}...; for prefix in ${boot_prefixes}; do run scan_dev_for_extlinux; run scan_dev_for_scripts; done;run scan_dev_for_efi;
scan_dev_for_boot_part=part list ${devtype} ${devnum} -bootable devplist; env exists devplist || setenv devplist 1; for distro_bootpart in ${devplist}; do if fstype ${devtype} ${devnum}:${distro_bootpart} bootfstype; then run scan_dev_for_boot; fi; done; setenv devplist
scan_dev_for_efi=setenv efi_fdtfile ${fdtfile}; if test -z "${fdtfile}" -a -n "${soc}"; then setenv efi_fdtfile ${soc}-${board}${boardver}.dtb; fi; for prefix in ${efi_dtb_prefixes}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${efi_fdtfile}; then run load_efi_dtb; fi;done;run boot_efi_bootmgr;if test -e ${devtype} ${devnum}:${distro_bootpart} efi/boot/bootarm.efi; then echo Found EFI removable media binary efi/boot/bootarm.efi; run boot_efi_binary; echo EFI LOAD FAILED: continuing...; fi; setenv efi_fdtfile
scan_dev_for_extlinux=if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${boot_syslinux_conf}; then echo Found ${prefix}${boot_syslinux_conf}; run boot_extlinux; echo SCRIPT FAILED: continuing...; fi
scan_dev_for_scripts=for script in ${boot_scripts}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${script}; then echo Found U-Boot script ${prefix}${script}; run boot_a_script; echo SCRIPT FAILED: continuing...; fi; done
scriptaddr=0xc4100000
serial#=002C002C3430510537333734
serverip=192.168.1.1
soc=stm32mp
soc_pkg=AB
soc_rev=Z
soc_type=153A
ubifs_boot=env exists bootubipart || env set bootubipart UBI; env exists bootubivol || env set bootubivol boot; if ubi part ${bootubipart} && ubifsmount ubi${devnum}:${bootubivol}; then devtype=ubi; run scan_dev_for_boot; fi
usb_boot=usb start; if usb dev ${devnum}; then devtype=usb; run scan_dev_for_boot_part; fi
usb_pgood_delay=1000
vendor=st
Environment size: 4412/8187 bytes
2023-05-29 11:49 PM