cancel
Showing results for 
Search instead for 
Did you mean: 

DFU mode stops abruptly

angeloc
Associate

We have a custom design based on STMP32MP133A na an spi NAND. On paper, using the u-boot diagnostic commands, everything is working correctly.

NOTICE:  CPU: STM32MP133A Rev.Y
NOTICE:  Model: Zehnder CCPRO A1R Board
INFO:    PMIC version = 0x21
INFO:    Reset reason (0x35):
INFO:      Power-on Reset (rst_por)
INFO:    FCONF: Reading TB_FW firmware configuration file from: 0x2ffe0000
INFO:    FCONF: Reading firmware configuration information for: stm32mp_io
INFO:    Using USB
INFO:      Instance 2
INFO:    Boot used partition fsbl1
NOTICE:  BL2: v2.6-stm32mp1-r2.1(debug):v2.6-dirty(a1f02f4f)
NOTICE:  BL2: Built : 13:14:26, Nov 23 2021
INFO:    BL2: Doing platform setup
INFO:    RAM: DDR3-1066 bin F 1x2Gb 533MHz v1.53
INFO:    Memory size = 0x10000000 (256 MB)
INFO:    DFU USB START...
INFO:    handle USB : Suspend int
INFO:    USB Suspend mode
INFO:    handle USB : Reset
INFO:    handle USB : Reset
INFO:    phase ID :3, Manifestation 0 at c716d456
INFO:    Receive DFU Detach
INFO:    DFU USB STOP...
INFO:    BL2: Loading image id 1
INFO:    Loading image id=1 at address 0x30006000
INFO:    Image id=1 loaded: 0x30006000 - 0x30006246
INFO:    FCONF: Reading FW_CONFIG firmware configuration file from: 0x30006000
INFO:    FCONF: Reading firmware configuration information for: mce_config
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 0xce000000
INFO:    Image id=4 loaded: 0xce000000 - 0xce00001c
INFO:    OPTEE ep=0xce000000
INFO:    OPTEE header info:
INFO:          magic=0x4554504f
INFO:          version=0x2
INFO:          arch=0x0
INFO:          flags=0x0
INFO:          nb_images=0x1
INFO:    BL2: Loading image id 8
INFO:    Loading image id=8 at address 0xce200000
INFO:    Image id=8 loaded: 0xce200000 - 0xce277260
INFO:    BL2: Loading image id 2
INFO:    Loading image id=2 at address 0xc0400000
INFO:    Image id=2 loaded: 0xc0400000 - 0xc040d740
INFO:    BL2: Skip loading image id 16
INFO:    BL2: Loading image id 5
INFO:    Loading image id=5 at address 0xc0000000
INFO:    Image id=5 loaded: 0xc0000000 - 0xc00e872c
NOTICE:  BL2: Booting BL32
INFO:    Entry point address = 0xce200000
INFO:    SPSR = 0x1d3
I/TC: Early console on UART#4
I/TC:
I/TC: Non-secure external DT found
I/TC: Embedded DTB found
I/TC: OP-TEE version: 3.16.0-6-gbe2b808b6-dev (gcc version 11.5.0 (GCC)) #7 Mon Jun  9 12:47:36 PM UTC 2025 arm
I/TC: WARNING: This OP-TEE configuration might be insecure!
I/TC: WARNING: Please check https://optee.readthedocs.io/en/latest/architecture/porting_guidelines.html
I/TC: Primary CPU initializing
I/TC: WARNING: All debug access are allowed
E/TC:0 0 stm32mp1_cpu_opp_is_supported:210 Invalid opp-supported-hw 0x2
E/TC:0 0 stm32mp1_cpu_opp_is_supported:210 Invalid opp-supported-hw 0x2
E/TC:0 0 stm32mp1_cpu_opp_is_supported:210 Invalid opp-supported-hw 0x2
E/TC:0 0 stm32mp1_cpu_opp_is_supported:210 Invalid opp-supported-hw 0x2
E/TC:0 0 probe_driver_node:402 Failed to probe stm32mp1-cpu-opp on node cpu0-opp-table: 0xffff0000
E/TC:0 0 print_probe_list:358 |- Driver stm32mp1-cpu-opp on node cpu0-opp-table failed
I/TC: Platform stm32mp1: flavor PLATFORM_FLAVOR - DT stm32mp133a-ccproa1r.dts
I/TC: DTB enables console (non-secure)
E/TC:0 0 call_initcalls:43 Initcall __text_start + 0x0006f080 failed
E/TC:0 0 probe_dt_drivers:739 Probe sequence result: 0
E/TC:0 0 print_probe_list:358 |- Driver stm32mp1-cpu-opp on node cpu0-opp-table failed
E/TC:0 0 regulator_get_by_regulator_name:95 vdd_adc not found
E/TC:0 0 scmi_regulator_consumer_init:295 regulator vdd_adc not found, skipped
I/TC: Primary CPU switching to normal world boot
optee optee: OP-TEE: revision 3.16 (be2b808b)


U-Boot 2021.10-stm32mp-r2.1 (Jun 11 2025 - 08:13:23 +0000)

CPU: STM32MP133A Rev.Y
Model: Zehnder CCPRO A1R Board
Board: stm32mp1 in trusted mode (st,stm32mp133a-ccproa1r)
DRAM:  256 MiB
optee optee: OP-TEE: revision 3.16 (be2b808b)
Clocks:
- MPU : 650 MHz
- AXI : 266.500 MHz
- PER : 24 MHz
- DDR : 533 MHz
WDT:   Started with servicing (32s timeout)
NAND:  0 MiB
MMC:
Loading Environment from nowhere... OK
In:    serial
Out:   serial
Err:   serial
invalid MAC address 0 in OTP 00:00:00:00:00:00
Net:   No ethernet found.
Hit any key to stop autoboot:  0
Boot over usb0!
DFU alt info setting: done
#
FlashLayout received, size = 552
DOWNLOAD ... OK
Ctrl+C to exit ...
spi-nand: spi_nand mt29f4g01abafdwb@0: Micron SPI NAND was found.
spi-nand: spi_nand mt29f4g01abafdwb@0: 512 MiB, block size: 256 KiB, page size: 4096, OOB size: 256
DFU alt info setting: using id 'spi-nand0,0'
using id 'spi-nand0,1'
using id 'spi-nand0,2'
using id 'spi-nand0,3'
done
crq->brequest:0x0
#

dfu-utils says:

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

