Arduino for STM32

Getting started with STM32F407-VGT6 development board + Arduino IDE + Mac OSX

Getting started with STM32F407-VGT6 development board + Arduino IDE + Mac OSX

Post by AndySymons » Fri Sep 28, 2018 6:03 pm

Why this topic?
I am starting this topic because I think this board — which I will call the "STM32F407VGT6 development board" (see picture) — deserves a specific area on the forum. Clones are sold under several brand names from China — currently at £7.27 on eBay.

Although the STM32F4xxx MCUs are mentioned in plenty of snippets around this forum and other sites, I found it hard as a newcomer to get the overview and put the details in sequence to get started, especially for the Mac OSX environment. I will share here my tested outcomes to help others get started quicker and hope to have further discussions about projects using this board.

Why this processor?
• 168MHz clock (plus an additional 32MHz oscillator for the real-time clock)
• 1 Mbyte of Flash memory
• LCD parallel interface, 8080/6800 modes
• Low-power operation
• 3×12-bit, 2.4 MSPS A/D converters
• 2×12-bit D/A converters
• Up to 17 timers: up to twelve 16-bit and two 32- bit timers up to 168 MHz
• Serial wire debug (SWD) & JTAG interfaces
• Up to 77 I/O ports, all with interrupt capability (on this board)
• Up to 3 × I2C interfaces
• Up to 4 USARTs/2 UARTs (10.5 Mbit/s)
• Up to 3 SPIs (42 Mbits/s)
• 2 × CAN interfaces (2.0B Active)
• SDIO interface
• USB 2.0 full-speed device/host/OTG controller with on-chip PHY
• USB 2.0 high-speed/full-speed device/host/OTG controller
• 10/100 Ethernet MAC with dedicated DMA: supports IEEE 1588v2 hardware, MII/RMII
• True random number generator
In short, it knocks the spec for the Arduino Mega into a cocked hat!
The term “up to” means that these features cannot all be used at the same time due to the sharing of pins, but with a bit of planning most of them can. See the datasheet for details: https://www.st.com/resource/en/datasheet/dm00037051.pdf

Why this board?
I call it a "development board" because it has less on it that other "Discovery" boards, or STM’s own NUCLEO series; so instructions related to those boards are not usually applicable. It has the basics needed to make the processor work, and is in that sense comparable to Arduino boards or the Maple Mini for the STM32F1. It measures just 58mm x 45 mm — so bigger than the maple Mini or Arduino Micro, but still a little smaller than the Arduino Uno or Mega. It is therefore a good candidate for building into projects.
The processor on this board is the STM32F407VGT6 — i.e. the version with camera interface, Ethernet, 1Mb flash memory and LQFP-100 package. Besides the MCU chip, the board provides a micro USB port fully-connected to the on-chip USB interface (PA11, PA12) and can provide the power supply; a 5V to 3.3V regulator; two oscillators; two push-buttons (one ‘reset’, one for the user program); two LEDs (one for ‘power on’, one for the user program), and jumpers for Boot0 and Boot1. The schematic can be downloaded from http://dubstylee.net/v/wp-content/uploa . 07VGT6.png [Thanks to forum user ‘flodejr’ for this link].

In further posts, I will give validated instructions on how to upload a ‘blink’ program to this board from Arduino IDE on Mac OSX.

Watch this space.

Attachments STM32F407-VGT development board.jpgSTM32F407-VGT development board.jpg (56.72 KiB) Viewed 1164 times

Re: Getting started with STM32F407-VGT6 development board + Arduino IDE + Mac OSX

Post by madias » Fri Sep 28, 2018 6:49 pm

  • Price is more or less equal
  • RAM: 192 VET, 512VGT
  • Flash: 512MB VET, 1024MB VGT
  • 96 (24×4) (main) pinouts VET, 88(24×4 + 12×2) (main) pinouts VGT) — so are all periphery pins broke out on VGT? (has to be checked) + on VET: 5V output AND 3.3V
  • 4 Buttons VET, 2 Buttons VGT
  • VET with additional features: TF SD(IO!) card holder, SPI flash, backup battery.
  • Form factor: The VGT board seems to be very slim
  • smaller LDO on the VGT? (I can’t really see it on the pics, but it looked smaller to me)

Re: Getting started with STM32F407-VGT6 development board + Arduino IDE + Mac OSX

Post by madias » Fri Sep 28, 2018 6:56 pm

Re: Getting started with STM32F407-VGT6 development board + Arduino IDE + Mac OSX

Post by mrburnette » Sat Sep 29, 2018 2:56 am

Seriously?
A better comparison would be a pellet gun to an AR-15. Great bang-for-the-buck. But.

For the vast majority of our community, this is a top-heavy device. offering too much capability for our general user. And, yes, too much is not a good thing. I could see using something like this in a realtime quadcopter flight system, but only 1% of the forum would likely be interested.

Now, to be honest, many of our members are here because the 8-bit Arduinos cramped us too much and the Arduino Due was an expensive jump 4 years ago. At that time, the Maple Mini clone was under $5 U.S.D. We made the jump.

