serasidis / stm32_hid_bootloader Goto Github PK
View Code? Open in Web Editor NEWDriverless USB HID bootloader and flashing tool for STM32F10X devices
Driverless USB HID bootloader and flashing tool for STM32F10X devices
STM32 Board: STM32F103C8T6 Blue Pill, PC13 led.
OS: Archlinux x64
After setting boot0 to 1.
I uploaded the F103/low_and_medium_density/hid_generic_pc13.bin bootloader to my blue pill using stm32flash (sudo stm32flash -g 0x8000000 -b 115200 -w hid_generic_pc13.bin /dev/ttyUSB0). Then before disconnecting the ftdi programmer i moved boot 0 back to 0.
But the stm32 does not show up in arduino.
But dmesg does show that the stm32 is connected to the pc.
What is the issue?
as it is i am a bit confused with the stm32 board. I am sorry if i am doing something wrong or stupid.
Using HID-Flash V2.1, I can upload when BOOT1 is held high. I can see that bootloader expecting upload by flashing really fast.
When BOOT0 and BOOT1 is low, It jumps straight to user program without any delays, HID-Flash toggles DTR, resets the STM32 but user program start immediately without waiting for bootloader and HID-Flash can't find HID device.
From the screenshots in Readme I can see that expected behavior is auto-resetting via DTR somehow triggering boot loader and uploading.
Also for the HID-Flash to find any COM devices, I had to invoke usb serial manually by Serial.begin(9600) in the previously uploaded code.
Any ideas? Thanks!
HID-Flash V2.1
Operating System:OSX High Sierra
IDE: Arduino 1.8.5
Core:Rogerclarke's STM32 core.
Hey,
I am looking to add new board to with different pins used for LED/UART etc. If there is little guidance / pointers provided on how I can go about adding any board to this list it will be great.
Thank you.
Hello,
I flashed the hid_generic_pc13.bin file to my BluePill board using a serial dongle and STM32CubeProgrammer with the default start address (0x08000000) and also the start address specified in README (0x8000000). When plugging in the board via USB the LED doesn't blink or anything, and after 1 second I'm getting a Windows notification "USB device not recognized". Of course I can't flash anything using Arduino IDE because hid-flash can't find any HID device.
It is not the board's fault because STM32duino bootloader works perfectly, LED flashes when plugged in after flashing via serial dongle and I can successfully flash sketches via USB. What can be the problem? Please help. Thanks.
Please add support for Black Pill F401CC Device
Hi,
I was able to flash the HID bootloader to my Bluepill.
Next, I created the udev rule file (on Debian 12), and rebooted.
When I plug in the BP, I can see with dmesg that the device is recognized, but it does not get assigned a port like /dev/ttyUSB0 or whatever, so when uploading to the BP I get a segmentation fault. Arduino IDE does say that it found the device, however.
Saw a post somewhere of someone who had the exact same problem (segmentation fault) and he was able to correct that with the udev rules.
In my case that does not seem to be the solution.
Any suggestions, please ?
Hello!
Is there a app available (OSX and WINDOWS) that end users can use to flash binaries to their HID STM device?
Thanks!
I've flashed hid_generic_pc13.bin with stm32cube programmer
When plugging in the USB with a known good cable the LED blinks quickly, I have 4 bluepills, all exhibit the same behaviour.
I don't have a Windows machine to plug in to for comparison.
lsusb doesn't show anything up.
lsusb Bus 020 Device 004: ID 05ac:0274 Apple, Inc.
dmesg
021759.199986 HS05@14200000: AppleUSBHostPort::disconnect: persistent enumeration failures
Wireshark XHC20 capture
wireshark.pcapng.gz
I've tried the Rodger Clarke Melbourne bootloader with built in sketch and that enumerated OK and I had the serial output but wasn't able to then use it to add my own sketched from the Ardunio IDE
"Congratulations, you have installed the STM32duino bootloader See https://github.com/rogerclarkmelbourne/STM32duino-bootloader"
`
18.7.0 Darwin Kernel Version 18.7.0: Mon Apr 27 20:09:39 PDT 2020; root:xnu-4903.278.35~1/RELEASE_X86_64 x86_64
CLI tool cores when the user does not have the correct access rights for the HID device (as is default).
Reason is that:
handle = hid_open(VID, PID, NULL);
returns NULL in that case, since hid_open in hid-libusb.c silently swallows the return code from libusb and returns NULL.
Quick fix is to add a check, like:
printf("\n> 1209:BEBA device is found !\n");
handle = hid_open(VID, PID, NULL);
if(!handle || i == 10){
printf("\n> Unable to open the HID device.\n");
error = 1;
goto exit;
}
For getting correct access rights I added device in udev setup, maybe that should be mentioned in README.md
The HID search loop in the CLI code has a bug.
BUG HERE -----------------v
if((cur_dev->vendor_id == VID)&&(cur_dev->product_id = PID))
should be == instead of =
if((cur_dev->vendor_id == VID)&&(cur_dev->product_id == PID)){
original code :
while (cur_dev) { //Search for valid HID Bootloader USB devices
if((cur_dev->vendor_id == VID)&&(cur_dev->product_id = PID)){
valid_hid_devices++;
if(cur_dev->release_number < FIRMWARE_VER){ //The STM32 board has firmware lower than 3.00
printf("\nError - Please update the firmware to the latest version (v3.00+)");
goto exit;
}
}
cur_dev = cur_dev->next;
}
Hi
Is there any release for expanding HID bootloader to support STM32F429I ?
Best,
Samuel
USB_SetupPacket wLength should be uint16_t, when descriptor is large than 255 will get some mistake
Hi all! I've installed version 2.2.1 of the bootloader to my BluePill F103C8, but I'm having trouble working with it in the Arduino IDE.
This is an output from an upload, using the Arduino menu settings below, when the BOOT 1 is in position 0:
+-----------------------------------------------------------------------+
| HID-Flash v2.2.1 - STM32 HID Bootloader Flash Tool |
| (c) 2018 - Bruno Freitas http://www.brunofreitas.com |
| (c) 2018-2019 - Vassilis Serasidis https://www.serasidis.gr |
| Customized for STM32duino ecosystem https://www.stm32duino.com |
+-----------------------------------------------------------------------+
> Trying to open the [COM8]...
> Unable to open the [COM8]
> Searching for [1209:BEBA] device...
##########
Error - [1209:BEBA] device is not found :(> Searching for [COM8] ...
Menu Settings:
I assume the software is supposed to put it into bootloader mode automatically, but as it currently stands it doesn't appear to be. The hid-flash tool (visible from IDE window) only allows upload to my BluePill F103C8 when I have BOOT 1 in position 1 (BOOT 0 in position 0); I cannot upload otherwise. Accordingly, my working process to upload code is:
I mimic the software upload process, and it works, but I'd like to have it working more conveniently. Is there any detail about the specific Arduino tools menu settings I need to use?
Hello,
I just flashed my bluepill with hid_generic_pc13.bin. It seemed to flash properly. But I can't load a sketch. Can there be a verbose output?
Configuration
Windows 7 Pro 64 bits
Arduino 1.8.10
Arduino core STM32 1.7.0
HID bootloader 2.2.2 loaded using st-flash.exe write hid_generic_pc13.bin 0x8000000
Flashing the bluepill
`
C:\temp\stlink-1.3.0-win64\stlink-1.3.0-win64\bin>st-flash.exe write hid_generic
_pc13.bin 0x8000000
st-flash 1.3.0
2019-11-26T11:27:56 INFO C:\Users\Jerry\Desktop\stlink-master\src\usb.c: -- exit
_dfu_mode
2019-11-26T11:27:56 INFO C:\Users\Jerry\Desktop\stlink-master\src\common.c: Load
ing device parameters....
2019-11-26T11:27:56 INFO C:\Users\Jerry\Desktop\stlink-master\src\common.c: Devi
ce connected is: F1 Medium-density device, id 0x20036410
2019-11-26T11:27:56 INFO C:\Users\Jerry\Desktop\stlink-master\src\common.c: SRAM
size: 0x5000 bytes (20 KiB), Flash: 0x10000 bytes (64 KiB) in pages of 1024 byt
es
2019-11-26T11:27:56 INFO C:\Users\Jerry\Desktop\stlink-master\src\common.c: Atte
mpting to write 1976 (0x7b8) bytes to stm32 address: 134217728 (0x8000000)
Flash page at addr: 0x08000400 erased
2019-11-26T11:27:56 INFO C:\Users\Jerry\Desktop\stlink-master\src\common.c: Fini
shed erasing 2 pages of 1024 (0x400) bytes
2019-11-26T11:27:56 INFO C:\Users\Jerry\Desktop\stlink-master\src\common.c: Star
ting Flash write for VL/F0/F3 core id
2019-11-26T11:27:56 INFO C:\Users\Jerry\Desktop\stlink-master\src\flash_loader.c
: Successfully loaded flash loader in sram
1/1 pages written
2019-11-26T11:27:57 INFO C:\Users\Jerry\Desktop\stlink-master\src\common.c: Star
ting verification of write complete
2019-11-26T11:27:57 INFO C:\Users\Jerry\Desktop\stlink-master\src\common.c: Flas
h written and verified! jolly good!
C:\temp\stlink-1.3.0-win64\stlink-1.3.0-win64\bin>`
Trying to load blink.ino
+-----------------------------------------------------------------------+
| HID-Flash v2.2.1 - STM32 HID Bootloader Flash Tool |
| (c) 2018 - Bruno Freitas http://www.brunofreitas.com |
| (c) 2018-2019 - Vassilis Serasidis https://www.serasidis.gr |
| Customized for STM32duino ecosystem https://www.stm32duino.com |
+-----------------------------------------------------------------------+
Usage: hid-flash <bin_firmware_file> <delay (optional)>
An error occurred while uploading the sketch
Hi
As i saw there is stm32f407 bootloader support, so I bought a STM32F407G-DISC1 board. However, when i successfully uploaded the HID bootloader, the direct USB (known as STM32 Virtual COM Port) doesn't appear in Device Manager (Windows 10). Neither can I find it on Arduino IDE.
Then I tried to upload the code by using STM32CubeProgrammer(SWD) as upload method on Arduino IDE, STM32 Virtual COM Port can be detected by both Device Manager and Arduino IDE. But this makes me unable to have the Direct USB as programming USB and native USB at the same time, which is a nice feature of HID bootloader since STM32F103 on bluepill.
I guess i must have missed some steps. Please guide me the steps on getting it up to work. Or is there any video link that show the steps like the one for bluepill board using HID bootloader?
Best,
Samuel
Hello,
I just created a custom device with a STM32F103RC controller.
According to the docs here I flashed the highDensity bootloader and I am able to upload binaries.
So far so good.
Problem is, if I use a binary with a size larger than 80000bytes the bootloader breaks.
(meaning after re-connecting USB the USB port does not enumerate and the code is not running. Only way to get the controller back to life is reflashing the bootloader).
In short, if the last line of the upload message is . 77824 Bytes
, everything is ok.
If the last line is . 8xxxx Bytes
, the BL breaks.
I'm using platformIO with this platformio.ini:
board=genericSTM32F103RC
board_build.core = ststm32
framework = arduino
monitor_speed = 115200
upload_speed = 19200
upload_protocol = hid
build_flags =
-D PIO_FRAMEWORK_ARDUINO_NANOLIB_FLOAT_PRINTF
-D ENABLE_HWSERIAL1
-D PIO_FRAMEWORK_ARDUINO_ENABLE_CDC
-D USBCON
I have the feeling that this is some kind of linker problem. Because when I use DFU as upload method (with the DFU bootloader installed), I can easily use larger binaries.
Maybe the reserved RAM for the interrupt lines get overwritten?
Not sure if this is a HID bootloader issue or a linker issue within platformio. But I thought maybe someone has seen this behaviour as well?
Edit:
The building environment looks the same when changing the upload protocol between hid and dfu (apart from the LD_FLASH_OFFSET=0x800 vs 0x2000).
pio run -t envdump
After uploading the boot loader and connecting the blue-pill with USB cable, the board doesn't show up as a COM port or HID device but unknown USB device. The resistor on board are correct and older generic serial boot loader seems to work just fine.
Windows description:
Windows has stopped this device because it has reported problems. (Code 43)
A request for the USB device descriptor failed.
I just tried this bootloader and found it a bit unclear how it is started exactly. I think I've managed to puzzle it together from various sources, but I might be missing pieces. Here's what I found:
1EAF
and closing the port. The device should then write the appropriate magic value to the RTC backup register and reset, so the bootloader starts.I think it would be valuable to document this somehow. Maybe a little less detailed version for users might be also useful, but these details help Arduino core devs to better understand how this all fits together.
I've recently bought two different lots of bluepills that don't work with this bootloader but they work fine with the STM32duino-bootloader, and user space USB works too.
The chips are marked as STM32F103C8T6 but I'm sure they're fake just like most of the bluepills I've bought over the years. At first I thought I'd just received a bad batch, but it looks like many vendors are selling this new clone variant because I then got the same type from another seller :(
They symptoms seem to be they're just running too.... fast? On a 'good' bluepill PC13 LED flashes at ~20hz after burning the bootloader, but on these new ones it flashes at 60hz.
The good bluepill receives its first SOF ~150ms after the start of enumeration, whereas the new bad one receives it 1ms after starting to wake the host.
But with the STM32duino-bootloader flashed on the new bluepill instead, it too takes ~150ms too.
With STM32_HID_Bootloader both bluepills receive the SETUP and DATA0 packets from the host about 40-50ms after the first SOF, but these new bluepills never send an ACK (or any response to the SETUP).
The host retries the SETUP transaction two more times without an answer, then tries 3 more times 400ms later.
Seeing as these bluepills work fine with other USB bootloaders the hardware is obviously capable of establishing a USB connection, which leads me to think there might be something in the initialization that they don't like?
Any help would be appreciated, I've got a dozen of these now and I assume there's lot of other people receiving them too.
Hi @Serasidis
First of all, thank you very much for your excellent work!
Currently, STM32F1 handle the magic number thanks the battery backed register (DR10
):
STM32_HID_Bootloader/bootloader_F1/Src/main.c
Line 109 in 717419b
and STM32F4 thanks the battery backed SRAM region at 0.
STM32_HID_Bootloader/bootloader_F4/Src/main.c
Line 138 in 717419b
I wonder if it would not be better to unified them and use only battery backed register which is available across all series while backup SRAM not ?
And in this case, this could use a common DRx
index across all series, DR4
should be fine.
This allow to unified cores support.
I've flashed, a week ago,my STM32F407VET6 black board with the firmware diymroe_stm32f407vgt_pe0.bin from 2.2.2 release. It was working until 2 days ago, even if I had trouble getting to my sketch code (I sometimes had to reset the board several times: it was stuck in HID).
Now, whatever I do, I cannot exit the HID Bootloader mode but I can still upload my sketch.
I recompiled (in windows) the bootloader from the latest sources (changing the button and led in main.h to match the black STM board), but after flashing, Windows doesn't recognize the USB device as HID. Very strange. Flashing back with your firmware gets it working again.
Any suggestion ?
First, thanks for this very small bootloader, and for inspiration around HID !
I have tested the last master branch with a STM32103RC (48K RAM/256K Flash), being a HD device. The bootloader was obviously compiled with the PAGE_SIZE=2048 option.
=> The last page is not flashed, and so, the firmware is corrupted.
It seems that The ISR handle HIDUSB_HandleData doesn't take care of pending bytes at the last round if bytes > 1024 and below 2048.
static void HIDUSB_HandleData(uint8_t *data)
{
(...)
case 0x00:
/* Reset Page Command */
UploadStarted = true;
CurrentPage = MIN_PAGE;
CurrentPageOffset = 0;
break;
case 0x01:
=> SOMETHING SHOULD BE DONE HERE TO WRITE PENDING BYTES BETWEEN >1024 AND < 2048....
/* Reboot MCU Command */
UploadFinished = true;
break;
default:
break;
}
} else if (CurrentPageOffset >=
(...)
On the other end, using the same buffer for page data and commands is a bit risky.
I have written a version with some optimization , allowing the auto detection of page size (i.e. density) by reading the flash size info from the device. I also use state transitions, rather than booleans to manage the bootloader state. I push here my version of HIDUSB_HandleData
I have also separated page data from USB data until we are sure that it is page data after a full 64 bytes packet received.
static void HIDUSB_HandleData(uint8_t *data)
{
bool writePage = false;
memcpy(USB_Buffer + CurrentPacketOffset, data, MAX_PACKET_SIZE);
CurrentPacketOffset += MAX_PACKET_SIZE;
if ( CurrentPacketOffset < MAX_BUFFER_SIZE ) return;
CurrentPacketOffset = 0;
uint8_t cmd = HIDUSB_PacketIsCommand();
if ( cmd == CMD_START ) {
BootloaderState = BTL_STARTED;
return;
}
if ( cmd == CMD_END ) {
if (CurrentPageOffset) writePage = true;
BootloaderState = BTL_END;
}
else if (BootloaderState == BTL_STARTED) {
memcpy(PageData + CurrentPageOffset, USB_Buffer, MAX_BUFFER_SIZE);
CurrentPageOffset += MAX_BUFFER_SIZE;
if ( CurrentPageOffset % 1024 == 0) {
USB_SendData(ENDP1, (uint16_t *) CMD_SIGN, sizeof (CMD_SIGN));
if (CurrentPageOffset == PageSize ) writePage = true;
}
}
// Write a page to the flash memory
if ( writePage ) {
LED1_ON;
FLASH_WritePage((uint16_t *)(FLASH_BASE_ADDR + CurrentPage * PageSize),
(uint16_t *) PageData, CurrentPageOffset / 2);
CurrentPage++;
CurrentPageOffset = 0;
writePage = false;
LED1_OFF;
}
}
To save room, and stay below 2K, the USB string descriptors can be commented as they are not really used with generic HID devices.
Hope this helps.
This is what I tried
$ st-info --probe
Found 1 stlink programmers
version: V2J17S4
serial: 54FF67064882565217411887
flash: 65536 (pagesize: 1024)
sram: 20480
chipid: 0x0410
descr: F1xx Medium-density
$ st-flash write hid_generic_pc13.bin 0x8000000
st-flash 1.7.0
2023-02-25T22:41:56 INFO common.c: F1xx Medium-density: 20 KiB SRAM, 64 KiB flash in at least 1 KiB pages.
file hid_generic_pc13.bin md5 checksum: 7133ed5a7f7b88974ece60a3432145d, stlink checksum: 0x0002b428
2023-02-25T22:41:56 INFO common.c: Attempting to write 1976 (0x7b8) bytes to stm32 address: 134217728 (0x8000000)
2023-02-25T22:41:56 INFO common.c: Flash page at addr: 0x08000000 erased
2023-02-25T22:41:57 INFO common.c: Flash page at addr: 0x08000400 erased
2023-02-25T22:41:57 INFO common.c: Finished erasing 2 pages of 1024 (0x400) bytes
2023-02-25T22:41:57 INFO common.c: Starting Flash write for VL/F0/F3/F1_XL
2023-02-25T22:41:57 INFO flash_loader.c: Successfully loaded flash loader in sram
2023-02-25T22:41:57 INFO flash_loader.c: Clear DFSR
2/ 2 pages written
2023-02-25T22:41:57 INFO common.c: Starting verification of write complete
2023-02-25T22:41:57 INFO common.c: Flash written and verified! jolly good!
but the LED is just flashing and there is no usb serial port when connected via USB.
What am I missing?
I am trying to flash my STM32F103C8, I have already compiled my blink test sketch but when I try to flash the .bin I get a segmentation fault.
I execute it with this command:
./hid-flash ~/Desktop/test.bin ttyACM0
The output that I get is:
+-----------------------------------------------------------------------+
| HID-Flash v2.2.1 - STM32 HID Bootloader Flash Tool |
| (c) 2018 - Bruno Freitas http://www.brunofreitas.com |
| (c) 2018-2019 - Vassilis Serasidis https://www.serasidis.gr |
| Customized for STM32duino ecosystem https://www.stm32duino.com |
+-----------------------------------------------------------------------+
> Trying to open the [ttyACM0]...
error, counldn't open [/dev/ttyACM0]
> Unable to open the [ttyACM0]
> Searching for [1209:BEBA] device...
#
> [1209:BEBA] device is found !
> Sending <reset pages> command...
Segmentation fault
After that the STM32's led starts to blink quickly, and I have to restart the STM32 to keep executing the sketch that is flashed in it.
I am using a Raspberry Pi 4 as host system.
Hey,
I was able to flash the bootloader to my blue pill (F103C8T6) using the st-flash
utility. However, I cannot flash any sketches because macOS doesn't seem to detect a COM port in it (/dev/cu.*
).
The only way to flash a sketch reliably is to switch to a Windows machine, use the CDC mode (#19) to flash a first sketch with USART serial enabled, and only then to switch the jumpers to BOOT0-0 and BOOT1-0.
If somehow I forget to keep USART enabled in macOS, the COM port disappears and I cannot flash anything again until I reflash the bootloader and a sketch in Windows.
Hi.
I want to flash this bootloader to my bluepill but I don't understand this part:
Apply the Arduino_STM32_patch from here in case of using Roger's Core (select the zip file according to your Operating System).
I'm using Roger's Core. How to apply the patch?
I flashed hid_generic_pc13.bin
to several of my devices, but I am unable to see the HID device on the USB bus. Arduino claims:
-----------------------------------------------------------------------+
| HID-Flash v2.2.1 - STM32 HID Bootloader Flash Tool |
| (c) 2018 - Bruno Freitas http://www.brunofreitas.com |
| (c) 2018-2019 - Vassilis Serasidis https://www.serasidis.gr |
| Customized for STM32duino ecosystem https://www.stm32duino.com |
+-----------------------------------------------------------------------+
> Trying to open the [cu.usbserial-A5018LV7]...
> Toggling DTR...
> Searching for [1209:BEBA] device...
##########
An error occurred while uploading the sketch
Error - [1209:BEBA] device is not found :(> Searching for [cu.usbserial-A5018LV7] ...
> [cu.usbserial-A5018LV7] is found !
> Finish
I've used many uP before, but this one seems to be giving me problems. Any idea what I am doing wrong here?
I have a FTDI connected, but am not sure where DTR is supposed to be connected. This may be part of the issue. I am powering only over USB, which is also connected of course.
Thanks!
Apply the Arduino_STM32_patch from here in case of using Roger's Core (select the zip file according to your Operating System).
Link to patch is broken... I got it from github history - but is there a reason to not provide it/support it?
After flashing the bootloader I cannot execute step where the patch has to be applied because the link is broken.
Furthermore when I connect blue pill directly (not via FTDI dongle), computer cannot recognise the device and there are no available ports in Arduino IDE under tools > port.
Arduino IDE return error: Error - [1209:BEBA] device is not found
I am using Arduino_Core_STM32
EDIT:
I forgot to change jumper back to 0 and bootloader got deleted when I disconnected FTDI.
BUT still, after flashing HID bootloader, windows detects the device as HID USB and I can upload a Blink sketch, though tools > port is still grayed out.
But immediately after uploading, Windows notifies me that it cannot recognise the device and blue pill seems to have crashed because led stops blinking. No further uploads are possible until bootloader is re-flashed.
Hello, I am not an Arduino user and lack of debugger is a terrific issue.
I loaded a test program from web,
https://maker.pro/arduino/projects/simple-fm-radio-receiver-with-arduino-uno-and-rda5807m
loaded doesn't work as is.
Adapting got some time to isolate where is stuck. Code is quite noobs and seems modified from other sources but issue come from library or bootloader.
Need spread a lot of wait time on setup around serial communication directive before use them.
At final code stuck at wire communication, procedure never return and loop as stack got corrupted, reenter procedure?
No debugger no idea what happen... Arduino IDE is just a time wasting.
changed key selector from analog to digital, added timeout on exit.
stuck on status read where never return back to main loop.
Code run enter exit setup, enter loop but stuck here:
if(( millis()-time2)>50)
{
Serial.print("Pre StatRD"); <<-- execute this
ReadEstado(); <<-- stuck here (stack fault?)
Serial.println("Post StatRD"); <<--- Never execute this line after enter previous line procedure. Procedure continue loop itself
init ok
sensor = 98
Post butt
Millis=2963 Time=2912 Time1=2912 Time2=2912 Time3=2912
Pre StatRDReqfrom for Loop after for End proc readST
Reqfrom for Loop after for End proc readST
Reqfrom for Loop after for End proc readST
Reqfrom for Loop after for End proc readST
Reqfrom for Loop after for End proc readST
Reqfrom for Loop after for End proc readST
Reqfrom for Loop after for End proc readST
Reqfrom for Loop after for End proc readST
2 3 second hang, stack overlow?
Reqfrom for Loop after for End proc readST
Reqfrom for Loop after for End proc readST
Reqfrom
got similar issue from rf generator test file, this is SPI out only no hardware required for test.
Abandoned migrating to native code with minor issue.
When I change MAX_PACKET_SIZE to 64, the PC will fail to request device descriptor.
Got it to upload but then com port disappears is there supposed to be serial support when using this boot-loader?
After flashing boot loader with stlink
It does not show as a com port but does not error.
Output of upload
> Trying to open the [COM7]...
> Unable to open the [COM7]
> Searching for [1209:BEBA] device...
#
> [1209:BEBA] device is found !
> Sending <reset pages> command...
> Flashing firmware...
. 1024 Bytes
. 2048 Bytes
. 3072 Bytes
. 4096 Bytes
. 5120 Bytes
. 6144 Bytes
. 7168 Bytes
. 8192 Bytes
. 9216 Bytes
. 10240 Bytes
. 11264 Bytes
. 12288 Bytes
. 13312 Bytes
. 14336 Bytes
. 15360 Bytes
. 16384 Bytes
. 17408 Bytes
. 18432 Bytes
. 19456 Bytes
. 20480 Bytes
. 21504 Bytes
. 22528 Bytes
. 23552 Bytes
. 24576 Bytes
. 25600 Bytes
> Done!
> Sending <reboot mcu> command...
> Searching for [COM7] ...
> Finish
processing.app.SerialException: Error opening serial port 'COM7'.
at processing.app.Serial.<init>(Serial.java:147)
at processing.app.Serial.<init>(Serial.java:82)
at processing.app.SerialMonitor$4.<init>(SerialMonitor.java:101)
at processing.app.SerialMonitor.open(SerialMonitor.java:101)
at processing.app.AbstractMonitor.resume(AbstractMonitor.java:104)
at processing.app.Editor.resumeOrCloseSerialMonitor(Editor.java:2126)
at processing.app.Editor.access$1300(Editor.java:115)
at processing.app.Editor$UploadHandler.run(Editor.java:2104)
at java.lang.Thread.run(Thread.java:748)
Caused by: jssc.SerialPortException: Port name - COM7; Method name - openPort(); Exception type - Port not found.
at jssc.SerialPort.openPort(SerialPort.java:167)
at processing.app.Serial.<init>(Serial.java:136)
... 8 more
Error opening serial port 'COM7'.
Checked in device manager it is showing as COM4 with error
This device cannot start. (Code 10)
{Operation Failed}
The requested operation was unsuccessful.
No further uploads work and com4 is not selectable
> Trying to open the [COM7]...
> Unable to open the [COM7]
> Searching for [1209:BEBA] device...
##########
Error - [1209:BEBA] device is not found :(> Searching for [COM7] ...
> Finish
the selected serial port > Finish
does not exist or your board is not connected
No issues using serial/stlink or maple bootloader
Hello to everyone
I have a custom PCB with STMf407IGT and i have ported Arduino_Core_STM32 and works just fine when flashed using ST-LINK
and the serial com works, i compiled STM32_HID_Bootloader for my MCU (diff clock) and while it flashes just fine using the following settings on Arduino IDE i don't seem to be able to make the USB Com Port available on my device manager.
Do you have any ideas at what to look??
George Kalampakas
My settings
Hi Serasidis
I'm using Roger Core
I've used your Bootloader on Roger Clark's core and it was working great on 103c8t6... now I've tried to use on STM32F103RCT6 and there are problems that I cannot fix... (STM32 HID Bootloader 2.1.0)
I tried to add an edited hid_bootloader file to ....\STM32F1\variants\generic_stm32f103r\ld and I edited the boards.txt file for genericSTM32F103R UPLOAD METHODS adding HID....
I tried to recompile the generic-PD2.bin (make generic-pd2 PAGE_SIZE=2048) ...
When I upload the sketch the IDE recognizes the board and it seems to upload correctly, but a simple blink doesn't work...
(It works with Roger bootloader).
Maybe the HID bootloader is just not compatible with high density devices..?
Can I use the board as a 128KB STM32F103RBT6? That should be a low density right?
I tried but without luck... I compiled the generic-PD2.bin on Windows using CYGWIN64 and the GNU Arm Embedded Toolchain: 10-2020-q4-major December 11, 2020. It compiles without errors but it gives some warning about deprecated things...
the board: https://stm32-base.org/boards/STM32F103 ... -V2.0.html
The chip onboard seems to be genuine... in the past I had issues with blue pills that worked ok with Roger bootloader, but they all couldn't work with the HID bootloader... turned out those blue and black pills had on board all fake chips...
I would like to keep Roger Core because I'm working on a project using arprus USB_composite (which is only compatible with Roger core)
Thanks
Maurizio
the Built-in LED of the STM32f103C8 which is connected to PC13 stays ON even on an empty sketch.
what is the solution for this issue ?
I'm trying to use this bootloader but upload always stops on sending first 1024bytes:
> Searching for 1209:BEBA HID device...
#
> 1209:BEBA device is found !
> Sending <reset pages> command...
> Flashing firmware...
. 1024 Bytes
^C
any idea what is wrong?
Hello. Thanks for the work done. Could you explain how to build a binary for a spectific board? I would like to upload the HID bootloader on STM32F401RC and other STM32F4xx boards. At the moment there is one binary file diymroe_stm32f407vgt_pe0.bin and I don't see if theres is a way to make a the specific STM32F401RC .bin Quite the same as #23
Hi,
The previous version was compiling but was not uploading.
The current version is no longer compiling.
But SAM is ok.
Linux: Manjaro (XFCE) 32 bits and 64 bits
(ST-link V2 works, does not seem to be a problem with the system, both are newly installed)
Note: In the previous version was showing 'HID bootloader V3.0', and in the current is 'V2.0'.
Thank you.
P.S.: (They are different computers, 32bits: AMD, 64bits: Intel)
Screenshots:
32 bits.zip
64 bits.zip
STM32_HID_Bootloader/bootloader_F1/usb.c
Line 192 in 4242f61
I have 2 concerns here:
the line just above is:
_SetCNTR(CNTR_RESETM | CNTR_SUSPM | CNTR_WKUPM);
, so I don't see the point to test for DOVR, ERR, SOF and ESOF. For ERR, the Reference Manual clearly says that "The USB software can usually ignore errors". We don't care about SOF and ESOF, and data overrun is unlikely with HID
More importantly, the Reference Manual states that:
The upper part of this register contains single bits, each of them representing a specific
event. These bits are set by the hardware when the related event occurs; if the
corresponding bit in the USB_CNTR register is set, a generic interrupt request is generated.
The interrupt routine, examining each bit, will perform all necessary actions, and finally it will
clear the serviced bits. If any of them is not cleared, the interrupt is considered to be still
pending, and the interrupt line will be kept high again. If several bits are set simultaneously,
only a single interrupt will be generated.
So, my understanding is that we should not return after testing each condition, but run though all of them in sequence, or we get a chance to miss one or even lock the transfer.
I apologize in advance, as I am a n00b just getting started in STM32duino development, but I've decided to use the STM Official Core. Will there be support for it soon? THANKS for the impressive work so far!
Arduino: 1.8.12 (Windows 10), Board: "Arduino Mega or Mega 2560, ATmega1280"
Sketch uses 658 bytes (0%) of program storage space. Maximum is 126976 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 8183 bytes for local variables. Maximum is 8192 bytes.
C:\Users\dimie\Downloads\arduino-1.8.12-windows\arduino-1.8.12\hardware\tools\avr/bin/avrdude -CC:\Users\dimie\Downloads\arduino-1.8.12-windows\arduino-1.8.12\hardware\tools\avr/etc/avrdude.conf -v -V -patmega1280 -carduino -PCOM7 -b57600 -D -Uflash:w:C:\Users\dimie\AppData\Local\Temp\arduino_build_443593/sketch_may28a.ino.hex:i
An error occurred while uploading the sketch
avrdude: Version 6.3-20190619
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "C:\Users\dimie\Downloads\arduino-1.8.12-windows\arduino-1.8.12\hardware\tools\avr/etc/avrdude.conf"
Using Port : COM7
Using Programmer : arduino
Overriding Baud Rate : 57600
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
I have tried everything but it keeps coming up with the error
Hello,
Please add instructions in case the user reaches this repository.
User does not need to compile anything
Simply apply the path on the Arduino_STM32 folder and write the bootloader in STM32 (which is in the bootloader_only_binaries folder), maybe using stlink (STSW-LINK004 etc) or via serial port (demonstrator - UM0462 etc).
The first time the bootloader does not generate a serial port, only after the IDE upload some sketch. Then the user must select this serial port (added in the IDE) to upload again.
Thank you.
does anyone know of rough estimate to on how to compile the bootloader. Im trying to find a way to do so but i haven't hit any luck with just the make file and windows. I jut get the "make is a unknown command " error
Hello,
My blue pill contains a chip of stm32F10336t6.
I am using STM32 core by STMicroelectronics (Arduino IDE).
I followed all the processes of installing this HID bootloader. But when I connect the USB cable to my Windows PC , the device manager says,
unknown USB device (device descriptor request failed)
How I can solve this?
Hi,
I am using Arduino IDE for programming BluePill for a long time using serial(FTDI Module), Operating system windows 64bit.
I followed this guy and installed a USB bootloader by STM32CUBEPROGRAMMER and it is still running fine. But the problem happened when I tried to use multiple blue pills, all uploaded the same HID bootloader. My computer only recognizes my 1st blue pill only as a virtual com port. And for the rest of them, it shows in device manager:
unknown USB device (device descriptor request failed)
How to get rid of this situation?
How to create a virtual com port for all of them?
~/prog/STM32_HID_Bootloader/bootloader/F1$ make generic-pc13
CLEAN
arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors 6-2017-q2-update) 6.3.1 20170620 (release) [ARM/embedded-6-branch revision 249437]
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
MKDIR build
CC Src/main.c
CC Src/usb.c
CC Src/hid.c
CC Src/led.c
CC Src/flash.c
LD build/hid_bootloader.elf
Memory region Used Size Region Size %age Used
RAM: 3024 B 20 KB 14.77%
FLASH: 1984 B 64 KB 3.03%
GENBIN build/hid_bootloader.bin
make: *** No rule to make target 'bootloader_only_binaries', needed by 'copy_generic-pc13'. Stop.
Hi, i had been trying to compile teh bins on Linux. Exactly the F1 bins. This is what it throws
In file included from Src/main.c:31: Inc/config.h:121:3: error: #error "No config for this target" #error "No config for this target"
Any idea?
Hello.
I am running Ubuntu Linux
I have loaded the hid_maple_mini.bin onto my maple mini clone board, following the procedure describe here: https://www.youtube.com/watch?v=Myon8H111PQ
When I plug in the board,
lsusb returns: ID 1209:beba InterBiometrics
ls /dev/ttyUSB* returns nothing
When I try to upload a sketch using the Arduino IDE I get the following messages:
error, counldn't open [/dev/ttyUSB0]
+-----------------------------------------------------------------------+
| HID-Flash v2.2.1 - STM32 HID Bootloader Flash Tool |
| (c) 2018 - Bruno Freitas http://www.brunofreitas.com |
| (c) 2018-2019 - Vassilis Serasidis https://www.serasidis.gr |
| Customized for STM32duino ecosystem https://www.stm32duino.com |
+-----------------------------------------------------------------------+
Trying to open the [ttyUSB0]...
Unable to open the [ttyUSB0]
Searching for [1209:BEBA] device...
[1209:BEBA] device is found !
Sending command...
the selected serial port > Sending command...
does not exist or your board is not connected
What am I missing?
Thanks
Hi,
I tried to compile one from here even with modifications I couln't get it working on STM32F401 so decided to port it to PlatformIO for easier compiling. I can build now the bootloader it detects as HID and Led lights up, but I can't make it to work with hid-flash. If someone can help me to troubleshoot it or to point in corect direction we may have good and reliable bootloader for 4x1 series.
ling to my git STM32F4x1_HID_Bootloader
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.