[libmaple] Black F407VET6

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), 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?


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


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.
Hello World from F407!
Hello World from F407!
Hello World from F407!

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

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 5743 times

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:

// 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


Pito
Wed Apr 12, 2017 8:11 pm
And for big and fast CPUs here is the big math :) :
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


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.

Pito
Wed Apr 12, 2017 8:26 pm
Steve, it must work the same way on the VET6.. Forget USB.
Your LEDs are at PA6, PA7.
Serial pins at PA9, PA10.
The biggest problem is to find the .bin.
Erase the chip and upload the blink .bin from 0x08000000..
Disconnect your flasher (Stlink?) EDIT: soft disconnect
Reset.
It must work.

stevestrong
Wed Apr 12, 2017 9:03 pm
Pito, thank you, I confirm: blinky on PA6/7 and serial (USART1 on PA9/10) work indeed when board is set to F4 disco in Arduino.
And… I don’t even have to disconnect the STLink probe to work ;)

Next, I will setup a new Black_VET6 variant and make some customization.


Pito
Wed Apr 12, 2017 9:47 pm
This was missing long time back in F4
viewtopic.php?f=39&t=1001&p=12094&hilit=pwm+pito#p12046
Not sure it has been added already..

Why we set
discovery_f407.build.core=maplediscovery_f407.build.extra_flags=-DMCU_STM32F406VG


victor_pv
Thu Apr 13, 2017 3:09 am
stevestrong wrote: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.

ag123
Thu Apr 13, 2017 6:56 am
there is no need for a boot loader
1) set BOOT0
2) *just press reset won’t do, pull out the usb cable and reconnect again*
dmesg
[ 5955.084223] usb 3-4: new full-speed USB device number 9 using xhci_hcd
[ 5955.248859] usb 3-4: New USB device found, idVendor=0483, idProduct=df11
[ 5955.248861] usb 3-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 5955.248862] usb 3-4: Product: STM32 BOOTLOADER
[ 5955.248863] usb 3-4: Manufacturer: STMicroelectronics
[ 5955.248864] usb 3-4: SerialNumber: 338334803335

stevestrong
Thu Apr 13, 2017 7:28 am
I can confirm, BOOT0 = “1” and reset will put the device in bootloader mode, as expected.
On win10 x64 machine a new USB device is detected, first as “STM32 BOOTLOADER”, then after a while it becomes “STM device in DFU mode”.

However, I think this mode is not practical, since the user has to change the BOOT0 jumper by each upload.

The STLink is more practical, I don’t even have to remove the connection wires after uploading new software. The STLink probe re-flashes the device on the fly (tried with the STM32 ST-Link Utility).


Pito
Thu Apr 13, 2017 7:46 am
I had to install libusbK (zadig) in order to see the device (Win7 64b) with dfu-util 0.9.
I have to unplug and reinsert the usb plug in order to flash again. It flashes about 5kB/sec.
I have to reinstall Boot jumper to run the code. Maybe there is a dfu command to run the code.
It works here on Black ZET6, but it seems the st-link/j-link is a better alternative.

ag123
Thu Apr 13, 2017 8:04 am
i’d think for users without a separate st-link dongle, dfu is possibly a good substitute, as for boot0 an easy way is to plug a 2 way (3 connector) switch in place i.e. select 0 or 1

i think the stock dfu-util v0.7 works just as well, just that i’ve compiled my dfu-util from source
http://dfu-util.sourceforge.net/

and i’d think we could port the bootloader as well, that’d make it simpler to install a sketch. but it would be less ‘urgent’ as there is an existing solution


Pito
Thu Apr 13, 2017 8:12 am
I think there are tasks with higher priority – as for example SPI and others.. I tried to compile a sketch with Sdfat with no success (SPI compile errors).

stevestrong
Thu Apr 13, 2017 8:15 am
Pito wrote:I think there are tasks with higher priority – as for example SPI and others.. I tried to compile a sketch with Sdfat with no success (SPI compile errors).

Pito
Thu Apr 13, 2017 8:22 am
Btw SdFat supports SDIO with Teensy..

ag123
Thu Apr 13, 2017 8:35 am
in the early thread about Black F407{V,Z}ET6
http://www.stm32duino.com/viewtopic.php?f=3&t=1941

it is noted that the on board SPI flash may possibly be wired to a SPI1 port, the spi flash is suspected to be patched to PB3 SPI1_SCK, PB4 SPI1_MISO, PB5 SPI1_MOSI. however, SPI1 and SPI3 shares this port, hence, we could possibly configure SPI3 on PB3-PB5 if indeed the spi flash is hardwired to this port. the spi flash cs is pulled up to 3.3v, making it not possible to ‘switch off’ this in software

as noted in the early thread the schematics:
for VET6 the leds are on PA6 and PA7
http://wiki.stm32duino.com/images/5/5c/ … EMATIC.PDF
while on ZET6 the leds are on PF9 and PF10
http://wiki.stm32duino.com/images/4/4f/ … _sch-1.pdf

we’d then need to find another place to configure SPI1 on

i think F4 has hardware support for SDIO, but we could leave that as an ‘enhancement’ as we could literally try to use the hardware sdio for this, then transfers may reach those >10MBps speeds, i think SDIO needs more pins than just 4 for SPI


Pito
Thu Apr 13, 2017 8:56 am
First step is to compile the SPIx.. It does not compile yet. Then we may play with wirings..
On ZET6 the flash /CS is pulled via 10k to Vcc and driven by PB14. Mind the /CS is usually active low with memory devices. Wiring /CS high will disable the chip.
You can wire many devices to an SPI provided their /CSelects are different.

danieleff
Thu Apr 13, 2017 8:59 am
ag123 wrote:
we’d then need to find another place to configure SPI1 on

ag123
Thu Apr 13, 2017 9:17 am
Pito wrote:First step is to compile the SPIx.. It does not compile yet. Then we may play with wirings..
On ZET6 the flash /CS is pulled via 10k to Vcc and driven by PB14. Mind the /CS is usually active low with memory devices. Wiring /CS high will disable the chip.
You can wire many devices to an SPI provided their /CSelects are different.

Pito
Thu Apr 13, 2017 9:26 am
Here is the VET6 schematics – PB0 drives the /CS (F_CS signal) of the flash while it is pulled by 10k high.
http://www.stm32duino.com/viewtopic.php … 391#p17878

ag123
Thu Apr 13, 2017 9:34 am
now this board would make a nice clock and it can change the background image every hour if u’d like :lol:

zmemw16
Thu Apr 13, 2017 10:41 am
flash /cs – they renamed the signal, F_CS and its on ZET PB14, VET PB0

stephen


stevestrong
Thu Apr 13, 2017 6:10 pm
Meanwhile I did a comprehensive clean-up of the F4 project.

As I think the scope of this thread has been reached (blinky works :mrgreen: ), further software developments can be continued in this other thread from victor.

Intermediate results can be still posted here, if necessary.


zmemw16
Thu Apr 13, 2017 8:31 pm
no doubt in the wrong place :) replacement thread is lib_maple specific?

this is the exported files and reports of my srp4.ioc for the Black STM407VE

i believe it is fairly complete and matches the schematic, only issue is i don’t know how to handle PB3.
it’s TDO and also what they label as SPI1_SCK (actually spi3 alternate)
I2C2 is available.

stephen


stevestrong
Thu Apr 13, 2017 8:48 pm
stephen, thanks but honestly, I don’t know what to do with this ioc file.
it is a nice pdf doc as well, but I still cannot see how this should easy our life in this libmaple-based F4 structure.
As I said, I already re-worked some files, the pin mapping is also a bit clarified.
Maybe at a later point I will realize why this will be usable.

ag123
Thu Apr 13, 2017 9:51 pm
hi stephen,

