Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please add support for Black Pill F401CC Device #23

Closed
ajaybnl opened this issue Nov 2, 2019 · 23 comments
Closed

Please add support for Black Pill F401CC Device #23

ajaybnl opened this issue Nov 2, 2019 · 23 comments

Comments

@ajaybnl
Copy link

ajaybnl commented Nov 2, 2019

Please add support for Black Pill F401CC Device

@ajaybnl ajaybnl changed the title Nothing on USB after Update Hid Bootloader Stm32F407CC Using Stm32Cube Thru StlinkV2 Please add support for Black Pill F401CC Device Nov 2, 2019
@roboticboyer
Copy link

roboticboyer commented Jul 18, 2020

I suggest to use the WeAct Bootloader. In case is used a Black Pill is required to press the P0 button to enter in the boot mode

There is also a HID Bootloader forked from the Serasidis' one but not tested from me

@samveen
Copy link

samveen commented Aug 6, 2020

@roboticboyer The WeAct Bootloader doesn't seem to integrate with Arduino IDE like the HID Bootloader does. Not only that, their fork of the HID Bootloader modifies the flag check, and thus also doesn't work with the HID Bootloader upload method in the Arduino IDE. I managed to get a working version, but I am unsure if it qualifies to be be merged into here.

@roboticboyer
Copy link

I wrote some notes how to use the WeAct Bootloader
@samveen where is available your bin file of the modified bootloader?

@samveen
Copy link

samveen commented Aug 7, 2020

@roboticboyer I didn't put it up anywhere, expecting that people might be more comfortable building it themselves. However you can find it via this google drive link
Edit: I figured out attachments 🤦‍♂️
hid_bootloader.bin-2.2.2-6-g296db49.gz

@roboticboyer
Copy link

roboticboyer commented Aug 21, 2020

I have a Black Pill F401CC
I have uploaded your hid_bootloader.bin file but the HID 2.2 uploader is not able to find the usb devide 1209:BEBA
When I connect the blackpill there is only 0483:df11

I tried with DFU:
./dfu-util -a 0 -s 0x08000000 -D hid_bootloader.bin
and:
./stm32CubeProg.sh 2 hid_bootloader.bin -g

Also using an ST-Link programmer:
./stm32CubeProg.sh 0 hid_bootloader.bin -g

Where I'm wrong?

@samveen
Copy link

samveen commented Aug 28, 2020

I used dfu-util to write it to the board. One thing I'll note is that I'm using a 411, instead of a 401. May I suggest that you look at the changed code and see if you can build it locally instead of using the one I built, given that I am a beginner myself, so my changes might need reviewing before you use them.

@roboticboyer
Copy link

roboticboyer commented Aug 29, 2020

Thank you
I'll check and recompile the firmware for the 401
Please only confirm that the parameters of dfu-util are correct:
./dfu-util -a 0 -s 0x08000000 -D hid_bootloader.bin

Is required to press the Button PA0 to enter in Boot mode?

@samveen
Copy link

samveen commented Aug 29, 2020

I used dfu-util -a 0 -d 0483:df11 -s 0x8000000:mass-erase:force -D hid_bootloader.bin -t 1024

@zoobab
Copy link

zoobab commented Feb 15, 2021

I have a WeAct BlackPill:

http://zoobab.wikidot.com/stm32f401-devboard

Those guys at WeAct are shooting themselves in the foot, as what people are interested in is Arduino IDE support, which cannot happen if the flashing tools are forked from BSD-licensed software and made proprietary.

@dreamcat4
Copy link

hello, sorry am a bit new to this device, and just wanted to know:

  • why is hid bootloader better than dfu mode?
  • how can i upload sketches without having to press a physical button on the device, etc?

@rgoulter
Copy link

how can i upload sketches without having to press a physical button on the device, etc?

A compilation output of an Arduino sketch is a firmware for the device. A bootloader is firmware which helps you update the 'application' firmware (e.g. the Arduino sketch).

The easiest / most reliable way I've found is to use an STLink.

Whereas, I've found DFU to be ... finicky; sometimes only working if I hold down both the BOOT and NRST buttons for a long time (30s+), or not work at all. (Different levels of success depending on the OS / which particular dev board is used).

This HID bootloader in this repo (IIUC) would allow updating the firmware when used with the hid flashing program (also in this repo). This particular fork of the HID bootloader is geared towards Arduino. -- The benefit being, you could update the firmware without needing to push any buttons on the dev board. - If you flash the bootloader with the correct configuration, this should let you upload from Arduino IDE.

@dreamcat4
Copy link

