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 Mon Mar 19, 2018 2:49 pm

Short info.

The ADC has been reworked and extended with a library, see this patch, which required to change quite a few files.
The ADC device instances are moved to flash, while the ISR tables are kept in RAM.
This required to change the pin_map table which now contains an index to ADC device instead of its address.
Hope that it did not break anything else … :?

There are 3 examples: multi-channel non-DMA, single channel DMA and multi-channel DMA, both DMA versions using single-buffer (split in two, however) and timer generated acquisition rate.

EDIT
I just realized that dual ADC mode is not covered by any example, I will make an example for that, too.

acronis Tue Mar 20, 2018 12:28 pm

Hello Steve !

I have updated to your last library and the code that I used to work gives such an error
adc_set_sample_rate(&ADC1, ADC_SMPR_1_5);

‘ADC_SMPR_1_5’ was not declared in this scope

if project #include “SdioF4.h”
to error:
C:\Users\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\SPI\src\SPI.cpp:116:28: error: invalid conversion from ‘const dma_dev*’ to ‘dma_dev*’ [-fpermissive]

_settings[0].spiDmaDev = DMA2;

How to fix it ?

stevestrong Tue Mar 20, 2018 2:16 pm

The followings:
– use:
adc_set_sampling_time(ADC1, ADC_SMPR_144); // 1 µs sampling+conversion time

acronis Tue Mar 20, 2018 3:17 pm

This error when connecting “SdioF4.h ” remained

C:\Users\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\SPI\src\SPI.cpp:116:28: error: invalid conversion from ‘const dma_dev*’ to ‘dma_dev*’ [-fpermissive]

_settings[0].spiDmaDev = DMA2;

victor_pv Tue Mar 20, 2018 4:20 pm

[acronis – Tue Mar 20, 2018 3:17 pm] –
This error when connecting “SdioF4.h ” remained

C:\Users\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\SPI\src\SPI.cpp:116:28: error: invalid conversion from ‘const dma_dev*’ to ‘dma_dev*’ [-fpermissive]

_settings[0].spiDmaDev = DMA2;

Try:

_settings[0].spiDmaDev = (dma_dev*)DMA2;

Or actually, shouldn’t line 141 be like this instead?
dma_dev * const spiDmaDev;

stevestrong Tue Mar 20, 2018 4:31 pm

I just checked in a fix for parameter invalid conversion in SPI DMA related functions.

However, the error in SPI.cpp:116:28: should have been fixed by my first suggestion.
I just tested the current repo and got no error now.
Please rebuild the whole project after you pull the latest version.

acronis Tue Mar 20, 2018 11:25 pm

Hi,Steve !

Today updated the library and checked – now the error does not give !
Great!
Thank you!

da_user Fri Mar 23, 2018 9:18 pm

Hi,
i have some Linker-Problems while Compiling with “VisualMicro”. I think it worked some Days ago, but i tryed some other Cores and now i woul’d like to use this, because i need the RTC.

The Compiler-Output, for the “bare minimun” Sketch:
Compiling 'STM32F407_Test' for 'Generic STM32F407V series'

rccF4.c: In function SetupClock72MHz
rccF4.c: 264:3: warning: this 'while' clause does not guard... [-Wmisleading-indentation] while ((RCC->CFGR & (uint32_t)RCC_CFGR_SWS ) != RCC_CFGR_SWS_PLL)
^~~~~
rccF4.c:265: note ...this statement, but the latter is misleadingly indented as if it is guarded by the while

rccF4.c: In function SetupClock120MHz
rccF4.c: 355:3: warning: this 'while' clause does not guard... [-Wmisleading-indentation] while ((RCC->CFGR & (uint32_t)RCC_CFGR_SWS ) != RCC_CFGR_SWS_PLL)
^~~~~
rccF4.c:356: note ...this statement, but the latter is misleadingly indented as if it is guarded by the while

rccF4.c: In function SetupClock168MHz
rccF4.c: 456:3: warning: this 'while' clause does not guard... [-Wmisleading-indentation] while ((RCC->CFGR & (uint32_t)RCC_CFGR_SWS ) != RCC_CFGR_SWS_PLL)
^~~~~
rccF4.c:457: note ...this statement, but the latter is misleadingly indented as if it is guarded by the while

rccF4.c: In function rcc_clk_init2
rccF4.c: 554:5: warning: this 'while' clause does not guard... [-Wmisleading-indentation] while ((RCC->CFGR & RCC_CFGR_SWS ) != RCC_CFGR_SWS_PLL)
^~~~~
rccF4.c:555: note ...this statement, but the latter is misleadingly indented as if it is guarded by the while

arm-none-eabi-g++*: error: C:\Users\user\AppData\Local\Temp\VMBuilds\STM32F407_Test\Arduino_STM32-master_generic_f407v\Debug\core\libmaple\syscalls.c.o: No such file or directory

Error linking for board Generic STM32F407V series
Build failed for project 'STM32F407_Test'

stevestrong Fri Mar 23, 2018 10:33 pm

Problems with other environments than Arduino IDE mostly reduces to options of platform.txt and boards.txt.
Just compare the Arduino build (verbose) messages with that of VM and you will see the difference which will explain the root cause and thus you will get a hint how to solve your problem.

Btw, the warning for [-Wmisleading-indentation] for while()… I think I solved with the latest commit.

acronis Sat Mar 24, 2018 7:09 am

Hi Steve!

I’ve upgraded your library to the latest.

timer.pause();
timer.setPeriod(500);
timer.setChannel1Mode(TIMER_OUTPUT_COMPARE);
timer.setCompare(TIMER_CH1, 1);
timer.attachCompare1Interrupt(timer_interrrupts);
timer.refresh();
timer.resume();

stevestrong Sat Mar 24, 2018 8:31 am

This has to do with the functions marked as deprecated in the original Leaflabs documentation: http://docs.leaflabs.com/static.leaflab … ctionality
I took the step to remove them from my repo.
Sorry if I caused trouble with that.

So please use instead the recommended functions under the given link.
Meaning:
timer.setMode(TIMER_CH1, TIMER_OUTPUT_COMPARE);
timer.attachInterrupt(TIMER_CH1, timer_interrrupts);

acronis Sat Mar 24, 2018 8:57 am

Steve Thank You!

So everything is fine !

acronis Sat Mar 24, 2018 12:42 pm

Steve
Please tell me how to set the parameters config ?
for example SERIAL_8O2

Serial.begin(speed, config)

stevestrong Sat Mar 24, 2018 1:07 pm

Currently you can only use
Serial.begin(baud_rate);

acronis Sat Mar 24, 2018 1:09 pm

Ok.
Thank You

stevestrong Sat Mar 24, 2018 1:39 pm

Till then you could use direct USART functions (check out again my repo):
void usart_set_parity(usart_dev *dev, uint16_t odd); // odd: 0=even, 1=odd
void usart_set_stop_bits(usart_dev *dev, uint16_t stop_bits); // stop_bis: 0=1bit, 1=0.5bits, 2=2bits, 3=1.5bits

acronis Sat Mar 24, 2018 1:51 pm

Steve !
You work incredibly fast !!!
Your great specialist !!!

I thank you for your help !

da_user Sat Mar 24, 2018 10:36 pm

Problems with other environments than Arduino IDE mostly reduces to options of platform.txt and boards.txt.
Just compare the Arduino build (verbose) messages with that of VM and you will see the difference which will explain the root cause and thus you will get a hint how to solve your problem.

Btw, the warning for [-Wmisleading-indentation] for while()… I think I solved with the latest commit.

Hi,
for the notes:
i have downloaded the files yesterday. Today i downloaded them freshly some minutes ago, and the notes are gone!? No Idea.