thanks for posting that, the pdf is in effect a pin mapping?
there is a little discussion in the st core http://www.stm32duino.com/viewtopic.php … 256#p26256
about the pin conflicts for PB3-PB5
and danieleff has posted his point of view
http://www.stm32duino.com/viewtopic.php … =10#p26147

in the schematic
http://wiki.stm32duino.com/images/5/5c/ … EMATIC.PDF
PB3-PB5 SPI1_SCK, SPI1_MISO, SPI1_MOSI is shared by the onboard spi flash and the NRF24 connector (hence the SPI1 header is in the NRF24 connector)
PB6, PB7 I2C1_CLK and I2C1_SDA is also routed to the NRF24 connector to NRF_CE or NRF_CS (hence I2C1 can be found in the NRF24 connector as well)

if we take a look at the NRF24 specs NRF_CS is SPI chip select and NRF_CE is chip enable activates RX or TX mode
https://www.nordicsemi.com/chi/content/ … n_v2_0.pdf
hence PB6, PB7 would need to be GPIO pins if a NRF24 is actually used

we could select another sets of pins for I2C (e.g. PB10 i2C2_SCL, BP11 i2C2_SDA) and yet another for UART (e.g. PA8 USART1_CK / PA9 USART1_TX, PA10_USART_RX) as there are a large number of pins that’s broken out on the STM32F407{V,Z}E_black boards

and for the analog pins we could possibly simply select PA1-PA6 as their arduino counterparts


zmemw16
Thu Apr 13, 2017 10:10 pm
@:ag123
you need to use/view the CubeMX ioc file.

there is not a problem sharing the clock and data lines on SPI, interfaces. I am pretty sure if you took/read the SPI1 labels as SPI3, then it makes sense. Even the cpu pin label lists SPI3 :) Actually if they labelled I2C2 as I2C1, it would still be just an I2C interface.

i’m confused with PB3 as it’s TDO & also the SCK, it’s also a JTAG socket pin. it maybe that the start up sets the debug as SWD releasing all debug pins bar SWD_CLK & SWD_DAT.

Additionally I’ve got the FSMC and SDIO peripherals mapped without conflicts. I had to play with CubeMX and do quite a lot getting the FSMC mapped, mainly configuring alternates. To me that suggests the layout is pretty much as it was originally designed.
i
Those alternates will need to be seto uo as a board variant, either in the sketch or in the core, i’ve seen use of alternates in a post using lib maple.

stephen


stevestrong
Thu Apr 13, 2017 10:23 pm
New Black F407VET6 variant added to F4 boards in my repo Black F4 variant branch.
Also sent a PR for Roger.

ag123
Thu Apr 13, 2017 10:31 pm
thanks stephen,
as for PB3
while i’m not too familar with Jtag, PB3 is JTDO/ TRACESWO/SPI3_SCK / I2S3_CK /TIM2_CH2 / SPI1_SCK/EVENTOUT
if i understand it correctly SWO is mainly used with SWD for the board to send messages to the host pretty much like a serial console (i.e. print statements)
while SWD debug mainly uses 3 pins PA13 SWDIO, PA14 SWCLK and a ground pin

if we could make do with SWD debug with just 3 pins, it means we’d not have conflict with PB3
and if need be for various circumstances we could probably use usb-serial or a uart to send console messages (print statements) back to the host

agreed with the SPI3 assignments in PB3-PB5 (i.e. the default SPI port for arduino) as well as it seemed it may help to reduce some conflicts, otherwise the alternative to map SPI is to use PA5-PA7 as SPI1 and we could use that as a default spi port for arduino, just that it’d overlap some of the analog pins (if we define PA1-PA6 as arduino analog pins)


palmerr
Fri Apr 14, 2017 8:58 am
Hi all,

I’ve been doing some work to see if we can harmonize the Black F4VET6 boards across all the code streams. We’ve got the new STM32duino F4 branch happening, DanielEff has his GenericSTM32 code, and Avik’s Koduino is going strong.

I’ve just updated my repo with a bunch of updated info for the Black F4VET6 (STM32duino) – including a pin allocation rationale (discussed with Daniel and others) and some AF mappings that seem to make sense. The rationale is in the excel spreadsheet in the /documents folder.

The only change on the schematic is that it seems better to map the NRF/flash SPI to SPI3 instead of SPI1, to allow SPI1 to be available with a full set of NSS pinse for SPI-DMA.

The repo’s at https://github.com/palmerr23/Black-F407VET6-cube and is built against the STM32duino “cube” F4 code base.

Happy to hear if there is a better layout / AF mapping available, but also keen for us to tie something down ASAP for this board.

Richard


stevestrong
Fri Apr 14, 2017 9:44 am
I have made the following pin defines for black F4:
// Pins reserved for the on-board hardware
#define FLASH_CS_PIN PB0
#define FLASH_CLK_PIN BOARD_SPI3_SCK_PIN // PB3
#define FLASH_DO_PIN BOARD_SPI3_MISO_PIN // PB4
#define FLASH_DI_PIN BOARD_SPI3_MOSI_PIN // PB5

#define NRF24_CLK_PIN BOARD_SPI3_SCK_PIN // PB3
#define NRF24_DO_PIN BOARD_SPI3_MISO_PIN // PB4
#define NRF24_DI_PIN BOARD_SPI3_MOSI_PIN // PB5
#define NRF24_CE_PIN PB6
#define NRF24_CS_PIN PB7
#define NRF24_IRQ_PIN PB8

// SD card, SDIO mode
#define SD_DAT0 BOARD_SDIO_D0 // PC8
#define SD_DAT1 BOARD_SDIO_D1 // PC9
#define SD_DAT2 BOARD_SDIO_D2 // PC10
#define SD_DAT3 BOARD_SDIO_D3 // PC11
#define SD_CLK BOARD_SDIO_CK // PC12
#define SD_CMD BOARD_SDIO_CMD // PD2
// SD card, SPI mode, only usable with software SPI
#define SD_DI BOARD_SDIO_CMD // PD2
#define SD_DO BOARD_SDIO_D0 // PC8
#define SD_CS BOARD_SDIO_D3 // PC11
#define SD_SCLK BOARD_SDIO_CK // PC12


palmerr
Sat Apr 15, 2017 1:17 am
Steve,

That matches with my reading of the correct pinouts.

I’ll have to trust your judgement on the SPI-SDIO allocations as it’s outside my experience!

I’m working on a pinout diagram today as requested in earlier the thread.

Richard


vitor_boss
Thu Jun 01, 2017 11:48 pm
That board don’t need any bootloader? I didn’t found any consistent answer.

What repo should I use for this board? I just got it.


zmemw16
Fri Jun 02, 2017 12:20 am
steve,
the hardware is not mapped as you would perhaps expect, the CubeMX allows each interface to be re-mapped and to where / wanted as long as the actually pin is capable of performing the function e.g. miso or i2c sda.
you can modify the ‘spi1 interface’ to actually use the spi3 pins, i2c1 is moved as well, CubeMX generates code as it is told to.
you need to see the distinction made between the cpu datasheet pins names/description and ‘how and where’ they map to the actual hardware.
the easiest way to see the mapping is to use CubeMX and the ioc file for the variant. actually that’s how learnt CubeMX albeit lightly.
i’m working towards bare metal using hal and compiling for myself, a long if i take it slow curve, so not as steep as it could be if i wasn’t retired :-)
sorry it’s badly explained.

stephen


ChrisMicro
Fri Jun 02, 2017 4:06 am
>That board don’t need any bootloader? I didn’t found any consistent answer.
My Board had no boot loader. I used it with a ST-Link-V2

>What repo should I use for this board? I just got it.
I use the STM32GENERIC and I’ve made examples for it.


ag123
Fri Jun 02, 2017 7:30 am
vitor_boss wrote:That board don’t need any bootloader? I didn’t found any consistent answer.

