cancel
Showing results for 
Search instead for 
Did you mean: 

A dfu error occurs when downloading an image

KNam.2
Associate II

I am currently developing using the STM32MP157FAD. And I want to create a distribution image and download the image using STM32CubeProgrammer.

However, while downloading the image, the following error message is displayed in the log of STM32CubeProgrammer.

15:34:17:270 : DFU status = 0

15:34:17:270 : DFU State = 5

15:34:17:270 : Segment[0] downloaded successfully

15:34:17:270 : File download complete

15:34:17:270 : Time elapsed during download operation: 00:00:01.440

15:34:17:270 : RUNNING Program ...

15:34:17:270 : PartID: :0x01

15:34:17:270 : DFU status = 0

15:34:17:270 : DFU State = 5

15:34:17:270 : sending a dfu end of download request

15:34:17:270 : DFU status = 0

15:34:17:271 : DFU State = 7

15:34:22:259 : DFU status = 0

15:34:22:259 : DFU State = 2

15:34:22:259 : sending a set alternate setting request with index: 5

15:34:27:259 : receiving packet

15:34:32:260 : sending a clear status request

15:34:42:262 : an error occured after sending the clear status request

15:34:42:262 : Status: errUNKNOWN, State: dfuERROR

15:34:42:262 : sending a clear status request

15:34:52:263 : an error occured after sending the clear status request

15:34:52:263 : Status: errUNKNOWN, State: dfuERROR

An error message is continuously displayed and the connection with the device is disconnected, and the following error is displayed.

16:18:01:268 : unable to switch the device to dfuIDLE state

 16:18:01:268 : Error: an error occured while uploading data from the virtual partition 0xF1

 16:18:01:288 : Error: Start operation failed at partition 0x01

 16:18:01:312 : Error: TSV flashing service failed

 16:18:46:271 : Warning: Connection to device 0x500 is lost

 16:19:51:499 : Disconnected from device.

For OTG Device Tree, refer to the following site.

https://wiki.st.com/stm32mpu/wiki/OTG_device_tree_configuration#DT_configuration_example_as_high-speed_OTG_in_Host_or_Peripheral_mode-2C_with_micro-B_or_Type-C_connector-2C_and_with_VBUS_and_ID_left_unconnected

&usbotg_hs{

pinctrl-names = "default", "sleep";

pinctrl-0 = <&usb_otg_hs_pins_mx>;

pinctrl-1 = <&usb_otg_hs_sleep_pins_mx>;

compatible = "st,stm32mp15-hsotg", "snps,dwc2";

phys = <&usbphyc_port1 0>; 

phy-names = "usb2-phy";

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

dr_mode = "peripheral";

usb-role-switch;

role-switch-default-mode = "peripheral";

status = "okay";

/* USER CODE BEGIN usbotg_hs */

/* USER CODE END usbotg_hs */

};

I would be grateful if you could teach me how to solve this problem.

6 REPLIES 6
PatrickF
ST Employee

HI @KNam.2​ 

could you double check that the TSV file is conform : https://wiki.st.com/stm32mpu/wiki/STM32CubeProgrammer_flashlayout

Maybe have a look to https://wiki.st.com/stm32mpu/wiki/How_to_configure_U-Boot_for_your_board#USB_OTG_node

Which USB connector and surrounding HW on your custom board (e.g. Type-C with STUSB1600)

Please share the UART console output log ?

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.

NAND is used, there is no difference compared to the EV board TSV.


_legacyfs_online_stmicro_images_0693W00000dDGbBQAW.png

And the USB port was used as a test point without using a connector.


_legacyfs_online_stmicro_images_0693W00000dDGchQAG.png

​Finally, I did a pull-up on UART PA13, but no data is output. I wonder if there is a separate setting to use.

It uses NAND flash for storage. Does this happen if there is no communication with the NAND flash?

Hi,

At that stage of error (TF-A-usb seems not to answer), you not have yet loaded uBoot, so NAND is not involved as Flash programming is done by uBoot.

Is your console UART set to use UART4_TX on PA13 in TF-A Device Tree ?

PA13 is only useful for BootROM boot fail (when you will boot from Flash, which is not the case here).

In our MP157x-EV1 and MP157x-DK1/2 boards device tree, console is set to use UART4_TX on PG11

I suspect you have TF-A crashing at some point and UART console output could help.

I also recommend reading:

https://community.st.com/s/article/FAQ-STM32MP1-How-to-bring-up-STM32MP1

https://community.st.com/s/article/FAQ-STM32MP1-bring-up-troubleshooting-guide

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.

Thanks PatrickF,

One more question!

I like to know where the TF-A-usb ​is running, Does it run on system RAM? or DDR.

I can see TF-A is been downloading to somewhere but do not know where.

Actually we are using 32-bit DDR2 RAM and 8x 4G-bit NAND, but MP157x only support 16-biy RAM. Can this be the problem?


_legacyfs_online_stmicro_images_0693W00000dDUTFQA4.pngThanks in advance.

Hi @KNam.2​ ,

TF-A USB is loaded inside SYSRAM as BootROM is not aware of any DDR settings.

Then once TF-A is started (you should start to get console output), it will initialize DDR in order to being able to load uBoot (FIP) at the end of the DDR.

TF-A binary is build using TF-A device tree you should tailor to your board.

please see also : https://wiki.st.com/stm32mpu/wiki/STM32CubeProgrammer_flashlayout

At that stage, it is not an isue with NAND, but as you have no console output at all, you might have multiple issues:

  • TF-A Device Tree issues
  • corrupted/misformed TF-A during compilation
  • TF-A header issue (added by signing tool during compilation flow)
  • issue with DDR settings
  • issue with DDR PCB signal integrity

For DDR settings/tests on a custom board, we strongly recommend using first CubeMX/DDRTools together with DDRFW-UTIL https://wiki.st.com/stm32mpu/wiki/STM32DDRFW-UTIL.

DDRFW-UTIL will be loaded instead of TF-A and allow to run some low level DDR test while allowing to modify default DDR settings in CubeMX.

Btw, I'm not sure your setup of using a 32-bits LPDDR and using only 16-bits could work (at least we did not try it). This will requires clever and custom settings to make it working.

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.