[libmaple] Black F407VET6

Limited support for STM32F4 Discovery, Nucleo and custom F4 boards
Post Reply
stevestrong
Posts: 1747
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

[libmaple] Black F407VET6

Post by stevestrong » Wed Apr 12, 2017 4:37 pm

The master branch of my repo contains the latest developments for F4, so I recommend to use this if somebody wants to test it with Arduino IDE or PlatformIO.
Supported board variants: generic F4 (tested), disco F407 (compiles but not tested).

Some basic information about the board can be found on wiki: http://wiki.stm32duino.com/index.php?title=STM32F407

Currently working:
- GPIOs + LED toggle
- USB serial and serial 1,2,3
- SPI (1,2,3) with DMA (also for SD cards using latest SdFat lib made by Greiman)
- FSMC (adapted for driving 16 bit parallel LCDs) http://stm32duino.com/viewtopic.php?f=39&t=2298#p31037
- SDIO [non-HAL implementation] (for SD cards using latest SdFat lib made by Greiman) http://stm32duino.com/viewtopic.php?f=39&t=2215
- RTC - reworked, does not need any extra time library
- supports W5500-based Ethernet modules (see viewtopic.php?f=13&t=503&p=32063#p32063)

Todo:
- check analogRead()
- check the on-board W25Q64 SPI flash, maybe add SPIflash lib to repo (where from?) https://github.com/LowPowerLab/SPIFlash
- check/add FPU (http://stm32duino.com/viewtopic.php?f=39&t=2001, http://stm32duino.com/viewtopic.php?f=3 ... 048#p31040)
- add support for Seed Arch Max board
- add Ethernet lib (usable with Seeed Arch Max board)
- evaluate USB serial speed.

EDIT - 2017.07.10
- RTC lib reworked to be independent from other time libraries. Includes an example sketch to read and set the RTC time, as well as how to use the time elements.
It can be downloaded from here: viewtopic.php?f=39&t=775&p=31218#p31218

EDIT - 2017.06.18
- Implemented SDIO [non-HAL implementation] (for SD cards using latest SdFat lib made by Greiman)
viewtopic.php?f=39&t=2215

EDIT - 2017.06.02

Upload under windows currently only possible with STLink (V2).
When BOOT0="1"(3.3V) and BOOT1="0"(GND), the chip is recognized by Win10 as 'STM Device in DFU mode' (USB\VID_0483&PID_DF11).
However, there is no working DFU loader for Windows available, yet.

Comments & suggestions are welcome in this thread.
Any bug reports & PRs in Github, please.

-------------------------------------------------------------------------------------
Hi all,

I know there is another thread on vet6 & zet6 boards, but there are at least 2 type of boards mixed, with partially different information.
And there is a lot of other information spread over other threads, like this generic implementation from danieleff.
Wiki has some basic stuff, too (thanks, Palmer!).

So, I got my black board today and I though it makes sense to open a separate thread only for the black VET6 board. The title can be edited later if needed, and the useful and tested information can (should) be added to wiki.

First of all, this is the current situation:
Both LEDs blink, but the USB device descriptor failed (VID 0x000 PID 0x0002).
On the serial port (115200Baud, 8N1) I receive after each reset: "LCD ID:ffff"
I can connect with the ST-Link probe, and I could read out the flash (I can attach here or to wiki if wanted). I assume writing would be also possible.

Now would like to start with the sw development.
The question is: how?

I know, there are a lot of alternative options (the official STM32 core, Start Otto github, Koduino, and so on).
But honestly, I like very much the existing Arduino_STM32 repo and I would like to use this for my future work.
I also know, it will be a hard way to go. But I think, with small steps I (we?) can achieve great results.

So, will the Arduino_STM32 provide the basic structure and functionality for a blinky example?
If anyone tried that already and had success, I would appreciate a short description of what and how to do.

For the beginning I intend to use the STlink upload method as the USB DFU seems not (yet?) to work.
Is there any working bootloader available for this board?
Last edited by stevestrong on Sat Jul 29, 2017 9:45 am, edited 37 times in total.

danieleff
Posts: 336
Joined: Thu Sep 01, 2016 8:52 pm
Location: Hungary
Contact:

Re: Black F4VET6 - startup

Post by danieleff » Wed Apr 12, 2017 5:30 pm

The discovery_f407 variant in the Arduino_STM32 / STM32F4 can actually blink the black F407VET on PA6 using ST Link, so I guess its a good start?

victor_pv
Posts: 1681
Joined: Mon Apr 27, 2015 12:12 pm

Re: Black F4VET6 - startup

Post by victor_pv » Wed Apr 12, 2017 5:35 pm

Steve, the core is compatible with the F4, the problem is that the compatible part was based of libmaple several years ago and has not been brought up to the latest arduino API.
I have an F407 board and the led blink example works fine.
Most of the libmaple libraries are adapted. You may need to update things like stream and others. I would think a good start would be to run a diff between the F1 and the F4 cores to see what may be completely missing from the F4 side.

The SPI library files were copied from the F1 some time ago after we added the dmaSend and dmaTransfer functions, but those should not work in the F4 because the DMA controller is different, but we could rewrite those for both the F1 and F4 using the dmatubes leaflabs added to libmaple, because that API works on both F1 and F4.

Those are the things that come off my head about the F4 core.

ag123
Posts: 770
Joined: Thu Jul 21, 2016 4:24 pm

Re: Black F4VET6 - startup

Post by ag123 » Wed Apr 12, 2017 6:11 pm

another thing though, i'm not too certain if we could bundle and distribute those ST cube-mx HAL and standard peripheral libs sources as part of stm32_duino set of sources. but i do see them bundled e.g. with gnu arm eclipse etc

i'm finding that danieleff's stm32generic duino implementation that's based on hal make sense, in particular as F4 is less resource constrained vs F1 codes compiled for f4 can easilly be re-compiled say for f1, f2, f3, f4, f7, l4 etc (just that on the more resource constrained f1 / f0 etc, the binaries may turn out to be 'fat' and eats more sram - could be a key difference for memory hungry sketches)
http://www.stm32duino.com/viewtopic.php?f=42&t=1966

some of the codes and initializers are apparently common, however, i think when we start to dig deeper into the 'other peripherals' e.g. USB, SPI, I2C, DMA etc, things may start to diverge, but i'd think ST has them catered in the hal

in a way in stm32duino we are sort of creating a 'custom hal', and arduino sketches connects through the stm32duino arduino / maple api

or perhaps we should after all have alternatives

User avatar
Pito
Posts: 1593
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

Re: Black F407VET6 - startup

Post by Pito » Wed Apr 12, 2017 6:56 pm

I took my Black 407ZET6, set F4Discovery in Arduino IDE, and it compiled blink with two leds at PF9 and PF10 fine.
My Jlink connected to the 20pin Jtag header, Jflash flashed (SWD) the .bin ok (from 0x08000000).
And it blinks with 2 leds ok.
Added Serial.println() (uart1 at pins PA9, PA10), ok.

Code: Select all

Hello World from F407!
Hello World from F407!
Hello World from F407!
Whetstone

Code: Select all

Loops: 1000Iterations: 1Duration: 6251 millisec.
C Converted Double Precision Whetstones: 16.00 MIPS
And Dhrystone

Code: Select all

Dhrystone Benchmark, Version 2.1 (Language: C)
Execution starts, 3000000 runs through Dhrystone

Execution ends
Microseconds for one run through Dhrystone: 3.58
Dhrystones per Second: 279445.78
VAX MIPS rating = 159.05
So it should work with VET6 the same way..
Last edited by Pito on Wed Apr 12, 2017 7:44 pm, edited 2 times in total.
Pukao Hats Cleaning Services Ltd.

ag123
Posts: 770
Joined: Thu Jul 21, 2016 4:24 pm

Re: Black F407VET6 - startup

Post by ag123 » Wed Apr 12, 2017 7:33 pm

oh that whetstone benchmark should be a hardware fpu benchmark, 16 double precision mflops! did you set float ABI as FP instructions hard, fpv4-sp-d16? :D
Last edited by ag123 on Wed Apr 12, 2017 7:43 pm, edited 2 times in total.

User avatar
Pito
Posts: 1593
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

Re: Black F407VET6 - startup

Post by Pito » Wed Apr 12, 2017 7:41 pm

I did nothing, just pushed the button :)
This one:
Compile.JPG
Compile.JPG (8.05 KiB) Viewed 1319 times
Pukao Hats Cleaning Services Ltd.

ag123
Posts: 770
Joined: Thu Jul 21, 2016 4:24 pm

Re: Black F407VET6 - startup

Post by ag123 » Wed Apr 12, 2017 7:43 pm

i see :D
ok i dug up the benchmark thread
http://www.stm32duino.com/viewtopic.php?t=76

some of the old records seemed to be:
Kenjutsu wrote:Just for interest sake, here are some Whetstone benchmark results for my Nucleo F411RE and Blue Pill board:

Code: Select all

// mbed online - F411RE
// Loops: 1000, Iterations: 1, Duration: 25 sec.
// C Converted Double Precision Whetstones: 4.0 MIPS

// gcc4mbed - F411RE
// Loops: 1000, Iterations: 1, Duration: 17 sec.
// C Converted Double Precision Whetstones: 5.9 MIPS

// gcc4mbed - F103RE (Blue Pill)
// Loops: 1000, Iterations: 1, Duration: 34 sec.
// C Converted Double Precision Whetstones: 2.9 MIPS

// STM32duino Blue Pill
// Loops: 1000 Iterations: 1 Duration: 19838 millisec.
// C Converted Double Precision Whetstones: 5.04 MIPS

User avatar
Pito
Posts: 1593
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

Re: Black F407VET6 - startup

Post by Pito » Wed Apr 12, 2017 8:11 pm

And for big and fast CPUs here is the big math :) :

Code: Select all

Black F407 Math Test by Pito 4/2017
x= 3444444444445555555555666666.6666677777777788888889
y= -56666666666677777777777788.888888888111111111112222

z=x+y= 3387777777778877777777888877.7777788896666677777767
3.387777777778878e+27
elapsed: 20 us

z=x-y= 3501111111112233333333444455.5555566658888900000011
3.501111111112233e+27
elapsed: 15 us

z=x*y= -1.9518518518528641975309276666666672819753092717704E+53
-1.951851851852864e+53
elapsed: 46 us

z=x/y= -60.784313725497885428683223790246606967299291272272
-6.078431372549789e+01
elapsed: 162 us

z=cos(0.7)= 0.76484218728448842625585999019186490926821055037373
7.648421872844884e-01
elapsed: 3843 us
Pukao Hats Cleaning Services Ltd.

stevestrong
Posts: 1747
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: Black F407VET6 - startup

Post by stevestrong » Wed Apr 12, 2017 8:24 pm

Guys, please, my intension was the startup, not the benchmark.
I didnt even mange to flash a blinky...
This thread should clarify startup issues, not the exponential part of a floating point value.
I will try to set the Arduino board to the only one available F4 board and then see if it works on the black F4.

Post Reply