Bluepill F4 board, anyone still working on it?
Re: Bluepill F4 board, anyone still working on it?
PB11 is not available on the board, it seems.
- Attachments
-
- PB11 not available on 401_411.PNG (39.51 KiB) Viewed 12415 times
Pukao Hats Cleaning Services Ltd.
Re: Bluepill F4 board, anyone still working on it?
i've only done stevstrong's libmaple so i'd comment only on libmaple, usb-serial works,Bingo600 wrote: Wed Jan 01, 2020 9:31 amHappy new year.ag123 wrote: Tue Dec 31, 2019 4:00 pm it works STM32F401 black pill - steve's libmaple core
https://youtu.be/LEJK8lathQc
and happy new year everyone![]()
Does usb-serial , bootloader & upload work too ?
I'll have to try (on the 11') when i get back home
/Bingo
for bootloader, the stm32f401 has built-in usb dfu boot loader, and that's what i actually used to install my sketch.
sequence is:
- press both reset and boot0
- release reset while holding boot0
- dfu-util -l should list the device as ready for installation
Code: Select all
dfu-util -a 0 -s 0x8000000 -D blackpill_f401.bin
http://dfu-util.sourceforge.net/
or in windows use STM32CubeProgrammer
https://github.com/stm32duino/wiki/wiki/Upload-methods
i've a lousy broken usb cable and hit a few bummer, so use a good cable. usb is tricky as quite often you need a way to 'reset'
the usb bus
in linux there is this little known hacker's tool
https://github.com/jkulesza/usbreset
in windows, the hard core trick for 'usb reset' seemed to be 'scan for hardware changes' or 'disable/enable usb controller' !
https://support.microsoft.com/en-sg/hel ... usb-device
the goof about usb is that a usb reset is conventionally a single ended zero
http://www.usbmadesimple.co.uk/ums_3.htm
the trouble is pressing reset on a stm32 often simply resets the mcu, the usb signals often just stay unchanged during the whole reset.
the host 'remembers' the last state of the usb transactions and does 'nothing', and you are there waiting for the stm32 usb device to 'appear'

Last edited by ag123 on Wed Jan 01, 2020 2:26 pm, edited 2 times in total.
Re: Bluepill F4 board, anyone still working on it?
that is a sharp catch!
i'd guess while the engineers designed it, they placed i2c2_sda on pin 39 PB3 as well, you have an alternative, so what is missing is tim2_ch4
the other thing between f411 vs f401 is
f411 has hw sdio in that 48 pins, f401 no
f411 has 5 spi ! f401 only 3 in that same 48 pins - i've not yet figured out where is the catch
one thing i still like about the board is the pads for spi flash, spi psram or spi sram
8MB ps ram being a most value adding things one could put at those pins
https://www.aliexpress.com/item/33028533291.html
but i think it would still be a big challenge to try to use that 8MB anywhere close to being like ram, it'd take an elaborate paging scheme to swap 'pages' in and out of that 8MB psram. i'd guess it is at best fast read/write storage

