2024-07-19 04:34 PM - edited 2024-07-21 05:50 PM
I have made my own STM32MP1 board with the STM32MP151AAC3 processor. Right now I'm faceing issues with the software STM32CubeProgrammer and I don't know why this happens.
My goal is to flash the eMMC via the UBS OTG. I have SDIO2 as eMMC by the way.
What we can see here is that:
So the question is simple:
Why does STM32CubeProgrammer get timeout?
The full log can be found here: https://pastebin.com/q9GttMiR
00:57:35:752 : UR connection mode is defined with the HWrst reset mode
00:57:35:918 : Device Descriptor:
00:57:35:918 : |_bLength : 0x12
00:57:35:918 : |_bDescriptorType : 0x01
00:57:35:918 : |_bcdUSB : 0x0200
00:57:35:918 : |_bDeviceClass : 0x00
00:57:35:918 : |_bDeviceSubClass : 0x00
00:57:35:918 : |_bDeviceProtocol : 0x00
00:57:35:918 : |_bMaxPacketSize : 0x40
00:57:35:918 : |_idVendor : 0x0483
00:57:35:919 : |_idProduct : 0xdf11
00:57:35:919 : |_bcdDevice : 0x0200
00:57:35:919 : |_iManufacturer : 0x01
00:57:35:919 : |_iProduct : 0x02
00:57:35:919 : |_iSerialNumber : 0x03
00:57:35:919 : |_bNumConfigurations : 0x01
00:57:35:919 : Configuration Descriptor:
00:57:35:919 : |_bLength : 0x09
00:57:35:919 : |_bDescriptorType : 0x02
00:57:35:919 : |_wTotalLength : 0x48
00:57:35:920 : |_bNumInterfaces : 0x01
00:57:35:920 : |_bConfigurationValue : 0x01
00:57:35:920 : |_iConfiguration : 0x02
00:57:35:920 : |_bmAttributes : 0xc0
00:57:35:920 : |_bMaxPower : 0x01
00:57:35:920 : Interface Descriptor Alternate Settings: 0x00
00:57:35:920 : |_bLength : 0x09
00:57:35:920 : |_bDescriptorType : 0x04
00:57:35:920 : |_bInterfaceNumber : 0x00
00:57:35:920 : |_bAlternateSetting : 0x00
00:57:35:920 : |_bNumEndpoints : 0x00
00:57:35:920 : |_bInterfaceClass : 0xfe
00:57:35:920 : |_bInterfaceSubClass : 0x01
00:57:35:920 : |_bInterfaceProtocol : 0x02
00:57:35:920 : |_iInterface : 0x06
00:57:35:921 : Interface Descriptor Alternate Settings: 0x01
00:57:35:921 : |_bLength : 0x09
00:57:35:921 : |_bDescriptorType : 0x04
00:57:35:921 : |_bInterfaceNumber : 0x00
00:57:35:921 : |_bAlternateSetting : 0x01
00:57:35:921 : |_bNumEndpoints : 0x00
00:57:35:921 : |_bInterfaceClass : 0xfe
00:57:35:921 : |_bInterfaceSubClass : 0x01
00:57:35:921 : |_bInterfaceProtocol : 0x02
00:57:35:921 : |_iInterface : 0x07
00:57:35:921 : Interface Descriptor Alternate Settings: 0x02
00:57:35:921 : |_bLength : 0x09
00:57:35:921 : |_bDescriptorType : 0x04
00:57:35:921 : |_bInterfaceNumber : 0x00
00:57:35:921 : |_bAlternateSetting : 0x02
00:57:35:921 : |_bNumEndpoints : 0x00
00:57:35:921 : |_bInterfaceClass : 0xfe
00:57:35:921 : |_bInterfaceSubClass : 0x01
00:57:35:921 : |_bInterfaceProtocol : 0x02
00:57:35:922 : |_iInterface : 0x08
00:57:35:922 : Interface Descriptor Alternate Settings: 0x03
00:57:35:922 : |_bLength : 0x09
00:57:35:922 : |_bDescriptorType : 0x04
00:57:35:922 : |_bInterfaceNumber : 0x00
00:57:35:922 : |_bAlternateSetting : 0x03
00:57:35:922 : |_bNumEndpoints : 0x00
00:57:35:922 : |_bInterfaceClass : 0xfe
00:57:35:922 : |_bInterfaceSubClass : 0x01
00:57:35:922 : |_bInterfaceProtocol : 0x02
00:57:35:922 : |_iInterface : 0x09
00:57:35:922 : Interface Descriptor Alternate Settings: 0x04
00:57:35:922 : |_bLength : 0x09
00:57:35:922 : |_bDescriptorType : 0x04
00:57:35:922 : |_bInterfaceNumber : 0x00
00:57:35:922 : |_bAlternateSetting : 0x04
00:57:35:922 : |_bNumEndpoints : 0x00
00:57:35:922 : |_bInterfaceClass : 0xfe
00:57:35:922 : |_bInterfaceSubClass : 0x01
00:57:35:922 : |_bInterfaceProtocol : 0x02
00:57:35:923 : |_iInterface : 0x0a
00:57:35:923 : Interface Descriptor Alternate Settings: 0x05
00:57:35:923 : |_bLength : 0x09
00:57:35:923 : |_bDescriptorType : 0x04
00:57:35:923 : |_bInterfaceNumber : 0x00
00:57:35:923 : |_bAlternateSetting : 0x05
00:57:35:923 : |_bNumEndpoints : 0x00
00:57:35:923 : |_bInterfaceClass : 0xfe
00:57:35:923 : |_bInterfaceSubClass : 0x01
00:57:35:923 : |_bInterfaceProtocol : 0x02
00:57:35:923 : |_iInterface : 0x0b
00:57:35:923 : Functional Descriptor :
00:57:35:923 : |_bLength : 0x09
00:57:35:923 : |_bDescriptorType : 0x21
00:57:35:923 : |_bmAttributes : 0x0f
00:57:35:923 : |_wDetachTimeOut : 0xff
00:57:35:923 : |_wTransferSize : 0x0400
00:57:35:923 : |_bcdDFUVersion : 0x0110
00:57:35:923 : USB speed : High Speed (480MBit/s)
00:57:35:923 : Manuf. ID : STMicroelectronics
00:57:35:924 : Product ID : DFU in HS Mode @Device ID /0x500, @Revision ID /0x0000
00:57:35:924 : SN : 002600373431510433383938
00:57:35:924 : DFU protocol: 1.1
00:57:35:924 : Board : --
00:57:35:924 : Device ID : 0x0500
00:57:47:117 : Start Embedded Flashing service
00:57:47:151 : sending a set alternate setting request with index: 5
00:57:47:152 : receiving packet
00:57:47:153 : DFU status = 0 : OK
00:57:47:153 : DFU state = 2 : dfuIDLE
00:57:47:153 : UpLoading data
00:57:47:153 : DFU status = 0 : OK
00:57:47:153 : DFU state = 2 : dfuIDLE
00:57:47:153 : sending a set alternate setting request with index: 1
00:57:47:154 : Memory Programming ...
00:57:47:154 : Opening and parsing file: tf-a-stm32mp157a-ev1-usb.stm32
00:57:47:197 : File : tf-a-stm32mp157a-ev1-usb.stm32
00:57:47:197 : Size : 220.41 KB
00:57:47:197 : Partition ID : 0x01
00:57:47:197 : Download in Progress:
00:57:47:198 : Size : 225702 Bytes
00:57:47:199 : sending packet nbr: 0
00:57:47:200 : DFU status = 0 : OK
00:57:47:200 : DFU state = 2 : dfuIDLE
00:57:47:201 : Status: 0, State: 2
00:57:47:204 : DFU status = 0 : OK
00:57:47:204 : DFU state = 4 : dfuDNBUSY
[.....]
00:57:49:178 : sending packet nbr: 152
00:57:49:179 : DFU status = 0 : OK
00:57:49:179 : DFU state = 5 : dfuDNLOAD-IDLE
00:57:49:179 : bwPollTimeout = 1
00:57:49:180 : Status: 0, State: 5
00:57:49:183 : DFU status = 0 : OK
00:57:49:183 : DFU state = 4 : dfuDNBUSY
00:57:49:184 : bwPollTimeout = 1
[......]
00:57:49:488 : DFU state = 4 : dfuDNBUSY
00:57:49:488 : bwPollTimeout = 1
00:57:49:492 : DFU status = 0 : OK
00:57:49:492 : DFU state = 5 : dfuDNLOAD-IDLE
00:57:49:492 : bwPollTimeout = 1
00:57:49:495 : sending packet nbr: 162
00:57:49:495 : DFU status = 0 : OK
[.....]
00:57:50:059 : DFU status = 0 : OK
00:57:50:060 : DFU state = 5 : dfuDNLOAD-IDLE
00:57:50:060 : bwPollTimeout = 1
00:57:50:061 : Status: 0, State: 5
00:57:50:090 : DFU status = 0 : OK
00:57:50:090 : DFU state = 4 : dfuDNBUSY
00:57:50:090 : bwPollTimeout = 1
00:57:50:094 : DFU status = 0 : OK
00:57:50:095 : DFU state = 5 : dfuDNLOAD-IDLE
00:57:50:095 : bwPollTimeout = 1
00:57:50:099 : Segment[0] downloaded successfully
00:57:50:099 : File download complete
00:57:50:099 : Time elapsed during download operation: 00:00:02.454
00:57:50:099 : RUNNING Program ...
00:57:50:099 : PartID: :0x01
00:57:50:099 : DFU status = 0 : OK
00:57:50:099 : DFU state = 5 : dfuDNLOAD-IDLE
00:57:50:099 : bwPollTimeout = 1
00:57:50:101 : sending a dfu end of download request
00:57:50:102 : DFU status = 0 : OK
00:57:50:102 : DFU state = 7 : dfuMANIFEST
00:57:50:102 : bwPollTimeout = 1
00:58:22:076 : DFU status = 0 : OK
00:58:22:345 : DFU state = 2 : dfuIDLE
00:58:24:127 : sending a set alternate setting request with index: 5
00:58:29:426 : receiving packet
00:58:59:455 : libusb get status error [-7] : LIBUSB_ERROR_TIMEOUT
00:58:59:455 : sending a clear status request
00:59:59:496 : libusb get status error [-7] : LIBUSB_ERROR_TIMEOUT
00:59:59:496 : an error occured after sending the clear status request
00:59:59:496 : Status: errUNKNOWN, State: dfuERROR
00:59:59:551 : sending a clear status request
01:00:59:498 : libusb get status error [-7] : LIBUSB_ERROR_TIMEOUT
01:00:59:498 : an error occured after sending the clear status request
01:00:59:498 : Status: errUNKNOWN, State: dfuERROR
01:00:59:498 : sending a clear status request
01:01:59:500 : libusb get status error [-7] : LIBUSB_ERROR_TIMEOUT
01:01:59:500 : an error occured after sending the clear status request
01:01:59:500 : Status: errUNKNOWN, State: dfuERROR
01:01:59:500 : sending a clear status request
01:03:05:691 : libusb get status error [-7] : LIBUSB_ERROR_TIMEOUT
01:03:05:827 : an error occured after sending the clear status request
01:03:05:828 : Status: errUNKNOWN, State: dfuERROR
01:03:05:829 : sending a clear status request
01:03:59:506 : libusb get status error [-7] : LIBUSB_ERROR_TIMEOUT
01:03:59:507 : an error occured after sending the clear status request
01:03:59:507 : Status: errUNKNOWN, State: dfuERROR
01:04:00:400 : sending a clear status request
01:04:59:544 : libusb get status error [-7] : LIBUSB_ERROR_TIMEOUT
01:04:59:544 : an error occured after sending the clear status request
01:04:59:544 : Status: errUNKNOWN, State: dfuERROR
01:04:59:544 : sending a clear status request
01:05:59:546 : libusb get status error [-7] : LIBUSB_ERROR_TIMEOUT
01:05:59:546 : an error occured after sending the clear status request
01:05:59:546 : Status: errUNKNOWN, State: dfuERROR
01:05:59:546 : sending a clear status request
01:06:59:550 : libusb get status error [-7] : LIBUSB_ERROR_TIMEOUT
01:06:59:550 : an error occured after sending the clear status request
01:06:59:550 : Status: errUNKNOWN, State: dfuERROR
01:06:59:550 : sending a clear status request
01:07:59:555 : libusb get status error [-7] : LIBUSB_ERROR_TIMEOUT
01:07:59:555 : an error occured after sending the clear status request
01:07:59:556 : Status: errUNKNOWN, State: dfuERROR
01:07:59:556 : sending a clear status request
01:08:59:556 : libusb get status error [-7] : LIBUSB_ERROR_TIMEOUT
01:08:59:556 : an error occured after sending the clear status request
01:08:59:557 : Status: errUNKNOWN, State: dfuERROR
01:08:59:742 : unable to switch the device to dfuIDLE state
01:08:59:857 : Error: an error occured while uploading data from the virtual partition 0xF1
01:09:03:186 : Error: Start operation failed at partition 0x01
01:09:06:454 : Error: TSV flashing service failed
01:09:39:537 : Disconnected from device.
Solved! Go to Solution.
2024-07-23 07:47 AM
I understand. If you don't know more than I do about building own Linux OS for my HW. Then I'm on my own.
Thank you by the way for the answers. They have been very helpful.
I think I will change the pin configuration inside TF-A and recompile it. It must be the only way.
Perhaps Buildroot can compile everything for me at once? I have tried Buildroot before and compile. I did not know what I got back after the compilation. But I did get any errors.
Is it possible to flash a Buildroot compilation with CubeProgrammer?
2024-07-23 08:08 AM
Hi,
The flashing is usually the latest and the easiest step (if the binaries are running well as flashing is done using TF-A + uBoot tailored for your board).
Yes, either BuildRoot or Yocto could be used to generate binaires (there is more than one, see Flashlayout).
Once first clean compilation is achieved (mean all the environnement are ok), the most complex task is usually to have the correct Device tree for your own board. I encourage you to generate some with CubeMx/CubeIDE and diff with a working one from EV1 or DK1 board in order to get a custom one without forgetting anything (as Cubemx only generate 'partial' DT).
For Yocto, see https://wiki.st.com/stm32mpu/wiki/How_to_compile_the_device_tree_with_the_Developer_Package
for BuildRoot, you should check to our partner site https://bootlin.com/blog/building-a-linux-system-for-the-stm32mp1-basic-system/
Regards.
2024-07-23 08:35 AM - edited 2024-07-23 09:15 AM
Ok. I will give Buildroot another chance again.
As I understand. CubeIDE cannot be used to generate a device tree. CubeIDE is only made for barebone programming. Or do you mean that the CubeIDE should generate the .tvs files?
When I compiled Buildroot, I did not see any options how to generate .tvs files and all other files so I can upload them with CubeProgrammer. That's why I got stuck with Buildroot.
Because with CubeProgrammer. If I'm going to flash the eMMC and the CPU with CubeProgramer, I need to have .tvs files, .bin files etc. Just as the Stater Pack.
But right know, we know that I have wrong I2C configuration. I need to change the I2C pins from PZ4/PZ5 to PF14/PF15 becore I compile.
Update:
I now understand that Buildroot is NOT a tool for flashing the firmware. It's a tool for build a complete OS.
What I need to do first, is to flash the CPU with the TF-A and TF-A need to have correct pin configuration.
2024-07-23 02:00 PM
Do you think this number has to do with PZ4 and PZ5 pins? If I change this base address to another base address for the PF14 and PF15 pins. This might work? @PatrickF
2024-07-23 06:19 PM - edited 2024-07-23 06:31 PM
Hi @PatrickF
I found out that the STM32CubeIDE is generating .dts in the DeviceTree folder.
So right now I'm compiling the Linux kernel. I'm right here now:
I have placed the file "stm32mp151a-stm32-computer-mx.dts" from the kernel folder, and paste it inside <linux source>/arch/arm/boot/dts folder.