Maybe you need this power, but the Blue Pill boards are under $2 and we have vast amount of experience with it. I want new members who read your intro to know that I would suggest they have three (3) Blue Pills or two (2) Maple Minis rather than one (1) STM32F407VGT6. UNLESS they really need the heavy lifting power.

In the $5 category, I would normally suggest the ESP32 when your project budget can afford the power load during WiFi transmit. On that chip, you get 3 processors, 2 of which are managed by a pre-configured FreeRTOS implementation.

Everyone here loves the STM32 uC’s . but I am an architect, choosing the right part for the right job is not about the biggest, meanest, and fastest chip on the block.

Re: Getting started with STM32F407-VGT6 development board + Arduino IDE + Mac OSX

Post by RogerL » Sat Sep 29, 2018 12:15 pm

In further posts, I will give validated instructions on how to upload a ‘blink’ program to this board from Arduino IDE on Mac OSX.

Watch this space.

Re: Getting started with STM32F407-VGT6 development board + Arduino IDE + Mac OSX

Post by AndySymons » Sat Sep 29, 2018 12:54 pm

Thanks again for your replies! Good to hear from you both, even when you challenge me

Madias, indeed the board is not unknown; as I said, there are plenty of snippets (OK, bigger chunks too) around this forum and I credited ‘flodejr’ specifically. If anything, I found too much information about this MCU on the internet! The problem was sorting out what I actually needed, ignoring red herrings (like flashing a bootloader) and putting it in a sensible order. For the record, this forum is the most helpful and that’s why I am here! I’d like to share what I learn so others in my position can get a program working much quicker than I did – a couple of days for my first F4 blink program. I am also not saying this board is better than other options; depends what you want to do (see Ray’s comments). I got it for a specific project and am pleased with the choice.
I did indeed go for the STLink method (to start with anyway; largely due to postings on this site) and plan to post a step-by-step guide here (if that is appropriate?) of how I did it. I just need to fix a clock speed issue in my blink program. The delay() function seems to make delays about 10 times longer than the number of milliseconds given. More reading called for! I may come back to the USB upload option as there is an interesting challenge there, but it is not my highest priority.

Ray, yes seriously! But not flippantly. I gained experience with Arduino projects using ATMega328 and

32U4 processors first and then went on to the STM32F103 – in both cases first as pre-assembled boards and then ‘bare board’. I support your statement that new users should do the same before ‘graduating’ to the STM32F4. We can call this the “advanced users’ corner” if you like.
Yes, this, or any more powerful board is only needed if (a) you really need a new toy to play with, or (b) you do have a demanding project. In my case it’s a bit of both. I got it for my Light Cube project, mentioned briefly in my introduction. An STM32F407VGT6 will be a master processor for eight STM32F103C8T6 slave processors, controlled by SPI; it will control several peripherals such as Bluetooth data + audio (USB), WiFi (SPI, yes, with its own ESP8266 processor); an SD card (SPI); USB comms with a host; and an RS485/ DMX512 port (serial); it will sample audio and perform Fast Fourier transforms using floating point arithmetic; all in a multi-tasking setup. Yep, not a beginners’ project.
FYI, The STM32F103 slave processors use a 24-bit shift-register / constant current LED sink over SPI and a multiplexer plus discrete power electronics to control the LED matrices. I switched to the STM32F103 for the exact reasons you mentioned – in my case specifically because the ATMega328 cannot go fast enough to service eight rows of LEDs and achieve 8-bit intensity resolution with bit angle modulation. I only got it to 4-bit resolution even with direct register manipulation in assembler (an interrupt routine of under 20uS). According to my calculations, I should get to 6- or 7-bit resolution with the STM32F103 and I reckon I don’t want to pay for more than that. It’s also useful that it has two hardware SPI ports, so I will not need to resort to software SPI to communicate with the master. I didn’t say much about the F1 on this forum because it is well-covered, and I had no trouble getting it working! I’d be happy to share drawings and calculations if you are interested, but that may be a bit off-topic for this forum. I am also working on my own blog but have not made it public yet.
Thus, “knocks the spec for the Arduino Mega into a cocked hat” was not a testosterone-driven craving for the “biggest, meanest, and fastest chip” (there will always be bigger and better – I could have got the 208-pin version, or an H7!), but my shorthand for saying “having done the calculations for the design for my project and carefully studied the specifications for candidate processors, including the Arduino Mega, I concluded that the STM32F407VGT provides the best value for money in terms of processing speed, ADC resolution, the number of peripherals supported and number timers and interrupts available. It also makes sense, since I am now using STM32F103 slave processors, to use an STM master processor, so the whole project is STM based. This board is the most suitable for my prototype project because it is small, without superfluous peripherals I don’t need, has four mounting holes and allows me to solder my own headers. And it’s still pretty cheap at under US$10.” Maybe I should have said that in the first place
I am a retired engineer, not an architect, but similar rules apply. The optimist says the glass is half full; the pessimist says the glass is half empty; the engineer says the glass is twice as big as it needs to be


Источник: stm32duinoforum.com