WeAct stm32F103CB HID Bootloader question

Post Reply
PGSmick
Posts: 5
Joined: Tue Jun 15, 2021 9:19 pm

WeAct stm32F103CB HID Bootloader question

Post by PGSmick »

Hello.

I need to be educated on this a bit.

I just bought a bunch of WeAct stm32F103CB BluePills whose internal LED is connected to pin PB2. I have an STLink and the STM32CubeProgrammer software installed. I couldn't find a hid_generic_pb2.bin file to flash so I just used the hid_generic_pc13.bin file that I have used for other variants of blue pills.

Everything seems to work fine. I can upload a sketch from the Arduino IDE using the HID Bootloader upload method connected via a USB cable and I can make the LED blink by specifying the PB2 pin. I can upload sketches repeatedly with no difficulty. The serial monitor works fine. So all's good, no?

So, am I missing anything by having used the _pc13.bin file that I used? What is the purpose of having all those different bin files? If it matters which bin file I use, how can I get one that's designed for the board with the LED on pin PB2?

A million thanks in advance.
Peter
User avatar
Vassilis
Posts: 24
Joined: Wed Dec 18, 2019 3:04 pm
Location: Thessaloniki, Greece
Contact:

Re: WeAct stm32F103CB HID Bootloader question

Post by Vassilis »

The only difference among these bin files is the pin definition of the on-board LED used by the HID bootloader to indicate its status.
If you don't care about the status indicator, you can use any of these bin files.
how can I get one that's designed for the board with the LED on pin PB2?
The easy way is to edit the file: STM32_HID_Bootloader/bootloader/F1/Inc/config.h
and replace the following lines

Code: Select all

#elif defined TARGET_GENERIC_F103_PB12
	#define LED1_CLOCK		RCC_APB2ENR_IOPBEN
	#define LED1_BIT_0		SET_BIT(GPIOB->CRH, GPIO_CRH_CNF12_0 | GPIO_CRH_MODE12)
	#define LED1_BIT_1		//CLEAR_BIT(GPIOB->CRH, GPIO_CRH_CNF12_1)
	#define LED1_MODE
	#define LED1_OFF		WRITE_REG(GPIOB->BSRR, GPIO_BSRR_BS12)
	#define LED1_ON			WRITE_REG(GPIOB->BRR, GPIO_BRR_BR12)
with these:

Code: Select all

#elif defined TARGET_GENERIC_F103_PB12
	#define LED1_CLOCK		RCC_APB2ENR_IOPBEN
	#define LED1_BIT_0		SET_BIT(GPIOB->CRH, GPIO_CRH_CNF2_0 | GPIO_CRH_MODE2)
	#define LED1_BIT_1		//CLEAR_BIT(GPIOB->CRH, GPIO_CRH_CNF2_1)
	#define LED1_MODE
	#define LED1_OFF		WRITE_REG(GPIOB->BSRR, GPIO_BSRR_BS2)
	#define LED1_ON			WRITE_REG(GPIOB->BRR, GPIO_BRR_BR2)
Recompile the HID Bootloader source code and use the hid_generic_pb12.bin file
Vassilis Serasidis
https://www.serasidis.gr
PGSmick
Posts: 5
Joined: Tue Jun 15, 2021 9:19 pm

Re: WeAct stm32F103CB HID Bootloader question

Post by PGSmick »

Thanks very much!
Post Reply

Return to “STM32F1 based boards”