What repo should I use for this board? I just got it.


vitor_boss
Fri Jun 02, 2017 1:39 pm
ag123 wrote:
the development branch for libmaple core is currently on steve’s repository on the “black f4 variant” branch
https://github.com/stevstrong/Arduino_S … F4_variant

the others are stm32generic
http://www.stm32duino.com/viewtopic.php?f=42&t=1966

and the core from stm itself
http://www.stm32duino.com/viewtopic.php?f=48&t=2098

palmerr has made an stm’s core for this board
https://github.com/palmerr23/Black-F407VET6-cube


ag123
Fri Jun 02, 2017 1:57 pm
i’m running on an older copy of the libmaple f4 dev, i’d need to ‘refresh’ my copy but it’d break some sketches i’m meddling with currently. hence i’d defer to steve to answer about the errors. i’m not too sure about the errors myself short of compiling and trying it out.

as for stm’s core try palmerr’s version instead, that’s sort of tailored for the stm32f407 black board

stm32generic accordingly has got quite a bit of developments done for it recently, e.g. some SDIO stuff is being tested,
and pito achieved a whopping 14MB per secs to a sammy class 10 sd card recently. it is worth checking out
http://www.stm32duino.com/viewtopic.php … 058#p28977


stevestrong
Fri Jun 02, 2017 3:16 pm
vitor, thanks for finding this error.
Please replace that line 6 in variant.h by:
#define digitalPinToBitMask(P) ( BIT(P&0x0F) )

vitor_boss
Fri Jun 02, 2017 3:46 pm
stevestrong wrote:vitor, thanks for finding this error.
Please replace that line 6 in variant.h by:
#define digitalPinToBitMask(P) ( BIT(P&0x0F) )

stevestrong
Fri Jun 02, 2017 3:50 pm
Sorry, but I cannot follow these errors.
I just checked out the Black_F4 branch, and I compiled the blink sketch, without any error/warning.
Which IDE are u using?

stevestrong
Fri Jun 02, 2017 5:49 pm
For those who want to try out the libmaple F4 repository, I updated the first port in this thread with new information, please check it out.

vitor_boss
Fri Jun 02, 2017 8:00 pm
stevestrong wrote:Sorry, but I cannot follow these errors.
I just checked out the Black_F4 branch, and I compiled the blink sketch, without any error/warning.
Which IDE are u using?

stevestrong
Fri Jun 02, 2017 8:42 pm
I updated the first post with upload information.

vitor, if you still have problems, please post here the Arduino build output.
Which sketch do you try to build? As I told, it builds fine for me (on Win10 64b).


vitor_boss
Fri Jun 02, 2017 9:07 pm
stevestrong wrote:I updated the first post with upload information.

vitor, if you still have problems, please post here the Arduino build output.
Which sketch do you try to build? As I told, it builds fine for me (on Win10 64b).


stevestrong
Fri Jun 02, 2017 9:10 pm
In Arduino IDE, you have to select Tools->Boards->”Generic STM32F407V series”, and after that the Tools->USB Configuration->USB serial (CDC), if you want to have serial over USB.

stevestrong
Fri Jun 02, 2017 9:15 pm
You are certainly not using the right software package (branch) because the HardwareSPI stuff should not exist at all in my latest version…
check here: https://github.com/stevstrong/Arduino_S … e/libmaple
Please do a clean install (download & extract) of the mentioned branch.

vitor_boss
Fri Jun 02, 2017 9:27 pm
My bad, I did a dirty install, but I had downloaded from your master branch earlier

One last question, what library is used on PlatformIO?

edit: Blink sketch uses 11904 bytes of RAM, is that right? maple mini uses 8K


vitor_boss
Sat Jun 03, 2017 12:49 am
Using the board Serial and a generic USB Serial converter with ‘Flash Loader Demo’ application is possible to write binaries on processor

vitor_boss
Tue Jun 06, 2017 8:06 pm
stevestrong wrote:You are certainly not using the right software package (branch) because the HardwareSPI stuff should not exist at all in my latest version…
check here: https://github.com/stevstrong/Arduino_S … e/libmaple
Please do a clean install (download & extract) of the mentioned branch.

stevestrong
Tue Jun 06, 2017 9:35 pm
There is already a working, DMA capable SPI library in the libraries folder. https://github.com/stevstrong/Arduino_S … es/SPI/src

acronis
Fri Jun 16, 2017 1:10 pm
Hello.

IDE 1.8.2 , you have the library installed stevestrong has the libraries for 16 bit parallel display and https://github.com/stevstrong/Adafruit_ … 6bit_STM32 https://github.com/stevstrong/Arduino_S … F4_variant . example Graphisctest. error

In file included from C:\Users\VIC\ Documents\Arduino\\libraries Adafruit_TFTLCD_16bit_STM32-master\examples\graphicstest\graphicstest.ino:7:0:

C:\Users\VIC\Documents\Arduino\libraries\Adafruit_TFTLCD_16bit_STM32-master\src/Adafruit_TFTLCD_16bit_STM32.h in the void writeCommand function '(uint16_t)':

C:\Users\VIC\Documents\Arduino\libraries\Adafruit_TFTLCD_16bit_STM32-master\src/Adafruit_TFTLCD_16bit_STM32.h:64:22: error: 'fsmcCommand' was not declared in this area

#define lcdCommand (*fsmcCommand)

^

C:\Users\Виктор\Documents\Arduino\libraries\Adafruit_TFTLCD_16bit_STM32-master\src/Adafruit_TFTLCD_16bit_STM32.h:68:27 note: in expansion of macro 'lcdCommand'

#define writeCmd(d) { lcdCommand = d; } //(l&0x00FF); }

^

C:\Users\VIC\Documents\Arduino\libraries\Adafruit_TFTLCD_16bit_STM32-master\src/Adafruit_TFTLCD_16bit_STM32.h:200:2 note: in expansion of macro writeCmd"

writeCmd ();


stevestrong
Fri Jun 16, 2017 1:14 pm
Please check the very first post of this thread, there is written to use another branch, the generic_f4, which contains the latest developments, also support for FSMC, which the black_f4 branch does not include.

acronis
Fri Jun 16, 2017 1:29 pm
set . error
C:\Users\51FB~1\appdata\local\temp\arduino_modified_sketch_882808\graphicstest.Ino:1:28: fatal error: libmaple/FCSM.h: no such file or directory

#include <libmaple/FCSM.h>


stevestrong
Fri Jun 16, 2017 1:38 pm
You don’t have to extra include the FSMC header into the sketch, because it is done automatically within the “Adafruit_TFTLCD_16bit_STM32.h” header file, line 56.

And please do a clean extract of the downloaded ZIP files (both Adafruit 16 bit parallel lib and generic_f4 branch), delete any existing previous files/folders.


acronis
Fri Jun 16, 2017 1:47 pm
I have done so .
The library just now installed.
#include <libmaple/fsmc.h> more not prescribed

#include <libmaple/FCSM.h> ???? true name ???
FSMC.h ???


stevestrong
Fri Jun 16, 2017 2:41 pm
Sorry, but it is still not clear what you intend to do with FSMC.h or FCSM.h

As I told, you do not have to include any additional header file, the graphic test should run out of the box with FSMC activated.
If you want to disable it, then comment out line 15 of the graphics lib header file.


acronis
Fri Jun 16, 2017 3:07 pm
Great !
It worked !
Super !
THANK you !

acronis
Fri Jun 16, 2017 3:17 pm
Tell me more please , where to download a working example for SD Card-based generic_F4 branch of my repo

stevestrong
Fri Jun 16, 2017 3:30 pm
Glad that it worked.

SdFat examples are available in the original SdFat source directory of Bill Greiman on github, please search for it and download it, then place it to library folder of the Arduino working directory.