Re: Bluepill F4 board, anyone still working on it?
8pin SPI FRAM would be a better option there, imo.
Pukao Hats Cleaning Services Ltd.
Re: Bluepill F4 board, anyone still working on it?
FeRAM are somewhat premium, but accordingly use much less power
https://www.digikey.com/en/product-high ... -memory-ic
https://www.digikey.com/catalog/en/part ... -bus/78614
https://en.wikipedia.org/wiki/Ferroelectric_RAM
then it seemed there is also MRAM
https://en.wikipedia.org/wiki/Magnetore ... ess_memory
https://www.digikey.com/catalog/en/part ... -mram/1501
https://www.mram-info.com/introduction
https://www.digikey.com/en/product-high ... -memory-ic
https://www.digikey.com/catalog/en/part ... -bus/78614
https://en.wikipedia.org/wiki/Ferroelectric_RAM
then it seemed there is also MRAM
https://en.wikipedia.org/wiki/Magnetore ... ess_memory
https://www.digikey.com/catalog/en/part ... -mram/1501
https://www.mram-info.com/introduction
Re: Bluepill F4 board, anyone still working on it?
just like to say the f401 black pill works 'out of the box' in stm32duino official core
Beginning Whetstone benchmark at 84 MHz ... -Os
Loops:10000, Iterations:1, Duration:11666.40 millisec
C Converted Single Precision Whetstones:85.72 Mflops
Beginning Whetstone benchmark at 84 MHz ... -O3
Loops:10000, Iterations:1, Duration:4599.50 millisec
C Converted Single Precision Whetstones:217.41 Mflops
i've been wondering if the 2nd run is a mistake, so i run it again, i got the same answer
the blink sketch looks like this,
the whetstone codes is the example in stevstrong's libmaple - it uses micros() to get the usecs duration, so maybe micros() cheated a little,
otherwise it is -O3 that cheats a little
https://github.com/stevstrong/Arduino_S ... /whetstone
btw the vendor installed a 'breathing' led blinky, so in this sketch, i made the led 'breath' rather similarly with fade() , basically a rudimentary pwm.
to run the whetstone benchmark, press 'w' in the serial terminal
install:
- press both reset and boot0
- release reset - hold boot0
a recent dfu-util is needed http://dfu-util.sourceforge.net/
or in windows one can use stm32cubeprogrammer
https://github.com/stm32duino/wiki/wiki ... programmer
i think the HSE crystal runs at 25mhz, and led is at pc13 (similar to blue pill)
it may possibly be possible to use the bin on a different F4xx board, but it may not work if HSE crystal runs at different freq (usb won't work).
it may work on the F411 black pill though, assuming that the vendor simply swap F401 or F411 with everything else remain the same
Beginning Whetstone benchmark at 84 MHz ... -Os
Loops:10000, Iterations:1, Duration:11666.40 millisec
C Converted Single Precision Whetstones:85.72 Mflops
Beginning Whetstone benchmark at 84 MHz ... -O3
Loops:10000, Iterations:1, Duration:4599.50 millisec
C Converted Single Precision Whetstones:217.41 Mflops
i've been wondering if the 2nd run is a mistake, so i run it again, i got the same answer

the blink sketch looks like this,
Code: Select all
#include <Arduino.h>
#include <math.h>
#include "whetstone.h"
void cosfade();
#define PER 20
#define REP 10
int8_t led = 0;
bool dir = false;
int8_t n = PER;
int cnt = 0;
void setup() {
// put your setup code here, to run once:
pinMode(LED_BUILTIN,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
char r;
if(Serial.available()) {
r = Serial.read();
if(r=='w')
whetstone(84); //84mhz
}
cosfade();
}
uint8_t p = 0;
void cosfade() {
digitalWrite(LED_BUILTIN,led);
led = ~led & 1;
if(led)
delay(PER-p);
else
delay(p);
if(cnt>REP) {
float nf, perf;
n = n>PER?0:n+1;
nf = n * 1.0;
perf = PER * 1.0;
p = perf * ( cos(2 * PI * nf/perf) / 2.0 + 0.5 );
cnt=0;
} else
cnt++;
}
void blinks() {
for (int i = 0; i < 5; i++) {
digitalWrite(LED_BUILTIN, HIGH);
delay(100);
digitalWrite(LED_BUILTIN, LOW);
delay(100);
}
}
otherwise it is -O3 that cheats a little

https://github.com/stevstrong/Arduino_S ... /whetstone
btw the vendor installed a 'breathing' led blinky, so in this sketch, i made the led 'breath' rather similarly with fade() , basically a rudimentary pwm.
to run the whetstone benchmark, press 'w' in the serial terminal
install:
- press both reset and boot0
- release reset - hold boot0
Code: Select all
dfu-util -a 0 -s 0x8000000 -D whetblinky.bin
or in windows one can use stm32cubeprogrammer
https://github.com/stm32duino/wiki/wiki ... programmer
i think the HSE crystal runs at 25mhz, and led is at pc13 (similar to blue pill)
it may possibly be possible to use the bin on a different F4xx board, but it may not work if HSE crystal runs at different freq (usb won't work).
it may work on the F411 black pill though, assuming that the vendor simply swap F401 or F411 with everything else remain the same
- Attachments
-
- whetblinky.zip
- the whetstone blinky in a zip file
- (24.92 KiB) Downloaded 936 times
Re: Bluepill F4 board, anyone still working on it? - overclock!
overclocking my F401
i got a little too curious and messed with the clock settings
.arduino15/packages/STM32/hardware/stm32/1.8.0/variants/PILL_F401XX/variant.cpp
rebuild & run whetstone blinky
Beginning Whetstone benchmark at 96 MHz ... -O3
Loops:10000, Iterations:1, Duration:4072.66 millisec
C Converted Single Precision Whetstones:245.54 Mflops

i got a little too curious and messed with the clock settings
.arduino15/packages/STM32/hardware/stm32/1.8.0/variants/PILL_F401XX/variant.cpp
Code: Select all
WEAK void SystemClock_Config(void)
{
...
// 84 Mhz
// RCC_OscInitStruct.PLL.PLLM = 25;
// RCC_OscInitStruct.PLL.PLLN = 336;
// RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV4;
// RCC_OscInitStruct.PLL.PLLQ = 7;
// 96 Mhz
RCC_OscInitStruct.PLL.PLLM = 25;
RCC_OscInitStruct.PLL.PLLN = 192;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
RCC_OscInitStruct.PLL.PLLQ = 4;
Beginning Whetstone benchmark at 96 MHz ... -O3
Loops:10000, Iterations:1, Duration:4072.66 millisec
C Converted Single Precision Whetstones:245.54 Mflops

- Attachments
-
- whetblinkyoc.zip
- (24.93 KiB) Downloaded 833 times
Re: Bluepill F4 board, anyone still working on it?
I might be confused here , but does Official Core mean ST core ?ag123 wrote: Thu Jan 02, 2020 5:43 pm just like to say the f401 black pill works 'out of the box' in stm32duino official core
/Bingo
Re: Bluepill F4 board, anyone still working on it?
yup ST's core
https://github.com/stm32duino/Arduino_Core_STM32
try it with the Arduino IDE
https://github.com/stm32duino/wiki/wiki/Getting-Started
when you install STM's core using the board manager, it install its own arm-none-c++ compiler as well.
it seemed that compiler does more optimizations vs the compiler distributed from arm. and this seemed reflected in the MFlops
(btw those 'Mflops' may be 'too aggressive', it is known that if you use -O3, gcc could do optimizations like remove codes that 'does nothing'.
so it figured that the whetstone benchmark 'does nothing', and maybe the optimizations simply run the loops and skip all those 'unnecessary' calcs)

as well as with VSCode + arduino extension
viewtopic.php?f=18&t=69
accordingly fpiSTM is using VSCode as well
it is less than straight forward when i tried to get it working in VSCode + arduino extension in linux
but after things are setup, configs and all works pretty well
and with VS Code, you get code / symbol reference jumps (e.g. drill down into functions, reference jumps to definitions, structures etc)
it is a more 'professional' setup vs the plain vanilla Arduino IDE
you can try the binaries i build for the f401 black pill on the f411 attached above
my guess is chances are that it is 'compatible' with f411 as f401 seemed to be a subset of f411
if that is true you can use the f401 blackpill variant as a starting point if there isn't a f411 black pill variant
Re: Bluepill F4 board, anyone still working on it?
Seems like the 411 runs the 401 code ok
Did have to dig out an USB-C adapter in order to connect to the 411' USB.
Hadn't even noticed that it was USBC , before now
/Bingo
Code: Select all
$ dfu-util -a 0 -s 0x8000000 -D blackpill_f401o3.bin
dfu-util 0.9
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 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: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
Opening DFU capable USB device...
ID 0483:df11
Run-time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuERROR, status = 10
dfuERROR, clearing status
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 2048
DfuSe interface name: "Internal Flash "
Downloading to address = 0x08000000, size = 39880
Download [=========================] 100% 39880 bytes
Download done.
File downloaded successfully
Beginning Whetstone benchmark at 84 MHz ...
Loops:10000, Iterations:1, Duration:8380.95 millisec
C Converted Single Precision Whetstones:119.32 Mflops
Code: Select all
dfu-util -a 0 -s 0x8000000 -D whetblinky.bin
dfu-util 0.9
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 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: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
Opening DFU capable USB device...
ID 0483:df11
Run-time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuERROR, status = 10
dfuERROR, clearing status
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 2048
DfuSe interface name: "Internal Flash "
Downloading to address = 0x08000000, size = 36808
Download [=========================] 100% 36808 bytes
Download done.
File downloaded successfully
Beginning Whetstone benchmark at 84 MHz ...
Loops:10000, Iterations:1, Duration:4654.92 millisec
C Converted Single Precision Whetstones:214.83 Mflops
Code: Select all
$ dfu-util -a 0 -s 0x8000000 -D whetblinkyoc.bin
dfu-util 0.9
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 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: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
Opening DFU capable USB device...
ID 0483:df11
Run-time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuERROR, status = 10
dfuERROR, clearing status
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 2048
DfuSe interface name: "Internal Flash "
Downloading to address = 0x08000000, size = 36808
Download [=========================] 100% 36808 bytes
Download done.
File downloaded successfully
Shows up as ttyACM3 hereBeginning Whetstone benchmark at 84 MHz ...
Loops:10000, Iterations:1, Duration:4072.66 millisec
C Converted Single Precision Whetstones:245.54 Mflops
Did have to dig out an USB-C adapter in order to connect to the 411' USB.
Hadn't even noticed that it was USBC , before now
/Bingo