Also no idea what to do with the verbose Messages :shock:
That of the Arduino IDE is clarly longer than that of VisualMicro: 141 vs. 30 lines.
In that of VisiualMicro it will probably be interesting from the Line 24:
Linking it all together ...
"C:\Users\user\AppData\Local\arduino15\packages\STM32\tools\arm-none-eabi-gcc\6-2017-q2-update/bin/arm-none-eabi-g++" -Os -Wl,--gc-sections -mcpu=cortex-m4 "-TD:\Eigene Dateien\Eigene Dokumente\Arduino\hardware\Arduino_STM32\STM32F4\variants\generic_f407v/ld/jtag.ld" "-Wl,-Map,C:\Users\user\AppData\Local\Temp\VMBuilds\STM32F407_Test2\Arduino_STM32_generic_f407v\Debug/STM32F407_Test2.ino.map" "-LD:\Eigene Dateien\Eigene Dokumente\Arduino\hardware\Arduino_STM32\STM32F4\variants\generic_f407v/ld" -specs=nosys.specs -specs=nano.specs -o "C:\Users\user\AppData\Local\Temp\VMBuilds\STM32F407_Test2\Arduino_STM32_generic_f407v\Debug/STM32F407_Test2.ino.elf" "-LC:\Users\user\AppData\Local\Temp\VMBuilds\STM32F407_Test2\Arduino_STM32_generic_f407v\Debug" -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 "C:\Users\user\AppData\Local\Temp\VMBuilds\STM32F407_Test2\Arduino_STM32_generic_f407v\Debug/core/libmaple/syscalls.c.o" "C:\Users\user\AppData\Local\Temp\VMBuilds\STM32F407_Test2\Arduino_STM32_generic_f407v\Debug\STM32F407_Test2.cpp.o" "C:\Users\user\AppData\Local\Temp\VMBuilds\STM32F407_Test2\Arduino_STM32_generic_f407v\Debug\variant\generic_f407v.cpp.o" "C:\Users\user\AppData\Local\Temp\VMBuilds\STM32F407_Test2\Arduino_STM32_generic_f407v\Debug\variant\pin_map.c.o" "C:\Users\user\AppData\Local\Temp\VMBuilds\STM32F407_Test2\Arduino_STM32_generic_f407v\Debug\core.a" -Wl,--end-group

arm-none-eabi-g++*: error: C:\Users\user\AppData\Local\Temp\VMBuilds\STM32F407_Test2\Arduino_STM32_generic_f407v\Debug\core\libmaple\syscalls.c.o: No such file or directory

Error linking for board Generic STM32F407V series
Build failed for project 'STM32F407_Test2'

stevestrong Sun Mar 25, 2018 8:53 am

You have to force VM to rebuild the whole target.
First make sure that syscalls.c can be found in folder:
Arduino_STM32\STM32F4\cores\maple\libmaple

At build time Arduino outputs this file to his own temp/core/libmaple/ folder. So please check if your output folder contains this
Arduino_STM32_generic_f407v\Debug\core\libmaple\syscalls.c.o

da_user Sun Mar 25, 2018 3:45 pm

Hi,
thank you for the help ;-)

First make sure that syscalls.c can be found in folder:
Arduino_STM32\STM32F4\cores\maple\libmaple

You mean at \hardware\?
Yes, is there.

You have to force VM to rebuild the whole target.

Done.

At build time Arduino outputs this file to his own temp/core/libmaple/ folder.

There is one verbose massage like this:

"C:\Users\user\AppData\Local\arduino15\packages\STM32\tools\arm-none-eabi-gcc\6-2017-q2-update/bin/arm-none-eabi-ar" rcs "C:\Users\user\AppData\Local\Temp\VMBuilds\STM32F407_Test2\Arduino_STM32_generic_f407v\Debug\core.a" "C:\Users\user\AppData\Local\Temp\VMBuilds\STM32F407_Test2\Arduino_STM32_generic_f407v\Debug\core\syscalls.c.o"

Sign in to reply