Currently only the SPI interface is working with SD-cards, you have to choose one SPI port and connect an extra SD-card module to it.
For that please check the SdFat help, it provides information how to use it with STM32.

The on-board SD card slot usage is only possible when using the SDIO interface.
Which is currently under evaluation phase, basically is working very stable, but I need to make more tests to be sure that it works under any circumstance.


acronis
Fri Jun 16, 2017 3:33 pm
I’m interested in is The on-board SD card slot.
We expect from You information about the testing

acronis
Fri Jun 16, 2017 3:35 pm
And tell me which library is better to use for working with clocks (RTC) this Board ?

stevestrong
Fri Jun 16, 2017 3:37 pm
acronis wrote:And tell me which library is better to use for working with clocks (RTC) this Board ?

stevestrong
Sun Jun 18, 2017 6:36 pm
The generic F4 repository has been updated with SDIO related files, see http://www.stm32duino.com/viewtopic.php?f=39&t=2215.

acronis
Tue Jul 04, 2017 8:17 am
Hello.

Your library on the STM32F407VET6 wonderful ! Now I work and display and SD CARD (SDIO)!!!

But I can not deal with the internal rtc for this Board.
Please give a simple working example for this Board.

I really need time and date for the my project.


stevestrong
Tue Jul 04, 2017 8:29 am
I did not deal with RTC yet, but it may be my next target as the black F4 board has the cell battery on-board.

You could check this library already in the repository:
https://github.com/rogerclarkmelbourne/ … es/RTClock

Some examples can be found here:
https://github.com/rogerclarkmelbourne/ … k/examples


acronis
Tue Jul 04, 2017 8:44 am
Great !
I will wait for your news about the black F4 RTC Board battery on Board.

library already in the repository, and I’ll try to check.


stevestrong
Tue Jul 04, 2017 5:44 pm
Meanwhile I deleted the generic_F4 branch, so that the master branch will have the latest developments. I updated the first post, too.

vitor_boss
Thu Jul 06, 2017 5:17 am
To enable FPU need few things. Insert this on Start_c.c
#if (__ARM_PCS==1 || __ARM_PCS_VFP==1) //using FP on code?
#if defined (__FP_FAST_FMAF) //mfloat-abi=hard or mfloat-abi=softfp
#warning enabling harware fpu
__asm volatile
(
" ldr.w r0, =0xE000ED88 \n" /* The FPU enable bits are in the CPACR. */
" ldr r1, [r0] \n" /* read CAPCR */
" orr r1, r1, #( 0xf << 20 )\n" /* Set bits 20-23 to enable CP10 and CP11 coprocessors */
" str r1, [r0] \n" /* Write back the modified value to the CPACR */
" dsb \n" /* wait for store to complete */
" isb" /* reset pipeline now the FPU is enabled */
);
#else
#warning software or no floating point
#endif
#endif

vitor_boss
Thu Jul 06, 2017 5:42 am
There is a macro missing from arduino Word(h,l);
Just insert those lines on wirish_math.h on line 36
#include <stdint.h>

acronis
Thu Jul 06, 2017 9:03 am
Hello.
Can you show an example for the RTC in your library

If I connect the library #include <RTClock.h> error
The maintainer is missing from libraries C:\Users\Admin\Documents\Arduino\hardware\Arduino_STM32-master\STM32F4\libraries\RTClock


vitor_boss
Fri Jul 07, 2017 1:36 am
https://github.com/Marzogh/SPIFlash
This lib works on STM32GENERIC, with yours I’m getting no lucky.

EDIT: Default EEPROM is W25Q16, I have to replace mine because was return wrong numbers, now is W25Q64.


stevestrong
Mon Jul 10, 2017 5:15 pm
First post updated with following info:

EDIT – 2017.07.10
RTC lib reworked to be independent from other time libraries. Tested on balck F4V board. Includes an example sketch to set the RTC time.


acronis
Tue Jul 11, 2017 6:29 am
I added to the end of the file library.properties string maintainer= and the error is Missing ‘maintainer’ from the library disappeared. The library has connected fine.
Whether it is possible to add to Your library ?

acronis
Tue Jul 11, 2017 7:14 am
RTClock rtc;
time_t tt;
tm_t tm;
int hh; // hour

rtc.getTime(tm);
hh = tm.hour();
error: expression cannot be used as a function

Wrong did.
hh = tm.hour;

So right and works !
Thank you !


acronis
Tue Jul 11, 2017 8:26 am
Tell me, please, whether in the library, bus І2С ?

stevestrong
Tue Jul 11, 2017 8:31 am
[acronis – Tue Jul 11, 2017 7:14 am] –
rtc.getTime(tm);
hh = tm.hour();

This way you get the time elements as variables in the tm structure.
As alternatives you can use:
rtc.getTime(tm);
hh = tm.hour;
// or
hh = rtc.hour(); // pay attention to the object "rtc" instead structure "tm"


acronis
Tue Jul 11, 2017 8:34 am
Well !

Thank You very much ! My project perfectly works thanks to You !!!
It remains only to wait for the implementation of I2C


acronis
Wed Jul 12, 2017 9:20 am
Hello.
Prompt, please, can I use FreeRTOS 9.0.0 with Your library ?

stevestrong
Wed Jul 12, 2017 9:28 am
[acronis – Wed Jul 12, 2017 9:20 am] –
Hello.
Prompt, please, can I use FreeRTOS 9.0.0 with Your library ?

I don’t know, I have never used, nor tested it.
You can try it, but I cannot give you support of any kind in this case.


acronis
Wed Jul 12, 2017 9:30 am
Well.
I’ll try and write here.

acronis
Wed Jul 19, 2017 7:10 am
Hello stevestrong !

I need to connect a RFID reader module RDM6300-UART with your library for the STM32F407 black.
As you can try to make ?

https://ru.aliexpress.com/item/1-set-12 … 2.4.2.Have


stevestrong
Wed Jul 19, 2017 8:21 am
We can discuss about it if you find a library for that module.
If the module uses SPI, it should run out of the box.

I just realized it uses normal serial Rx/Tx. So it should work with one of the serial interfaces.
https://github.com/garfield38/RDM6300/t … er/arduino

acronis
Wed Jul 19, 2017 8:40 am
This library uses #include <SoftwareSerial.h>.
SoftwareSerial only works on a STM32f103.
STM32F407VET6 on SoftwareSerial gives error.

stevestrong
Wed Jul 19, 2017 8:44 am
Just comment out the line “//#include <SoftwareSerial.h>”.
Use Serial1, 2 or 3 in the code.
You could insert:
#define SoftwareSerial Serial1 // or Serial2, or Serial3

acronis
Wed Jul 19, 2017 9:04 am
Where to read which pins correspond to Serial1 ?

stevestrong
Wed Jul 19, 2017 9:07 am
Check the wiki: http://wiki.stm32duino.com/index.php?title=STM32F407

acronis
Wed Jul 19, 2017 9:12 am
PB7 – RX1
PB6 – TX1

Ok ?


stevestrong
Wed Jul 19, 2017 9:23 am
Please check here the USART pins: https://github.com/rogerclarkmelbourne/ … 407v.h#L62

acronis
Thu Jul 20, 2017 4:58 am
Serial1 – RX pin PA10

Thank you very much !
It worked through physical serial port (serial1) !


acronis
Fri Jul 21, 2017 4:22 am
Hello stevestrong.

Tell me how your business integration W5500 library ?
As soon as you can try out ?


