Bluepill F4 board, anyone still working on it?

If you made your own board, post here, unless you built a Maple or Maple mini clone etc
User avatar
Pito
Posts: 86
Joined: Tue Dec 24, 2019 1:53 pm

Re: Bluepill F4 board, anyone still working on it?

Post by Pito »

PB11 is not available on the board, it seems.
Attachments
PB11 not available on 401_411.PNG
PB11 not available on 401_411.PNG (39.51 KiB) Viewed 2163 times
Pukao Hats Cleaning Services Ltd.

ag123
Posts: 475
Joined: Thu Dec 19, 2019 5:30 am
Answers: 1

Re: Bluepill F4 board, anyone still working on it?

Post by ag123 »

Bingo600 wrote:
Wed Jan 01, 2020 9:31 am
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 :D
Happy new year.

Does usb-serial , bootloader & upload work too ?

I'll have to try (on the 11') when i get back home

/Bingo
i've only done stevstrong's libmaple so i'd comment only on libmaple, usb-serial works,
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
you need a recent version of dfu-util
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'
:lol:
Last edited by ag123 on Wed Jan 01, 2020 2:26 pm, edited 2 times in total.

ag123
Posts: 475
Joined: Thu Dec 19, 2019 5:30 am
Answers: 1

Re: Bluepill F4 board, anyone still working on it?

Post by ag123 »

Pito wrote:
Wed Jan 01, 2020 10:25 am
PB11 is not available on the board, it seems.
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
:lol:

User avatar
Pito
Posts: 86
Joined: Tue Dec 24, 2019 1:53 pm

Re: Bluepill F4 board, anyone still working on it?

Post by Pito »

8pin SPI FRAM would be a better option there, imo.
Pukao Hats Cleaning Services Ltd.


ag123
Posts: 475
Joined: Thu Dec 19, 2019 5:30 am
Answers: 1

Re: Bluepill F4 board, anyone still working on it?

Post by ag123 »

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 :lol:

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);
	}
}
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 :lol:
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
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
Attachments
whetblinky.zip
the whetstone blinky in a zip file
(24.92 KiB) Downloaded 85 times

ag123
Posts: 475
Joined: Thu Dec 19, 2019 5:30 am
Answers: 1

Re: Bluepill F4 board, anyone still working on it? - overclock!

Post by ag123 »

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

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;
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
:lol:
Attachments
whetblinkyoc.zip
(24.93 KiB) Downloaded 66 times

Bingo600
Posts: 82
Joined: Sat Dec 21, 2019 3:56 pm

Re: Bluepill F4 board, anyone still working on it?

Post by Bingo600 »

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
I might be confused here , but does Official Core mean ST core ?

/Bingo

ag123
Posts: 475
Joined: Thu Dec 19, 2019 5:30 am
Answers: 1

Re: Bluepill F4 board, anyone still working on it?

Post by ag123 »

Bingo600 wrote:
Sun Jan 05, 2020 9:38 am
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
I might be confused here , but does Official Core mean ST core ?

/Bingo
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)
:lol:

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

Bingo600
Posts: 82
Joined: Sat Dec 21, 2019 3:56 pm

Re: Bluepill F4 board, anyone still working on it?

Post by Bingo600 »

Seems like the 411 runs the 401 code ok


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
Beginning Whetstone benchmark at 84 MHz ...

Loops:10000, Iterations:1, Duration:4072.66 millisec
C Converted Single Precision Whetstones:245.54 Mflops
Shows up as ttyACM3 here

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

Post Reply

Return to “Custom design boards”