WeAct Studio STM32F411CEU6 BlackPill v3.1 crystal is 8 MHz
-
- Posts: 23
- Joined: Fri Apr 19, 2024 1:04 am
WeAct Studio STM32F411CEU6 BlackPill v3.1 crystal is 8 MHz
Hello friends!
I bought a new version of the Black Pill v3.1 board (WeAct Studio) with HSE 8 MHz.
The standard version of the board is available with HSE 25 MHz, and this board (easier to enter dfu mode by usb)
was made with HSE 8 MHz and it does not work.
Please tell me in detail what and where to fix so that the board works in Arduino.
I am a novice specialist and I really need to launch this board.
I will be very grateful for your help.
I bought a new version of the Black Pill v3.1 board (WeAct Studio) with HSE 8 MHz.
The standard version of the board is available with HSE 25 MHz, and this board (easier to enter dfu mode by usb)
was made with HSE 8 MHz and it does not work.
Please tell me in detail what and where to fix so that the board works in Arduino.
I am a novice specialist and I really need to launch this board.
I will be very grateful for your help.
Re: WeAct Studio STM32F411CEU6 BlackPill v3.1 crystal is 8 MHz
Simply redefine HSE_VALUE using hal_conf_extra.h.
See the wiki.
See the wiki.
-
- Posts: 23
- Joined: Fri Apr 19, 2024 1:04 am
Re: WeAct Studio STM32F411CEU6 BlackPill v3.1 crystal is 8 MHz
Hi fpiSTM !
There is no such file. I need to create it myself in the catalog C:\Users\Admin\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.7.1\variants\STM32F4xx\F411C(C-E)(U-Y)?
Or does it need to be created in another directory? I looked at the Wiki, but did not understand what needs to be entered there.
Only one line #define HSE_VALUE 800000000U or something else needs to be added to this file?
Could you help me write the contents of this file?
Re: WeAct Studio STM32F411CEU6 BlackPill v3.1 crystal is 8 MHz
https://github.com/stm32duino/Arduino_C ... adaptation
https://github.com/stm32duino/Arduino_C ... efinitions
So simply create the file with at sketch level :
#define HSE_VALUE 800000000U
https://github.com/stm32duino/Arduino_C ... efinitions
So simply create the file with at sketch level :
#define HSE_VALUE 800000000U
-
- Posts: 23
- Joined: Fri Apr 19, 2024 1:04 am
Re: WeAct Studio STM32F411CEU6 BlackPill v3.1 crystal is 8 MHz
I created the hal_conf_extra.h file with a single line #define HSE_VALUE 800000000U and put it in the folder with the sketch, next to the blink.ino files.
The program is loaded into the microcontroller, but the LED does not blink.
I use the standard Blink program from the examples
Why doesn't it work?
What could be the problem?
I checked on 3 boards.
The program is loaded into the microcontroller, but the LED does not blink.
I use the standard Blink program from the examples
Code: Select all
// the setup function runs once when you press reset or power the board
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
What could be the problem?
I checked on 3 boards.
Re: WeAct Studio STM32F411CEU6 BlackPill v3.1 crystal is 8 MHz
Is the LED_BUILTIN correct for this new board?
Re: WeAct Studio STM32F411CEU6 BlackPill v3.1 crystal is 8 MHz
Pay attention it seems you set 80MHz and not 8MHz
-
- Posts: 23
- Joined: Fri Apr 19, 2024 1:04 am
Re: WeAct Studio STM32F411CEU6 BlackPill v3.1 crystal is 8 MHz
1. I fixed it to #define HSE_VALUE 8000000U
2. I wrote the LED pin myself (PC13)
https://aliexpress.com/item/1005001456186625.html 8 MHz XTAL version
https://github.com/WeActStudio/WeActStu ... iSTM32F4x1
It doesn't work anyway (
What else can I check?
I have attached my project
2. I wrote the LED pin myself (PC13)
Code: Select all
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(PC13, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(PC13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(PC13, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
https://github.com/WeActStudio/WeActStu ... iSTM32F4x1
It doesn't work anyway (
What else can I check?
I have attached my project
- Attachments
-
- Blink.zip
- (674 Bytes) Downloaded 804 times
Re: WeAct Studio STM32F411CEU6 BlackPill v3.1 crystal is 8 MHz
You should redefine the system core clock config to properly configure the pll vs the HSE value.
Re: WeAct Studio STM32F411CEU6 BlackPill v3.1 crystal is 8 MHz
Note that even with a wrong crystal frequency, you should be able to blink your led
and your LED should blink, if it doesn't blink then your issue is likely not related to the crystal frequency.
e.g. wrong/different LED pin ? did you manage to flash / install the firmware/sketch properly?
the 'defacto' standard is to use stm32cube programmer ('official' from ST)
https://www.st.com/en/development-tools ... eprog.html
though for the 'experts' there are open sourced 3rd party tools available.
there are also standard procedures if you want to use USB DFU to install the sketch (firmware), you need to set boot0 and press reset. did you do that?
for WeAct f401/f411, the 'standard' button dance
- connect usb
- press both boot0 and reset
- hold boot0 release reset
- release boot0 2 secs later
- then program from stm32cube programmer
- if you need the bin file, it is from the arduino menu -> export compiled binary, the bin file should be found in your project/sketch folder.
Note that all the various schematics SchDoc 20 - 31
https://github.com/WeActStudio/WeActStu ... master/HDK
all show a 25 Mhz crystal, are you sure the crystal on your board is 8 Mhz?
if you are sure 8 Mhz is correct, try out the python script here
viewtopic.php?t=78
running that script would give you various M, N, P, Q pll multipliers and the fcpu - cpu frequency e.g.
e.g. for stm32f411ce the specs give a fcpu of 100 Mhz - the closest from the script is 96 Mhz
https://www.st.com/en/microcontrollers- ... 411ce.html
hence, use those m, n, p, q multipliers values
go into your variant e.g. variant_BLACKPILL_F411CE.cpp in the core files installed with your (Arduino) IDE
look for void SystemClock_Config(void)
and look for the codes where the PLL multipliers are set e.g.
https://github.com/stm32duino/Arduino_C ... CE.cpp#L95
this is for 25 Mhz, you can comment those codes, then copy them and revise the m, n, p, q multipliers based on that from the python script.
in fact, for this you won't even need to use the python script, simply change PLLM to 8, and that should work for a 8 Mhz crystal.
note that you should also consult the manual as well as the specs on the clock and reset control (RCC chapters) and check that the remaining configurations that the ahb / apb clock dividers are after all correct.
usually, based on the values from the python script, usb would be working correctly i.e. at 48 mhz.
select USB CDC Serial as your serial port and if you have codes like
the virtual comm port should be working, e.g. that you can use the serial monitor e.g. in the Arduino IDE to test it.
if your HSE crystal is after all not running at 8 Mhz (with the new m, n, p, q) multipliers or in the original with 25 Mhz, then usb won't work no matter how.
and I supposed you have already reviewed and done the steps as documented in the Wiki
https://github.com/stm32duino/Arduino_C ... ng-Started
https://github.com/stm32duino/Arduino_Core_STM32/wiki
if you have not even tried those, then all these comments are 'way advanced' compared to those already documented in the getting started guide.
if there is still issues get a board like
https://www.st.com/en/evaluation-tools/ ... 401re.html
https://www.st.com/en/evaluation-tools/ ... 411re.html
or the 'original' weact f411 with 25 Mhz crystal
https://www.aliexpress.com/item/1005001456186625.html
that should work by simply selecting the correct variant
Code: Select all
void setup() {
pinMode(LED_BUILTIN,OUTPUT);
}
void loop() {
digitalWrite(LED_BUILTIN, ! digitalRead(LED_BUILTIN));
delay(1000);
}
e.g. wrong/different LED pin ? did you manage to flash / install the firmware/sketch properly?
the 'defacto' standard is to use stm32cube programmer ('official' from ST)
https://www.st.com/en/development-tools ... eprog.html
though for the 'experts' there are open sourced 3rd party tools available.
there are also standard procedures if you want to use USB DFU to install the sketch (firmware), you need to set boot0 and press reset. did you do that?
for WeAct f401/f411, the 'standard' button dance
- connect usb
- press both boot0 and reset
- hold boot0 release reset
- release boot0 2 secs later
- then program from stm32cube programmer
- if you need the bin file, it is from the arduino menu -> export compiled binary, the bin file should be found in your project/sketch folder.
Note that all the various schematics SchDoc 20 - 31
https://github.com/WeActStudio/WeActStu ... master/HDK
all show a 25 Mhz crystal, are you sure the crystal on your board is 8 Mhz?
if you are sure 8 Mhz is correct, try out the python script here
viewtopic.php?t=78
running that script would give you various M, N, P, Q pll multipliers and the fcpu - cpu frequency e.g.
Code: Select all
FHSE: 8 m: 1 n: 18 p: 2 (RCC_PLLP_DIV2) q: 3 fusb: 48.0 fcpu: 72.0
FHSE: 8 m: 1 n: 24 p: 2 (RCC_PLLP_DIV2) q: 4 fusb: 48.0 fcpu: 96.0
FHSE: 8 m: 1 n: 36 p: 4 (RCC_PLLP_DIV4) q: 6 fusb: 48.0 fcpu: 72.0
FHSE: 8 m: 1 n: 42 p: 4 (RCC_PLLP_DIV4) q: 7 fusb: 48.0 fcpu: 84.0
FHSE: 8 m: 1 n: 48 p: 4 (RCC_PLLP_DIV4) q: 8 fusb: 48.0 fcpu: 96.0 <-
FHSE: 8 m: 1 n: 54 p: 4 (RCC_PLLP_DIV4) q: 9 fusb: 48.0 fcpu: 108.0
...
https://www.st.com/en/microcontrollers- ... 411ce.html
hence, use those m, n, p, q multipliers values
go into your variant e.g. variant_BLACKPILL_F411CE.cpp in the core files installed with your (Arduino) IDE
look for void SystemClock_Config(void)
and look for the codes where the PLL multipliers are set e.g.
https://github.com/stm32duino/Arduino_C ... CE.cpp#L95
Code: Select all
RCC_OscInitStruct.PLL.PLLM = 25;
RCC_OscInitStruct.PLL.PLLN = 192;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
RCC_OscInitStruct.PLL.PLLQ = 4;
in fact, for this you won't even need to use the python script, simply change PLLM to 8, and that should work for a 8 Mhz crystal.
note that you should also consult the manual as well as the specs on the clock and reset control (RCC chapters) and check that the remaining configurations that the ahb / apb clock dividers are after all correct.
usually, based on the values from the python script, usb would be working correctly i.e. at 48 mhz.
select USB CDC Serial as your serial port and if you have codes like
Code: Select all
void setup() {
Serial.begin();
while(!Serial);
}
void loop() {
// echo usb serial input back to host
if (Serial.available())
while(Serial.available())
Serial.write(Serial.read());
delay(1);
}
if your HSE crystal is after all not running at 8 Mhz (with the new m, n, p, q) multipliers or in the original with 25 Mhz, then usb won't work no matter how.
and I supposed you have already reviewed and done the steps as documented in the Wiki
https://github.com/stm32duino/Arduino_C ... ng-Started
https://github.com/stm32duino/Arduino_Core_STM32/wiki
if you have not even tried those, then all these comments are 'way advanced' compared to those already documented in the getting started guide.
if there is still issues get a board like
https://www.st.com/en/evaluation-tools/ ... 401re.html
https://www.st.com/en/evaluation-tools/ ... 411re.html
or the 'original' weact f411 with 25 Mhz crystal
https://www.aliexpress.com/item/1005001456186625.html
that should work by simply selecting the correct variant