stevestrong
Sat Jul 29, 2017 9:34 am
Support for W5500-based Ethernet modules has been added (see http://www.stm32duino.com/viewtopic.php … 063#p32063).

acronis
Sat Oct 14, 2017 9:36 pm
Hello Steven.

Doing a project in which I need a fast ADC.
Took example code https://github.com/arpruss/stm32scope-e … /scope.ino .

It is compiled on the Board STM32F1* great.

But the Board STM32F407VET6 error

error: cannot convert 'const adc_dev' to 'const adc_dev*' for argument '1' to 'void adc_set_sample_rate(const adc_dev*, adc_smp_rate)'

adc_set_sample_rate(ADC1, ADC_SMPR_1_5); // ADC_SMPR_13_5, ADC_SMPR_1_5


stevestrong
Sun Oct 15, 2017 8:31 am
I think for F4 you have to use:
adc_set_sample_rate(&ADC1, ADC_SMPR_1_5);

acronis
Sun Oct 15, 2017 12:43 pm
Steven Thank you.

This error is gone , but there were other

dc_read:412: error: base operand of ‘->’ has non-pointer type ‘const adc_dev’

on line

dataPoints[j+1] = ADC2->regs->DR & ADC_DR_DATA;

void fetch() {

// const adc_dev *dev = PIN_MAP[analogInPin].adc_device;

int channel = PIN_MAP[analogInPin].adc_channel;

adc_set_sample_rate(&ADC1, ADC_SMPR_1_5); // ADC_SMPR_13_5, ADC_SMPR_1_5

adc_set_sample_rate(&ADC2, ADC_SMPR_1_5); // ADC_SMPR_13_5, ADC_SMPR_1_5

adc_set_reg_seqlen(&ADC1, 1);

adc_set_reg_seqlen(&ADC2, 1);

ADC1->regs->SQR3 = channel;

ADC2->regs->SQR3 = channel;

ADC1->regs->CR1 |= 0x70000; // ADC_CR1_FASTINT;

ADC1->regs->CR2 |= ADC_CR2_CONT | ADC_CR2_SWSTART;

ADC2->regs->CR2 |= ADC_CR2_CONT | ADC_CR2_SWSTART;

ADC2->regs->CR1 |= 0x70000; // ADC_CR1_FASTINT;

nvic_globalirq_disable();

// uint32_t t = micros();

// .584 uS

for (int j = 0; j < maxSamples ; j+=2 )

{

while (!(ADC1->regs->SR & ADC_SR_EOC))

;

dataPoints[j] = ADC1->regs->DR & ADC_DR_DATA;

while (!(ADC2->regs->SR & ADC_SR_EOC))

;

dataPoints[j+1] = ADC2->regs->DR & ADC_DR_DATA;

}

nvic_globalirq_enable();
}


stevestrong
Sun Oct 15, 2017 4:10 pm
Oh well, I see your point, there are many places which use ADC as a pointer and not as the structure address.
The ideal solution would be to change the ADC module of F4 to be compatible with F1.
Till then, you can replace ADCx by (&ADCx).

acronis
Sun Oct 15, 2017 11:32 pm
Hello Steven !

I hear You.
You did a great job by adding support STM32F4.
I really hope that You will be able to add support for ADC on this Board.


acronis
Thu Oct 19, 2017 11:37 am
Hello Steven

Rewrote all the code in &ADCx, but the error persists

dataPoints[j+1] = &ADC2->regs->DR & ADC_DR_DATA;

base operand of ‘->’ has non-pointer type ‘const adc_dev’

In this line, correct the code ?


stevestrong
Thu Oct 19, 2017 12:13 pm
Use the brackets correctly:
dataPoints[j+1] = (&ADC2)->regs->DR & ADC_DR_DATA;

acronis
Fri Oct 20, 2017 11:54 am
Hello Steven.

I was able to do as you told me.
The error no longer exists.

But ADC is not working correctly, the values are constantly jumping (subject to change).
I tried to connect the ADC pin to GND and VCC, the values still vary over a wide range.
Tried using analogRead () all the same – value jump from the lower to the upper limit.

Why doesn’t ADC ?
It is possible as that to solve ?


stevestrong
Fri Oct 20, 2017 12:01 pm
[acronis – Fri Oct 20, 2017 11:54 am] –
It is possible as that to solve ?

Very probable that it can be solved.
Just the necessary time is missing…


acronis
Fri Oct 20, 2017 12:05 pm
Thank You for Your tremendous work.
You have so much done !!!
You’re probably only ADC !
We will wait for a quick solution.

Thank You again.


acronis
Mon Oct 23, 2017 3:06 pm
stevestrong thank you very much for the help !
It worked on another pine !

acronis
Wed Nov 08, 2017 12:35 pm
Hello steven.
Not if You managed to adapt the I2C for this Board?

stevestrong
Wed Nov 08, 2017 1:15 pm
Not for this board, but maybe for the generic mini, there is an I2C EEprom on board.
Only time is missing…

acronis
Wed Nov 08, 2017 1:54 pm
Eh…

I don’t have enough I2C to connect various sensors to the Board STM32F4 BLACK….

You are amazing !
I hope that You will eventually make !
Thank YOU !

Thanks to You I have a lot of things connected to this boards: ADC,RTC,display (FCSM LCD-16bit), Ethernet (W5500), SD card (sdio), NRF24L01 , sensors on SPI and others…

there is only I2C…..


stevestrong
Tue Nov 14, 2017 7:55 pm
Short update: I managed to implement the USB serial connection status detection, so that
while(!Serial);

RogerClark
Tue Nov 14, 2017 8:07 pm
[stevestrong – Tue Nov 14, 2017 7:55 pm] –
Short update: I managed to implement the USB serial connection status detection, so that
while(!Serial);

stevestrong
Tue Nov 14, 2017 8:13 pm
As you know, i am not able to make clean prs, but i will try it.
Can’t you simply merge from my patch?

RogerClark
Tue Nov 14, 2017 8:18 pm
No worries

I will try to merge the patch


stevestrong
Tue Nov 21, 2017 9:24 am
[acronis – Wed Nov 08, 2017 1:54 pm] –
Thanks to You I have a lot of things connected to this boards: ADC,RTC,display (FCSM LCD-16bit), Ethernet (W5500), SD card (sdio), NRF24L01 , sensors on SPI and others…

there is only I2C…..

I2C (Wire) is finally working, see http://stm32duino.com/viewtopic.php?f=3 … 379#p37376


acronis
Sat Nov 25, 2017 9:32 am
I2C (Wire) is finally working

WOW !
SUPER !!!

Steve – thank you so much !


Nutsy
Tue Jan 16, 2018 1:01 pm
I have the ZGT6 black board… and im having this problem too… No Com port shows up when connected to USB, setting BOOT0 high put it into dfu mode.

However, the main issue I have here is while yes this is a combersom way to upload firmware when your doing loads of debugging and constant reuploads…

How is one meant to use the serial monitor to read the readouts of my debugging if the chip doesnt do the virtual com port?

Should I just stick to using the hardware serial and a usb serial adaptor? If so, can i upload firmware via that?


stevestrong
Tue Jan 16, 2018 1:15 pm
If you use Roger’s or my repo, in the Arduino IDE you have options for USB function, you can select between:
– USB inactive (unfortunately on first place),
– USB serial (CDC), or
– USB MSC (not implemented).
Please check your option.
I usually enable USB serial and upload with STLink, not USB DFU, I find cumbersome to switch the BOOT1 jumper all over again to different position.
And STLink does not work as USB serial interface, you need an extra USB cable between the micro USB socket and PC.

Anyway, if you debug with STLInk, the USB serial will most probably not work when you stop the program, the USB protocol is sensitive on breaks longer than 20ms and will stop the interface communication.


Nutsy
Tue Jan 16, 2018 3:15 pm
I have the black board not the stm discovery… Can i use the discovery 407 core then?

stevestrong
Tue Jan 16, 2018 3:28 pm
You can try the “Generic F407VE series” but as the name says, it is the VET version, not the ZGT, means different flash/ram size and board pinning.
But you could generate a new board variant, if you want.

michael_l
Tue Jan 16, 2018 3:47 pm
I’d like to try this core with “Blue F407VET6” that has 25Mhz resonator. Steve, I wonder if you know what changes are needed for getting the 25Mhz resonator working ?

Image

Image


stevestrong
Tue Jan 16, 2018 3:50 pm
That is the generic F407 mini, see here: http://stm32duino.com/viewtopic.php?f=39&t=2804.

Select “Generic STM32F407V mini series” in the Arduino IDE menu board selector. :)

