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

stevestrong Sun Mar 25, 2018 4:51 pm

[da_user – Sun Mar 25, 2018 3:45 pm] –
But there is no \core\libmaple\ directory. VM Search in the wrong dir or put the file in the wrong dir.

Well, please check this by yourself, sorry but I cannot help you with VM, I have no experience at all.
I know that in Eclipse you have to check the directory settings of the project and adjust it to be identical as handled by Arduino IDE.

da_user Sun Mar 25, 2018 5:48 pm

Well, please check this by yourself, sorry but I cannot help you with VM, I have no experience at all.

No Problem. You helped a lot!
You say mostly the problems are options of platform.txt and boards.txt? Well, STM32_Generic runs, maybe i found the correct difference. And i will ask in the Forum of VM.
And last exit: testing Visual Studio Code ;-)

Again: thank you for your help!

stevestrong Sun Mar 25, 2018 5:54 pm

[da_user – Sun Mar 25, 2018 5:48 pm] –
You say mostly the problems are options of platform.txt and boards.txt?

Nope. They are the solution ;)

da_user Fri Mar 30, 2018 4:12 pm

[stevestrong – Sun Mar 25, 2018 5:54 pm] –
Nope. They are the solution ;)

Yes, they are!
VM can’t help: http://www.visualmicro.com/forums/YaBB. … 1522079538

But i have looked at my own. I have changed Arduino_STM32\STM32F4\plattform.txt Line 78 to:
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -mcpu={build.mcu} "-T{build.variant.path}/{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" "-L{build.path}" -lm -lgcc -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols -Wl,--start-group "{build.path}/core/syscalls.c.o" {object_files} "{archive_file_path}" -Wl,--end-group

madias Tue Apr 24, 2018 9:21 pm

Ok, my Black F407VET6 arrived so I can also play with it:
I use the Steve core (downloaded 18-04-24)
My first attempt is a conversation of “our” ILI9341 F1 library:
First error was – more or less – easy:
C:\Users\Administrator\Documents\Arduino\hardware\Arduino_STM32_18_03_06\STM32F4\libraries\Adafruit_ILI9341_STM\Adafruit_ILI9341_STM.cpp:69:13: error: invalid conversion from 'volatile uint32* {aka volatile unsigned int*}' to 'volatile uint32_t* {aka volatile long unsigned int*}' [-fpermissive] csport = portSetRegister(_cs);

stevestrong Tue Apr 24, 2018 9:28 pm

Use SPI_DATA_SIZE_8BIT

madias Tue Apr 24, 2018 9:35 pm

[stevestrong – Tue Apr 24, 2018 9:28 pm] –
Use SPI_DATA_SIZE_8BIT

Thanks Steve!
As we say in German “Den Wald vor lauter Bäumen nicht mehr sehen” (something like “to miss the forest for the trees”)…compiling is now ok (with warnings) Results will follow!

madias Tue Apr 24, 2018 10:07 pm

Just for the records:
First test is negative.
No screen output and hangs up somewhere (just a quick Serial debug test).
I need to dig further. Maybe the library is too much STM32F1 optimized, maybe I roll back to an earlier version without the whole DMA stuff until I found the critical code.

RogerClark Tue Apr 24, 2018 10:22 pm

Mathias

I think it is good that there is the same phrase in different countries

It’s something like

“I could not see the wood, for the trees”

Meaning I could not see the wood because of the trees obscuring it.

Same as in German ;-)

madias Wed Apr 25, 2018 6:57 am

Core: Steve’s F4 libmaple
Ok, some further progress:
The “old” library works.
One problem I found: The SPI pins definitions are on alternate pins

So for SPI1:
SCK1 and MOSI1 is on: PA5 and PA7 and ALSO
(alternate) PB3, PB5

found it out in generic_f407v.h

#define BOARD_NR_SPI 3
#define BOARD_SPI1_NSS_PIN PA4
#define BOARD_SPI1_SCK_PIN PA5
#define BOARD_SPI1_MISO_PIN PA6
#define BOARD_SPI1_MOSI_PIN PA7
#define BOARD_SPI1A_NSS_PIN PA15
#define BOARD_SPI1A_SCK_PIN PB3
#define BOARD_SPI1A_MISO_PIN PB4
#define BOARD_SPI1A_MOSI_PIN PB5

madias Wed Apr 25, 2018 8:32 am

Strange thing (for further research):
disabling
//#define SPI1_ALTERNATE_CONFIG 1 // use alternate SPI1 on SPI3 pins

stevestrong Wed Apr 25, 2018 8:35 am

Matthias, I was able to use ILI9341 on that board when I tested the DCMI, together with OV7670 camera.
I did that define in SPI.h because I needed 42MHz SPI clock on PB3 to achieve ~26fps, see my project attached here: http://stm32duino.com/viewtopic.php?f=39&t=3414#p43358, and at least one of PA5-7 is reserved for DCMI.
Do you test the graphicstest sketch?

madias Wed Apr 25, 2018 8:38 am

Steve: Exactly, I use the graphic test.
Working on the (little modified) “old” library (#include “Adafruit_ILI9341.h”) works without problem on the alternate SPI pins, but not on standard SPI1

The new DMA library crashes after drawing some white blocks

stevestrong Wed Apr 25, 2018 8:41 am

Are you really sure that it is the DMA which crashes?
Please test the ILI9341 lib from the link above.
Meanwhile I will double-check the graphic test.

madias Wed Apr 25, 2018 9:24 am

Steve I’ll check it tonight with your library! Really strange thing is more that the standard SPI1 port without alternate is not working . tested wirh a SPI basic code.

stevestrong Wed Apr 25, 2018 9:31 am

Be aware that the default SPI instance declared in SPI.cpp is SPI(3) (because of those connectors to some extra boards).
So SPI.write() will try to write on SPI3.

madias Wed Apr 25, 2018 6:27 pm

[stevestrong – Wed Apr 25, 2018 8:41 am] –
Are you really sure that it is the DMA which crashes?
Please test the ILI9341 lib from the link above.
Meanwhile I will double-check the graphic test.

Steve: Even with your library the same symptoms: crashes after a while (same config as with the standard non DMA library)

madias Wed Apr 25, 2018 8:46 pm

Ok, some updates!
Even without owning a OV7670 I tried out your code and the screen is working.
So there must be a problem with some functions within the ILI9341 library getting the MCU to crash. I’ll try out the basic functions to define the problem.
Edit updates:
I lowered the frequency (both, safe and freq) to 1200000, also using the shortest jumper cables I own, took another ILI9341 display, but no changes.
I inserted:
tft.setRotation(1); // rotate 90° for landscape
tft.setAddrWindow(0, 0, screen_h, screen_w);

stevestrong Wed Apr 25, 2018 9:42 pm

I just tested the graphicstest.ino from the attached ILI9341 lib on SPI1 of my black F4 board and it works with my repo.

OK, some pixel groups are displayed wrongly in two of rectangle tests but the most important thing is that it does not hang.

ILI9341 Test!
Display Power Mode: 0x9C
MADCTL Mode: 0x48
Pixel Format: 0x5
Image Format: 0x9C
Self Diagnostic: 0xC0

Read single pixel test
------------------------------
Write pixel: 0x1234
Read pixel: 0x1234

Read multiple pixel test
------------------------------
Write pixels: 0x1234, 0x5678, 0x9012, 0x3456
Benchmark Time (microseconds)
Screen fill 142065
Text 20827
Lines 91022
Horiz/Vert Lines 16827
Rectangles (outline) 12483
Rectangles (filled) 4718
Circles (filled) 66692
Circles (outline) 69433
Triangles (outline) 24135
Triangles (filled) 114242
Rounded rects (outline) 30803
Rounded rects (filled) 341549
Done!

madias Wed Apr 25, 2018 10:13 pm

<OBSOLET>
Strange thing.
I downloaded your repo again, installed the linked ILI-lib blank, same results.
which adafruit_gfx do you use (the one without _AS) – getting some wiring_private missing errors (ok, I disabled the line, cause we don’t need I2C)
Do you select this port from the ide?
“GenericSTM32F407V series” – usb serial (CDC)?
I tested also the “mini” one, but this crashes immediately.
To be sure, I use this board:
https://www.aliexpress.com/item/Free-sh … 84907.html

Sign in to reply