Opening DFU capable USB device...
ID 0483:df11
Run-time device DFU version 0110
Claiming USB DFU Interface...
Setting Alternate Setting #3 ...
dfu-util: Cannot set alternate interface
74 angelo@angelo-Precision-7550:~/DEV/yocto-zehnder$
74 angelo@angelo-Precision-7550:~/DEV/yocto-zehnder$ sh program.sh[A
sh: 0: cannot open program.sh[A: No such file
2 angelo@angelo-Precision-7550:~/DEV/yocto-zehnder$ sh program.sh
+ dfu-util -a 0 -D build/tmp-glibc/deploy/images/ccproa1r/arm-trusted-firmware/tf-a-stm32mp133a-ccproa1r-usb.stm32
dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
Opening DFU capable USB device...
ID 0483:df11
Run-time device DFU version 0110
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 0110
Device returned transfer size 1024
Copying data from PC to DFU device
Download        [=========================] 100%        92948 bytes
Download done.
state(7) = dfuMANIFEST, status(0) = No error condition is present
state(2) = dfuIDLE, status(0) = No error condition is present
Done!
+ dfu-util -a 0 -e
dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

Opening DFU capable USB device...
ID 0483:df11
Run-time device DFU version 0110
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 0110
Device returned transfer size 1024
+ sleep 2
+ dfu-util -a 0 -D build/tmp-glibc/deploy/images/ccproa1r/fip/fip-stm32mp133a-ccproa1r-optee.img
dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
Opening DFU capable USB device...
ID 0483:df11
Run-time device DFU version 0110
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 0110
Device returned transfer size 1024
Copying data from PC to DFU device
Download        [=========================] 100%      1496150 bytes
Download done.
state(7) = dfuMANIFEST, status(0) = No error condition is present
state(2) = dfuIDLE, status(0) = No error condition is present
Done!
+ dfu-util -a 0 -e
dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

Opening DFU capable USB device...
ID 0483:df11
Run-time device DFU version 0110
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 0110
Device returned transfer size 1024
+ sleep 10
+ dfu-util -a 0 -D build/tmp-glibc/deploy/images/ccproa1r/flashlayout_ccproa1r-hwv-image-eng/optee/FlashLayout_spinand-2-128_stm32mp133a-ccproa1r-optee.tsv
dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
Opening DFU capable USB device...
ID 0483:df11
Run-time device DFU version 0110
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 0110
Device returned transfer size 4096
Copying data from PC to DFU device
Download        [=========================] 100%          552 bytes
Download done.
state(7) = dfuMANIFEST, status(0) = No error condition is present
state(2) = dfuIDLE, status(0) = No error condition is present
Done!
+ dfu-util -a 0 -e
dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

Opening DFU capable USB device...
ID 0483:df11
Run-time device DFU version 0110
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 0110
Device returned transfer size 4096
+ sleep 5
+ dfu-util -a 0 -D build/tmp-glibc/deploy/images/ccproa1r/arm-trusted-firmware/tf-a-stm32mp133a-ccproa1r-spinand.stm32
dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
Opening DFU capable USB device...
ID 0483:df11
Run-time device DFU version 0110
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 0110
Device returned transfer size 4096
Copying data from PC to DFU device
Download        [=========================] 100%        84748 bytes
Download done.
dfu-util: unable to read DFU status after completion
+ dfu-util -a 0 -e
dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

Opening DFU capable USB device...
ID 0483:df11
Run-time device DFU version 0110
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
dfu-util: Cannot set alternate interface

I tried also download only the multivolume file and it ends abruptly with this error:

+ dfu-util -a 3 -D build/tmp-glibc/deploy/images/ccproa1r/ccproa1r-hwv-image-eng-ccproa1r_spinand_2_128_multivolume.ubi
dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
Opening DFU capable USB device...
ID 0483:df11
Run-time device DFU version 0110
Claiming USB DFU Interface...
Setting Alternate Setting #3 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 0110
Device returned transfer size 4096
Copying data from PC to DFU device
Download        [=                        ]   4%      1806336 bytesdfu-util: Error during download get_status

It looks like it's working, but after writing 1.7MB it crashes.

The USB download gadget is always available while the procedure is running, I can't see any problem or disconnection.

Any Idea?

1 ACCEPTED SOLUTION

Accepted Solutions
gpagano
ST Employee

The issue has been solved with a workaround.

Here is the debug and the solution we found.

The poor read/write performance on QSPI NAND flash was related to the assignment of pin GPIO PF8 as QSPI_IO0 line. This is a common choice for connecting a QSPI flash in new designs, but the issue is that the same GPIO line PF8 is the default wakeup IRQ line in OPTEE:

Rif: https://github.com/STMicroelectronics/optee_os/blob/4.0.0-stm32mp/core/arch/arm/plat-stm32mp1/drivers/stm32mp1_pwr_irq.c#L68

 

For this reason, during every QSPI communication there were a IRQ flood under OPTEE, and a resulting CPU overload (the optee overload is not directly visible under u-boot or Linux kernel).

A temporary workaround consists in not initializing the optee wakeup driver:

 

@@ -884,13 +880,14 @@ static TEE_Result stm32_pmic_init_it(const void *fdt, int node)

        int wakeup_parent_node = 0;

        int len = 0;

+       return TEE_SUCCESS;

+

 

Cheers

Giuseppe

 

 

 

 

 

View solution in original post

3 REPLIES 3
Olivier GALLIEN
ST Employee

Hi @angeloc ,

Investigation of this kind of issue deserve to have complete description of your USB implementation and configuration. (schematics, dts)

You will get a better support opening a ticket to https://ols.st.com/s/

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.
angeloc
Associate

@Olivier GALLIEN 

The problem is simple, I added a bit of debug output to show that everything is correctly configured:

STM32MP> mtd list
stm32_qspi spi@58003000: stm32_qspi_probe: regs=<0x58003000> mapped=<0x70000000> mapped_size=<0x10000000>                               
stm32_qspi spi@58003000: regs=58003000, speed=266500000, clk=133000000                                                                  
stm32_qspi spi@58003000: regs=58003000, mode=9216 rx: quad, tx: quad                                                                    
spi-nand: spi_nand mt29f4g01abafdwb@0: Micron SPI NAND was found.                                                                       
spi-nand: spi_nand mt29f4g01abafdwb@0: 512 MiB, block size: 256 KiB, page size: 4096, OOB size: 256                                     
List of MTD devices:                                                                                                                    
* spi-nand0                                                                                                                             
  - device: mt29f4g01abafdwb@0                                                                                                          
  - parent: spi@58003000                                                                                                                
  - driver: spi_nand                                                                                                                    
  - path: /soc/bus@5c007000/spi@58003000/mt29f4g01abafdwb@0                                                                             
  - type: NAND flash                                                                                                                    
  - block size: 0x40000 bytes                                                                                                           
  - min I/O: 0x1000 bytes                                                                                                               
  - OOB size: 256 bytes
  - OOB available: 126 bytes
  - 0x000000000000-0x000020000000 : "spi-nand0"
          - 0x000000000000-0x000000200000 : "fsbl1"
          - 0x000000200000-0x000000600000 : "fip1"
          - 0x000000600000-0x000000a00000 : "fip2"
          - 0x000000a00000-0x000020000000 : "UBI"
STM32MP> mtd erase spi-nand0                          
Erasing 0x00000000 ... 0x1fffffff (2048 eraseblock(s))
STM32MP> time mtd write spi-nand0 $loadaddr 0 0x100000
Writing 1048576 byte(s) (256 page(s)) at offset 0x00000000

time: 2 minutes, 30.543 seconds

So, the QSPI is correctly configured (both rx and tx are quad and the clock is correct), but writing a megabyte on the spi takes 2 minutes instead of nearly a second.

Cannot say the cause, still investigating.

 

gpagano
ST Employee

The issue has been solved with a workaround.

Here is the debug and the solution we found.

The poor read/write performance on QSPI NAND flash was related to the assignment of pin GPIO PF8 as QSPI_IO0 line. This is a common choice for connecting a QSPI flash in new designs, but the issue is that the same GPIO line PF8 is the default wakeup IRQ line in OPTEE:

Rif: https://github.com/STMicroelectronics/optee_os/blob/4.0.0-stm32mp/core/arch/arm/plat-stm32mp1/drivers/stm32mp1_pwr_irq.c#L68

 

For this reason, during every QSPI communication there were a IRQ flood under OPTEE, and a resulting CPU overload (the optee overload is not directly visible under u-boot or Linux kernel).

A temporary workaround consists in not initializing the optee wakeup driver:

 

@@ -884,13 +880,14 @@ static TEE_Result stm32_pmic_init_it(const void *fdt, int node)

        int wakeup_parent_node = 0;

        int len = 0;

+       return TEE_SUCCESS;

+

 

Cheers

Giuseppe