It only works with my repo: https://github.com/stevstrong/Arduino_STM32


Manny
Sun Jan 21, 2018 11:09 am
Downloaded your repo Steve and cant get serial USB to work or get recognised, using a STM32F407 mini.

Wolfie
Wed Jan 24, 2018 9:54 am
Hi all,

Thanks for all the work you’ve done for this board. I’ve been using the STMF103CBT6 for some time now and was looking to “trade-up” to something with more ram, found this board on ebay… and now I’m here.

I noticed that there was a post for the W5500 being ported, so this morning I freshly downloaded Arduino_STM32 and Ethernet_STM32 and then tried this sketch:

#include <Ethernet_STM32.h>

SPIClass mSpi(1);

void setup() {
Serial.begin(115200);
delay(500);
Serial.print("initialising ethernet... ");
Ethernet.init(mSpi, PA4);
Serial.println("done");
uint8_t mac[6] = {0x00,0x01,0x02,0x03,0x04,0x05};
Serial.print("initialising ethernet with DHCP... ");
if (Ethernet.begin(mac) == 0) {
Serial.println("failed");
} else {
Serial.println(" DHCP assigned IP ");
Serial.println(Ethernet.localIP());
}

}


stevestrong
Wed Jan 24, 2018 10:21 am
Thanks for pointing to this issue, I just added that macro to /cores/maple/libmaple/gpio.h.
Please check it out again.

dannyf
Wed Jan 24, 2018 2:18 pm


what changes are needed for getting the 25Mhz resonator working ?

Go through the code and search for HSE_Value. It can be changed in the code or via the ide preprocessor – st isn’t consistent on that.

You may also look through PLL settings to make sure that you don’t exceeded it’s max frequency.

Btw, did they really use a resonator and not a crystal? Shame on them if so.


Wolfie
Wed Jan 24, 2018 3:07 pm
Thanks for pointing to this issue, I just added that macro to /cores/maple/libmaple/gpio.h.
Please check it out again.

Thanks for the fast response, I’ve just done a fresh download and it now compiles.

Of course it doesn’t do anything else, ha ha, but I’m new to the W5500, so I’ll make sure I’ve got everything set up correctly.

Regards.


stevestrong
Wed Jan 24, 2018 3:23 pm
You could start with the WebClient example of my W5500 lib, using your own SPI instance.
Make sure that your router supports DHCP and allows new connections.
Also, be aware that not any MAC addresses are valid, so the router could refuse the connection based on that being invalid.

Wolfie
Wed Jan 24, 2018 3:51 pm
You could start with the WebClient example of my W5500 lib, using your own SPI instance.
Make sure that your router supports DHCP and allows new connections.
Also, be aware that not any MAC addresses are valid, so the router could refuse the connection based on that being invalid.

Thanks Steve.

My main project last year involved Christmas lights panels on the windows. The panels of WS2812B leds were controlled by STM32F103(C8T6) modules and the PC sent the control information via WiFi to a ESP8266 which then passed on the data to the STM32F103 via serial. (9 panels of leds with 5 ESP8266->STM32F103 modules.)

This worked very well, but this year I want to do more, and the 20kB ram on the STM32F103 was getting to be a bit of a restriction.

So I wanted a board that had more ram, but was still easy to program, preferably by Arduino IDE. I have used STMCube + IAR but it it WAYYYY more complicated.

This black F407VET6 looks like a very promising replacement, and so this may also be a good time to consider removing the Wifi ESP8266 and connect the F407 directly to the LAN. Hence my interest.

I will look into your suggestion. As I am new to the W5500 I think I will maybe go back to the Uno, get this to work with the W5500, then progress to the F407VE, possibly via the F103…


stevestrong
Thu Jan 25, 2018 9:16 am
W5500 lib should work with my repo, check the web client example.

Wolfie
Thu Jan 25, 2018 11:02 am
Hello again,

Firstly, the W5500 module works fine with the Uno and Ethernet library, so I know the pin connections are correct and the module functions.

Secondly, I ran this to check the SPI pin allocations:

#include <SPI.h>
#include <Ethernet_STM32.h>

void setup()
{
Serial.begin(115200);
delay(500);

Serial.println("SPI default");
Serial.print("nss: "); Serial.print(SPI.nssPin()); Serial.print(" sck: "); Serial.print(SPI.sckPin()); Serial.print(" miso: "); Serial.print(SPI.misoPin()); Serial.print(" mosi: "); Serial.println(SPI.mosiPin());
Serial.print("nss: "); Serial.print(PA15); Serial.print(" sck: "); Serial.print(PB3); Serial.print(" miso: "); Serial.print(PB4); Serial.print(" mosi: "); Serial.println(PB5);
SPI.setModule(1);
Serial.println("SPI 1");
Serial.print("nss: "); Serial.print(SPI.nssPin()); Serial.print(" sck: "); Serial.print(SPI.sckPin()); Serial.print(" miso: "); Serial.print(SPI.misoPin()); Serial.print(" mosi: "); Serial.println(SPI.mosiPin());
Serial.print("nss: "); Serial.print(PA4); Serial.print(" sck: "); Serial.print(PA5); Serial.print(" miso: "); Serial.print(PA6); Serial.print(" mosi: "); Serial.println(PA7);
SPI.setModule(2);
Serial.println("SPI 2");
Serial.print("nss: "); Serial.print(SPI.nssPin()); Serial.print(" sck: "); Serial.print(SPI.sckPin()); Serial.print(" miso: "); Serial.print(SPI.misoPin()); Serial.print(" mosi: "); Serial.println(SPI.mosiPin());
Serial.print("nss: "); Serial.print(PB12); Serial.print(" sck: "); Serial.print(PB13); Serial.print(" miso: "); Serial.print(PB14); Serial.print(" mosi: "); Serial.println(PB15);
SPI.setModule(3);
Serial.println("SPI 3");
Serial.print("nss: "); Serial.print(SPI.nssPin()); Serial.print(" sck: "); Serial.print(SPI.sckPin()); Serial.print(" miso: "); Serial.print(SPI.misoPin()); Serial.print(" mosi: "); Serial.println(SPI.mosiPin());
Serial.print("nss: "); Serial.print(PA15); Serial.print(" sck: "); Serial.print(PB3); Serial.print(" miso: "); Serial.print(PB4); Serial.print(" mosi: "); Serial.println(PB5);


zmemw16
Thu Jan 25, 2018 11:20 am
PB4 on the schematic goes to the flash and the nrf24 socket, only!
you might have to play with remapping them.
stephen

stevestrong
Thu Jan 25, 2018 12:42 pm
PB4 is marked on the schematic as PB4/TRST (JTAG header) and as SPI1_MISO (connected to FLASH and NRF24).
PB4 is SPI3_MISO, not SPI1_MISO. Hence, SPI1 should actually mean (be) SPI3. I think we had already a discussion about this at an earlier time.
SPI3 pins overlap with the SPI1 alternative configuration, but the default declared SPI instance is 3, inline with your pin test.

this fails immediately
What does it mean?
The sketch will hang when the connections are wrong.

I will check this again.


Wolfie
Thu Jan 25, 2018 1:45 pm
Thanks guys, I have now found PB4 in the NRF interface, I will test for SPI3.

Wolfie
Thu Jan 25, 2018 2:38 pm
Steve, maybe apologies.

I have tested the SPI3 with the same results, But I then checked everything again and I have realised that the chip on my ethernet module is a W5100 not a W5500. It was an unused one that I had in a drawer, I must have got confused about which it was.

Apologies if this makes a difference.


stevestrong
Thu Jan 25, 2018 2:49 pm
No worries.
I was just thinking what else can be wrong in your case because everything works for me :)
But now it’s clear.
OTOH, my lib is restricted to W5500, no other variants are supported.

W5500 is more powerful than W5100, and has the same price, so it worth to have it.


Wolfie
Thu Jan 25, 2018 3:39 pm
OTOH, my lib is restricted to W5500, no other variants are supported.

Good! We now know what the problem is!

I have just ordered 2 x W5500. If I only ordered 1 it would be faulty! :lol:

Sorry for wasting your time.


Wolfie
Wed Feb 14, 2018 8:02 am
Hello again,

I’ve been doing a bit of PWM investigation. According to STM32CubeMX there are 32 PWM pins available, and with a bit of jiggery-pokery, I’ve got them all working.

Image

The above image shows the pin allocations for each timer.
The colouring shows the default frequency when using pwmWrite. Timers 1, 8, 9, 10 & 11 are attached to ABP2 which runs at 84MHz, and the others are attached to APB1 which runs at 42MHz, When using pwmWrite the count runs from zero to 65535 and so the frequency should be 84,000,000 / 65536 for timers on on APB1, and 42,000,000 / 65536 for timers on on APB2. The equate to 1282Hz and 641Hz respectively, which are remarkably close to the measured values (or a complete coincidence).

Image

The above image shows those pins that work without changing anything (I basically set a different frequency for each timer by setting the prescaler value and the ARR, and then set a different duty cycle for each channel, so every pwn pin had a unique signature).

(Note that PB4 is accessible via the “bottom right” pin of the NRF24L01 interface taking J-TAG as the “top” of the board.)

Firstly, I think there’s a bit of confusion over PA5 (timer 2 channel 1) as this appears in various places as PA15. If PA15 is indeed an alternative, I could not get it to work. However, after changing the details in Arduino_STM32\STM32F4\variants\generic_f407v\pin_map.c from PA15 to PA5 the pin sprang to life.

Similarly, the entries for PB10, PB11 and the pins for timers TIM10 – TIM14 were simply missing from pin_map.c, after adding in the timer and channel for each of these pins, they all started working too.

Of course, I don’t know whether adding in these entries will adversely affect anything else.

Regards…


stevestrong
Wed Feb 14, 2018 5:00 pm
Can you do a PR?

PA15 is reserved for SPI3 NSS.
Timer 2 ch 1 is not mapped to PA5 to allow to be used as SPI1 SCK.
In the same context, PB10 and PB11 are reserved for (SPI2_SCK or I2C2_SCL or UASRT3_TX) and (I2C2_SDA or USART3_RX), respectively.

So Timer 2 was given lower prio versus I2C2/USART3, because there are plenty of other timers available on other pins.
Same applies for other pins you mentioned, in favor of SPI, I2C and USART.
Take a look into generic_f407v.h for reserved pins and what are they reserved for.

To activate TIMER2_CH1 on PA15, PA15 must be mapped to the respective alternate function AF1, which is not done in the current version of the repo.
You can use the function gpio_set_af_mode() using my repo.
gpio_set_af_mode(PA15, GPIO_AFMODE_TIM1_2);


Wolfie
Thu Feb 15, 2018 8:39 am
Thanks for the explanation Steve.

I wasn’t expecting you to change anything, I just wanted to explain what to do in order to get all 32 PWM channels working for anyone that wanted to know, because I have a project that plans to use them all.

As an aside, my W5500 modules arrived yesterday and, late last night, I got a 407VE connected to the LAN, so thanks again for your work.


acronis
Sun Feb 18, 2018 12:27 pm
Steve

Please tell me how to do calibration of ADC ?

int channel = PIN_MAP[analogInPin].adc_channel;
adc_set_sample_rate(&ADC1, ADC_SMPR_1_5);
adc_set_reg_seqlen(&ADC1, 1);
(&ADC1)->regs->SQR3 = channel;
(&ADC1)->regs->CR1 |= 0x70000;
(&ADC1)->regs->CR2 |= ADC_CR2_CONT | ADC_CR2_SWSTART;


stevestrong
Sun Feb 18, 2018 12:43 pm
You must not and cannot calibrate the ADC of F4.

acronis
Sun Feb 18, 2018 12:52 pm
OK. thanks.

stevestrong
Sun Feb 18, 2018 9:08 pm
I needed a simple wave generator so I thought why not use the DAC of my F4 board.

The result is a sketch which generates either a sine wave (using a lookup table) or a triangle wave (using the internal wave generator of the F4 chip).
Configurable with some defines in the beginning of the sketch.

As usual, my repo gives the necessary utility functions.


Pito
Mon Feb 19, 2018 12:28 am
Any example for a simultaneous regular ADC sampling (2 ADCs sample a channel at the same exact time, no channel’s scan – scan disabled)?

stevestrong
Mon Feb 19, 2018 7:54 am
Yes, ADC is the next on the agenda, now that i have a reference signal from the DAC to sample ;)

stevestrong
Tue Feb 20, 2018 7:54 pm
This is another wave form generation example using DMA now.
This example allows to configure the output frequency (and amplitude in case internal triangle wave generator).
The example sine wave has 210 samples and 8 bit resolution, with 3.3Vpp.
The generated 20 kHz frequency is quite precise and the signal has a nice shape ;)

Now the next step is ADC.


vitor_boss
Fri Feb 23, 2018 1:01 am
[stevestrong – Tue Feb 20, 2018 7:54 pm] –
This is another wave form generation example using DMA now.
This example allows to configure the output frequency (and amplitude in case internal triangle wave generator).
The example sine wave has 210 samples and 8 bit resolution, with 3.3Vpp.
The generated 20 kHz frequency is quite precise and the signal has a nice shape ;)

Now the next step is ADC.

Very nice code, I’m not a skilled programmer like you guys but I have an idea to reduce #ifdefs
#elif GEN_WAVE==TRIANGLE
#if WAVE_AMP==3
const int WAVE_RES = 8192;
#elif WAVE_AMP==2
const int WAVE_RES = 4096;
#elif WAVE_AMP==1
const int WAVE_RES = 2048;
#endif
#endif


stevestrong
Fri Feb 23, 2018 8:34 am
Yes, it makes sense.

robca
Sat Mar 03, 2018 5:29 pm
I have a long dormant project I’d like to complete (2+ years dormant). It was built on a F103 board, but could not be completed due to limited RAM (only max 64k for the boards I could find) and slow floating point performance.

I happened to find it at the bottom of my pile, and browsing around I see that F4 boards are cheap now, and there is STM32duino support for F4… so I might be able to finish it after all :)

The only thing I’m confused, is that the F4 seems to have a complex memory map, with 112k + 16k + 64K, the latter CCM memory and not DMA enabled. If I were using a different toolchain, I know I could use the proper memory allocators and use all that memory. How about the STM32duino toolchain?

I had a quick look here https://github.com/stevstrong/Arduino_S … eric_f407v and it seems both ram (128k) and ccram (64k) are defined, but not sure how those are made available

If I had a board, it would be easy to test… but before I order (and wait for the slow boat from China), can someone here please help me understand how much free RAM can I reasonably expect to have for my code?

BTW: would this code work on your branch? https://github.com/mpflaga/Arduino-Memo … ryFree.cpp


vitor_boss
Sat Mar 03, 2018 5:38 pm
Yes, the freeram code works, also some guys are developing a F405 board with BluePill pinout compatible, is possible to replace only the F1 for the F4.

viewtopic.php?f=19&t=2633&start=580


robca
Sat Mar 03, 2018 9:26 pm
Thanks for confirming the freeram code works… but since I don’t have a F4 board, I was kinda hoping someone would be able to tell me how much free RAM I can get with one of the F4 boards ;) (they all have the same amount of RAM, only Flash and pins change)

And it looks as if eBay/Aliexpress F407 boards are the cheapest you can get, at sub-$10… STM32F405 is not any cheaper, actually costs more. F411 has less RAM, slower and single (slow) ADC, so wouldn’t work for me, even if cheaper. Love seeing open hardware and smaller form factors, but for my project it’s not critical. Since I don’t even know if it will ever work, might as well go cheap. But, to be honest, I’m not sure I see the point of custom-designing an F405 or F411 board, given where the market is at


stevestrong
Sun Mar 04, 2018 8:23 am
In my repo the stack has been mapped to ccmram, and an example how to map your varibles there is one of the usb buffers. Search the code for that.
But ccmram cannot be used with dma, like the rest of ram.

Regarding the board selection, i find the generic vet6 mini gives a very good starting point including slot for sd cards and i2c flash on board.
If you don’t need those extra hw pieces, any simplier “generic” type would make it, like that one in your other post (named “discovery”).


stevestrong
Sun Mar 04, 2018 8:45 am
[Pito – Mon Feb 19, 2018 12:28 am] –
Any example for a simultaneous regular ADC sampling (2 ADCs sample a channel at the same exact time, no channel’s scan – scan disabled)?

You cannot have that, see note in RM0090 chapter 13.9.2.


robca
Sun Mar 04, 2018 4:55 pm
[stevestrong – Sun Mar 04, 2018 8:23 am] –
In my repo the stack has been mapped to ccmram, and an example how to map your varibles there is one of the usb buffers. Search the code for that.
But ccmram cannot be used with dma, like the rest of ram.

Regarding the board selection, i find the generic vet6 mini gives a very good starting point including slot for sd cards and i2c flash on board.
If you don’t need those extra hw pieces, any simplier “generic” type would make it, like that one in your other post (named “dicovery”).

That’s great, thanks. I thought I saw the stack mapped to ccram, that was very smart of you, since it frees up more user RAM. Didn’t notice the USB, which is also a great idea. And, yes, I understand the ccram limitations (and I will rely heavily on DMA for a portion of the ADC code), on the other hand it’s faster than the rest of the RAM, so mapping stack and frequently used variables there speeds things up

So I should be able to, in effect, use more than 128Kb RAM in my code, once I figure out how to allocate some variables to ccram. Even (in theory) convert my ADC channels to almost 128Kb RAM using DMA, and stuffing every other variable in ccram. Awesome :)


victor_pv
Tue Mar 06, 2018 3:04 am
There is 2 possible approaches about CCM RAM:

  • You can place everything in it by default, and specify when you want to use normal RAM with an attribute.
  • Or you can place everything in normal RAM, and only place things in CCMRAM with an attribute.

I beleive we discussed it on some threads and the PRs, and decided to better leave normal RAM as default, since there is no restrictions on that one (for DMA, or to run code on it), and use CCM RAM only when the attribute is used.
This thread has some of the details:
http://stm32duino.com/viewtopic.php?f=5 … ccm#p32607

Steve would know for sure if the attribute he kept is the one we discussed in that thread, __CCMRAM__, if so, you only need to declare variables with that attribute to place them in CCM RAM, i.e:
uint16_t __CCMRAM__ buffer[256];


robca
Tue Mar 06, 2018 6:27 am
Thanks for the extra info. Yes, I looked at the code as suggested by Steve, and with the default settings, you can use the __CCRAM__ to allocate variables in ccram. It makes sense to use the normal RAM as default, since people might want to use DMA and in any case normal RAM is twice as big as ccram. Even in the USB case, there’s an ifdef to put the buffers in normal RAM if DMA is used.

It’s definitely nice to have the ability to decide where the variables are stored, and if speed is a concern, ccram should be used preferentially for anything not dependant on DMA. But I still believe that using normal RAM as default is safer, otherwise people would run into problems with libraries/code relying on DMA and would be very hard to troubleshoot

Since I use ADC with DMA, at a minimum the buffers used by the A/D conversion must be in normal RAM, but I need to see if I can get a faster execution by having some of the cross correlation code using ccram variables

At this point I’m confident that it’s worth starting to experiment with an F407 board. Just will need to wait for the slow boat from China to get here with my board :)


victor_pv
Tue Mar 06, 2018 8:46 am
One more piece of advice. The normal RAM is broken out in 2 blocks with separate bus access.
If you need the ultimate performance while doing 2 things in normal RAM at the same time (2DMA transfers or 1 transfer+cpu access), you could do the same we did with the CCMRAM and create a separate region for the top 16KB of ram, that way you can direct the compiler to place some buffer there, and know the DMA can access that region at the same time CPU or another DMA channel are accesing the other normal RAM region without any stalls.
I believe that’s why STM designed the normal RAM in 2 separate blocks.
You could also place some code in that top region, and could execute without being affected by any RAM access, if all other access goes to the other blocks.

robca
Tue Mar 06, 2018 5:20 pm
That explains why 128k RAM is usually described as 112k+16k… I was wondering what made that 16k block “special”, and now I know :)

Thanks for the info. Luckily my needs are pretty simple: high speed DMA ADC into a buffer (4 channels), then process the buffer as a single high speed task, sequentially. As such I don’t think that my code would benefit much from wringing out the extra perf of those 16k, since I’m pretty much serializing everything. I can see how it would benefit if I were using real time processing and a circular ADC buffer, processing the ADC buffer while the DMA transfer is active


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"


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

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.


Vassilis
Fri Jun 22, 2018 4:55 pm
Today, I sent a pull request that fixes the Backup RAM Boundary address
https://github.com/rogerclarkmelbourne/ … 79ad2b2721

Now backup RAM works on STM32F407 too


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 !


michael_l
Tue Sep 04, 2018 7:29 pm
[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 !

Stevestrong: need some help in adapting this function:

* @brief Set CAN to GPIO mapping
*/
CAN_STATUS can_gpio_map(CAN_Port* CANx, CAN_GPIO_MAP map_mode)
{
//rcc_clk_enable(RCC_AFIO);

status = CAN_INIT_FAILED;
if( CANx == CAN1_BASE)
{
switch(map_mode)
{
case CAN_GPIO_PB8_PB9:
rcc_clk_enable(RCC_GPIOB);
afio_remap(AFIO_MAPR_CAN_REMAP_PB8_PB9);
gpio_set_mode(GPIOB, 8, GPIO_INPUT_FLOATING);
gpio_set_mode(GPIOB, 9, GPIO_AF_OUTPUT_PP);
break;
#if NR_GPIO_PORTS >= 4
case CAN_GPIO_PD0_PD1:
rcc_clk_enable(RCC_GPIOD);
afio_remap(AFIO_MAPR_CAN_REMAP_PD0_PD1);
gpio_set_mode(GPIOD, 0, GPIO_INPUT_FLOATING);
gpio_set_mode(GPIOD, 1, GPIO_AF_OUTPUT_PP);
break;
#endif
default:
return status;
}
status = CAN_OK;
}
return status;
}


stevestrong
Tue Sep 04, 2018 9:51 pm
Put PB8 as first parameter. The second one will be the gpio mode.

stevestrong
Wed Sep 05, 2018 7:31 am
@michael_i, i think it would make sense to open a new thread to support you on developing the CAN lib. So please open a new topic under this group.

stevestrong
Wed Sep 12, 2018 1:02 pm
CAN is now working, see: http://stm32duino.com/viewtopic.php?f=3 … 239#p49235 (thanks to @michael_i!)

Leave a Reply

Your email address will not be published. Required fields are marked *