Spark Logic

[libmaple] Black F407VET6

stevestrong

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), generic F4 mini (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. Evaluated USB serial speed, Tx: ~800kBps
– SPI (1,2,3) with DMA (also for SD cards using latest SdFat lib made by Greiman), extended DMA functions
– 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
– I2C (Wire) viewtopic.php?f=39&t=2804&p=37376#p37376
– supports W5500-based Ethernet modules (see viewtopic.php?f=13&t=503&p=32063#p32063)
– DAC, see viewtopic.php?f=39&t=1976&p=41564#p41564
– ADC, see http://stm32duino.com/viewtopic.php?f=3 … 720#p42720
– DCMI, see viewtopic.php?f=39&t=3414&p=43358#p43358
– CAN, see: http://stm32duino.com/viewtopic.php?f=3 … 239#p49235

Todo:
– port the new (faster) version of SDIO from Victor (https://github.com/rogerclarkmelbourne/ … 2/pull/474)
– 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)

EDIT – 2018.10.02
– added extended SPI DMA functions, see: viewtopic.php?f=15&t=3415

EDIT – 2018.09.12
– working CAN, see: http://stm32duino.com/viewtopic.php?f=3 … 239#p49235 (thanks to @michael_i!)

EDIT – 2018.03.19
– tested ADC, see: http://stm32duino.com/viewtopic.php?f=3 … 720#p42720

EDIT – 2018.02.18
– tested DAC, see: viewtopic.php?f=39&t=1976&p=41564#p41564

EDIT – 2018.01.16
– Added I2C (Wire), see: viewtopic.php?f=39&t=2804&p=37376#p37376

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?

Replies20

madias Wed Apr 25, 2018 10:18 pm

Ok, I used the graphictest_STM32, now I used the graphictest.ino with
#define TFT_CS PA1
#define TFT_DC PA2
#define TFT_RST PA3

robca Mon May 14, 2018 10:57 pm

I feel stupid…

Update: all I needed to do, was to use this path instead: C:\arduino-1.8.5\portable\packages\stm32duino\hardware\STM32F4\2018.5.11, like the F1 boards cores


I’m trying to get a generic F4 board like this to work https://www.ebay.com/itm/STM32F4Discove … 2366085094

I installed a new copy of Arduino 1.8.5, installed the SAM board package, then added http://dan.drown.org/stm32duino/package … index.json to preferences and installed the F1 boards.

I was told that https://github.com/stevstrong/Arduino_STM32/ is the best core to use for my board, so I downloaded the ZIP file of that project, then copied just the STM32F4 folder under C:\arduino-1.8.5\portable\packages\stm32duino\hardware\STM32F4, as I did in the past pre-boards manager (at the time, I copied both STM32F1 and other cores manually from the ZIP file). And I’m using a portable Arduino installation, hence the path

Now under boards I see the Yun and the F1 boards, but none of the F4 boards. What am I missing? Do I need to edit some file to have Arduino recognize the STM32F4 directory as a valid one?

robca Tue May 15, 2018 12:19 am

One more question, sorry

Still trying to get my F4 board to work. I successfully compiled Blink and uploaded it to my board (https://www.ebay.com/itm/STM32F4Discove … 2366085094) using STLink. everything works well

I now wanted to use the USB port, so I set “USB Serial (CDC)”, and STM32duino bootloader, but it always fails with:

C:\arduino-1.8.5\portable\packages\stm32duino\tools\stm32tools\2018.5.11/win/maple_upload.bat COM16 2 1EAF:0003 C:\Users\Roberto\AppData\Local\Temp\arduino_build_80506/BlinkF4.ino.bin {upload.dfuse_addr}
java.lang.UnsupportedClassVersionError: CliTemplate/CliMain : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: CliTemplate.CliMain. Program will exit.
Exception in thread "main"

RogerClark Tue May 15, 2018 12:31 am

Bootloader upload only works on the F1, we don’t have a bootloader for the F4 as its a completely different MCU

So F4 uploads are only via STLink

I don’t know how you are attempting to do a bootloader upload to the F4 unless you are doing it manually, as its not an option in the menu in the IDE precisely because its not possible

robca Tue May 15, 2018 2:22 am

[RogerClark – Tue May 15, 2018 12:31 am] –
Bootloader upload only works on the F1, we don’t have a bootloader for the F4 as its a completely different MCU

So F4 uploads are only via STLink

I don’t know how you are attempting to do a bootloader upload to the F4 unless you are doing it manually, as its not an option in the menu in the IDE precisely because its not possible

Got it, thanks. I guess I got confused by this viewtopic.php?t=1215 and assumed that it was somehow possible to flash via USB using DFuse… Definitely can use STlink, usb would just be more convenient given how my board is setup (and not sure how I got the IDE option, I must have messed things up playing with the configuration)

I also thought there was ongoing work on a DFuse option viewtopic.php?f=3&t=2508

So, USB on F4 can only be used as USBSerial, right?

RogerClark Tue May 15, 2018 5:43 am

F4 internal bootloader is DFUSe

but this doesn’t use the same drivers as the F1 DFU or the same version of DFU Util

You need the driver and the version of DFU which supports DFUSe (STM’s own extensions)

I think a few people have tried to use it, but if you have STLink that will be far easier

robca Tue May 15, 2018 10:56 pm

Yeah, it makes sense. DFuse would also require moving boot jumpers, so not as good as I originally thought

Do you know if an STLink flashed with Black Magic Probe can be used to flash like an STLink from the Arduino IDE? I only have one STLink (another on the way from China), and don’t want to flash it until I’m sure. Would be nice to be able to use a single dongle to program, debug and receive serial communication

Otherwise I’ll use 2 STLinks, one with the original firmware to flash, another with BMP to debug (and, yes, I know I can use OpenOCD with STLink, but BMP seems to offer much more with native GDB). Or I might jump to Eclipse with CDT Arduino, which I think allows the use of BMP to flash

RogerClark Wed May 16, 2018 12:01 am

I think there is a version of the BMP thats built to run on the STLink dongles (using their pinout), however you should look on the Blacksphere github repo or their gitter forum etc to find out who wrote it and where to download it from or how to build it.

ag123 Sat May 19, 2018 6:44 pm

[robca – Tue May 15, 2018 12:19 am] –
One more question, sorry

Still trying to get my F4 board to work. I successfully compiled Blink and uploaded it to my board (https://www.ebay.com/itm/STM32F4Discove … 2366085094) using STLink. everything works well

I now wanted to use the USB port, so I set “USB Serial (CDC)”, and STM32duino bootloader, but it always fails with:

C:\arduino-1.8.5\portable\packages\stm32duino\tools\stm32tools\2018.5.11/win/maple_upload.bat COM16 2 1EAF:0003 C:\Users\Roberto\AppData\Local\Temp\arduino_build_80506/BlinkF4.ino.bin {upload.dfuse_addr}
java.lang.UnsupportedClassVersionError: CliTemplate/CliMain : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: CliTemplate.CliMain. Program will exit.
Exception in thread "main"

pokemon99 Thu May 24, 2018 12:47 pm

Hi, I tried the given card and the Backup register does not work for me. I try

bkp_enable_writes ();
bkp_write (5, 0x5);
bkp_disable_writes ();
bkp_read (5) returns 0.

Any register returns 0

stevestrong Thu May 24, 2018 1:19 pm

The functions you mentioned are not supposed to work for F4, the backup resisters are not mapped correctly.

pokemon99 Thu May 24, 2018 1:29 pm

I saw this in a comment, but for F4 in the commentary is not specified
/**
* @file libmaple/include/libmaple/bkp.h
* @brief Backup register support (STM32F1 only).
*/
from F4
/**
* @file bkp.h
* @brief Backup register support.
*/
is there another function that allows you to use these registers?

stevestrong Thu May 24, 2018 1:33 pm

Not that I know.

But you are welcome to make a pull request which solves your issue.

pokemon99 Mon Jun 25, 2018 5:52 am

Thanks!

michael_l Thu Aug 30, 2018 8:29 am

Any chance you could add a new variant: Blue STM32407VET6 board with 25Mhz clock ? I could also try to figure it out myself, however I’m not sure what changes and where are needed. I can test it

stevestrong Thu Aug 30, 2018 10:35 am

The generic_f407v_mini variant uses already 25MHz xtal frequency, check the boards.txt file.

michael_l Thu Aug 30, 2018 10:59 am

Awesome, thanks! I’ll try it.

Another question about CAN driver. Any chance that could be integrated (based on work of others in this forum for STM32F103) into F4 ? I’d be happy to give that a try but I need some guidance on how to approach it and I can test that also.

I guess the first interesting question is that can CAN hardware in F4 (one is enough for me) work together with USB serial ?

stevestrong Thu Aug 30, 2018 3:06 pm

I could not find any restriction in F4 manuals regarding simultaneous use of USB and CAN.

However, I never worked with CAN, and have no HW to test, so you are on your own with that, sorry.

michael_l Tue Sep 04, 2018 5:07 pm

[stevestrong – Thu Aug 30, 2018 3:06 pm] –
I could not find any restriction in F4 manuals regarding simultaneous use of USB and CAN.

However, I never worked with CAN, and have no HW to test, so you are on your own with that, sorry.

Ok, thanks for the information. I’ll give it a shot in near future !

Post a reply