well i have the weact f411 here on platformio. and have been flashing it in dfu mode. pressing the button

could plugin an stlink i suppose. its just more wires / cables

but if you think i can have hid flashing without needing the buttons for this device? because that might seem worth it

can then add a custom uploader cmdline in the platformio.ini file to call it

however what confuses me, and makes me ask about butonless HID mode is because the README seems to say i still need to press some button... key instead of boot0, same difference really.

in which case it does not achieve the set goal, and is no better than dfu mode for me. sorry for the confusion, but i am really confused by this. wherever i look online about it for this particular board :)

hehe

@rgoulter
Copy link

however what confuses me, and makes me ask about butonless HID mode is because the README seems to say i still need to press some button... key instead of boot0, same difference really.

Where in the README does it say that?

@dreamcat4
Copy link

@rgoulter
Copy link

Ah, that's right. Sorry, I haven't yet tried this bootloader. I recall seeing the code has a comment in the entrypoint:

In case of incoming magic number or <BOOT_1_PIN> is LOW, jump to HID bootloader

https://github.com/Serasidis/STM32_HID_Bootloader/blob/master/bootloader/F4/Src/main.c#L138
(Per WeAct's changes, the WeAct MiniF4's <key> is the boot_1 being referred to).

so presumably, the bootloader can be entered by setting the value & triggering a reset from the firmware, and could be entered without pushing a button.

@dreamcat4
Copy link

and could be entered without pushing a button.

how?

you lost me again. sorry i could not follow that explanation

@rgoulter
Copy link

This is what makes sense to me; I haven't tried it. I don't have any significant experience with embedded development; so I'd suggest the search terms "stm32 software reset"; and/or figure out how to set a particular register to a particular value in the stm32duino port.

Again, the bootloader in this repo enters the HID bootloader if the boot_1 is low (i.e. <key> is held down), or "incoming magic number" (value of a particular register has a specific value) when the bootloader starts. i.e. after a reset or when the device is plugged in. - As you point out, the "key held down" part isn't more useful than the built-in DFU; but I'd expect it's possible to write to a register and reset the MCU from the firmware.

@dreamcat4
Copy link

so this is... some WIP not finished yet?

stm32duino/Arduino_Core_STM32#1118 (comment)

in PR #710 ?

@pathnirvana
Copy link

I wrote some notes how to use the WeAct Bootloader
@samveen where is available your bin file of the modified bootloader?

I was able to get f401cc working with platformio by following some of the above steps by @roboticboyer

In wsl or linux
objcopy -Iihex -j .sec1 -Obinary WeAct_HID_Bootloader_F4x1.hex WeAct_HID_Bootloader_F4x1.bin dfu-suffix -a WeAct_HID_Bootloader_F4x1.bin

then in windows
.\st-flash.exe write .\WeAct_HID_Bootloader_F4x1.bin 0x8000000

finally in platformio.ini file
[env:blackpill_f401cc] platform = ststm32 board = blackpill_f401cc framework = arduino upload_protocol = dfu

to put in the bootloader mode press nrst button while boot0 is pressed. you should see STM32 BOOTLOADER in windows device manager when it is in the bootloader mode.

hope this helps someone

@pathnirvana
Copy link

probably not much related here. But recently I changed to using tinyuf2 instead of the hid bootloader for both f401 and f411 blackpills. much easier to get into the bootloader mode - just double tap the reset button.
can be flashed easily with
.\st-flash.exe write .\tinyuf2-stm32f401_blackpill-0.5.0.bin 0x8000000

also the releases can be downloaded from https://github.com/adafruit/tinyuf2/releases/

@xromansx
Copy link

So for now only one working option to flash blackpill through USB without touching it is WeAct_HID_Bootloader

@xromansx
Copy link

I used dfu-util to write it to the board. One thing I'll note is that I'm using a 411, instead of a 401. May I suggest that you look at the changed code and see if you can build it locally instead of using the one I built, given that I am a beginner myself, so my changes might need reviewing before you use them.

I recompiled you version but can't get it working.

@samveen
Copy link

samveen commented Sep 30, 2022

I used dfu-util to write it to the board. One thing I'll note is that I'm using a 411, instead of a 401. May I suggest that you look at the changed code and see if you can build it locally instead of using the one I built, given that I am a beginner myself, so my changes might need reviewing before you use them.

I recompiled you version but can't get it working.

It's been quite some time since I touched it. Things may have changed a lot during that time. Please check the errors and see if you are able to fix them, as I haven't touched this code for more than 2 years.

@ajaybnl ajaybnl closed this as completed Nov 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants