I hope this is the right category for this issue.
I have been working at setting up the make menuconfig
firmware process for the STM32F070x6. I have developed a small board using this MCU and I got samples in this week. This was discussed here: Klipper Firmware Fails to Start on Custom STM32F070 Board
The first order of business was to modify ~/klipper/src/stm32/Kconfig
to support the MCU and I did that and I believe that it is producing the correct .config
file for the Klipper Firmware Build. I made sure the System Memory address as well as the Flash/SRAM sizes and addresses are correct. You’ll see some changes in the Kconfig
file to ensure the correct boot options are presented to the user.
2025.01.24-20.30 - Kconfig for stm32F070x6.txt (18.2 KB)
To try it out, rename it to simply Kconfig
and load it into the ~/klipper/src/stm32/
directory. The changes that I made are marked with “#$#
”.
Here is a sample of the .config
created for the STM32F070x6:
stm32F070x6 - config from menuconfig - 2025.01.24-15.00 - Produced by rpi5.txt (2.9 KB)
Now, when running make
, I got an error with spi.c
- the STM32F070x6 only has one SPI port but the code looks explicitly for two. Here is the file with the changes (which start at line 62 and end at line 88):
spi.c.zip (1.8 KB)
When the Firmware is specified and built with the modified Kconfig
and spi.c
files, it is successful except for being noted that it is “Dirty”.
Unfortunately, when I try to load the firmware into the STM32F070x6 board, using DFU, I get:
$ sudo dfu-util -R -a 0 -s 0x08000000:force:mass-erase:leave -D ~/klipper/out/klipper.bin -d 0483:df11
dfu-util 0.11
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2021 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: Warning: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release
Opening DFU capable USB device...
Device ID 0483:df11
Device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Interface #0 ...
Determining device status...
DFU state(10) = dfuERROR, status(10) = Device's firmware is corrupt. It cannot return to run-time (non-DFU) operations
Clearing status
Determining device status...
DFU state(2) = dfuIDLE, status(0) = No error condition is present
DFU mode device DFU version 011a
Device returned transfer size 2048
DfuSe interface name: "Internal Flash "
Performing mass erase, this can take a moment
Downloading element to address = 0x08000000, size = 31324
Erase [=========================] 100% 31324 bytes
Erase done.
Download [=========================] 100% 31324 bytes
Download done.
File downloaded successfully
Submitting leave request...
Transitioning to dfuMANIFEST state
dfu-util: can't detach
Resetting USB to switch back to Run-Time mode
$
When I am expecting something like:
$ sudo dfu-util -R -a 0 -s 0x08000000:force:mass-erase:leave -D ~/klipper/out/klipper.bin -d 0483:df11
dfu-util 0.11
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2021 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: Warning: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release
Opening DFU capable USB device...
Device ID 0483:df11
Device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Interface #0 ...
Determining device status...
DFU state(2) = dfuIDLE, status(0) = No error condition is present
DFU mode device DFU version 011a
Device returned transfer size 1024
DfuSe interface name: "Internal Flash "
Performing mass erase, this can take a moment
Downloading element to address = 0x08000000, size = 37668
Erase [=========================] 100% 37668 bytes
Erase done.
Download [=========================] 100% 37668 bytes
Download done.
File downloaded successfully
Submitting leave request...
dfu-util: Error during download get_status
$
A board programmed with the Firmware and having communication set to USB is not recognized by ls /dev/serial/by-id
when it is connected to the host. There is an LED on the board that is controllable and I can set it on or off using the GPIO pins to set at micro-controller startup
options so the code seems to be running in some fashion.
The klipper.bin
file works the same way if it is loaded using DFU or ST-Link.
I have gone through the Klipper source and nothing jumps out at me that appears to be an issue or some hardware in the STM32F070x6 is not properly accessed.
I fear I have two issues and I’m hoping that somebody here can help me out:
- What is the “Device’s firmware is corrupt” message I get during the DFU download of the STM32F070x6 firmware? I did go through the
DFU-Util
source and tried to capture thestderr
from the download operation but there was no useful information. This doesn’t make sense because, as far as I can tell, there isn’t any special data/bytes inserted in the build of a currently supported MCU that doesn’t get this message. - Any idea where I can look for the USB port to become recognized by the host? As far as I can tell, the USB port on the STM32F070x6 is standard for STM32 MCUs and there shouldn’t be any surprises there.
Thanx!
myke