Review: STM32F4-DISCOVERY
Name: STM32F4-DISCOVERY
Distributor: DigiKey
Price: ~$20
Evaluation Type: Development Board, ARM Cortex-M4
Application you used the part in: QuadCopter
Was everything in the box required?: The box only contains the board itself, nothing else
What were the biggest problems encountered?: It is hard to find a good but inexpensive or free compiler
Scoring
Product Performed to Expectations: 10
Specifications were sufficient to design with: 10
Demo Software was of good quality: 8
Demo was easy to use: 7
Support materials were available: 6
The price to performance ratio was good: 10
TotalScore: 51/60
Prelude
Yet again STMicroelectronics has expanded their ARM Cortex STM32 processor family with the new F4 series. The new STM32F4 microprocessors contains the ARM Cortex-M4 core, capable of running up to 168MHz giving a total of up to 210DMIPS – and we are still talking about embedded microprocessors!
To help developers get started using the new family STMicroelectronics have decided to make a very inexpensive development board with a lot of on board peripherals and of course enabled to be integrated in your own system as all of the microprocessor pins are brought out to you.
In this review we are going to look at some of the details of the new processor family and especially this new inexpensive development board.
Video review
So to start with please have a look at the Video review where some of the available example projects (demonstration code) will be shown to you in action and the different compiler options will be discussed.
In the video I am talking about both F1, F2 and F3 series. In those cases I actually meant F0, F1 and F2 series, whereof the F0 is the entry-level series.
The STM32F4 series
As I said the new STM32F4 series of microprocessors contains the ARM Cortex-M4 core and they are able to run at up to 168MHz. With some tweaking and overclocking this might be increased even more. This maximum frequency is over doubled compared to the other Cortex-M3 devices in the STM32 family.
Currently the STM32F4 microprocessors come in two flash size variants, 512KB and 1MB. Only having these two large sized versions is also a big change compared to the other where the most standard where 128KB.
On the chart above you can see the overall difference of the different STM32 families.
Because of the change to the new ARM Cortex-M4 core it also becomes more standard to add a Floating Point Unit. So this has also been added to the new STM32F4 series which makes it much faster to do floating point calculations such as FFT analysis etc.
Therefor we also decided to use this board in our QuadCopter project as it performs a lot of floating point calculations in the sensor fusion and orientation algorithm.
For FFT analysis and other DSP related things another feature has been added to this family too – a real DSP core.
Besides of those extra neat new features some of the other peripherals the new microprocessor series has got is:
- 2x 12-bit DAC
- Over 24 12-bit ADC channels
- Up to 17 timers
- USB OTG = Host or Client
- 10/100 Ethernet MAC – Just requires external Phy
- And much more
The board
The development board itself contains the STM32F407VG, the 100-pin device with 1MB of flash and 192KB or RAM. Besides of the processor in the center, the board also contains a number of different peripherals. In the image below the on board peripherals is listed.
The board is a 2-layer PCB and it is very well laid out with small ‘drops’ on the end of traces. By this look and by looking at the schematic “design” I guess the design has been done in Altium Designer.
The bit of the design that makes it a bit more complicated is that all the microprocessor pins has been brought out to two 2×25 male connectors. These connectors makes it much easier to use this new STM32F4 microprocessor in your own projects as you don’t have to make your own PCB and solder the TQFP chip to that.
You would actually be able to make a custom design with a simple thru hole prototyping board – similar to what we did with the STM32 STAMP board from Futurlec.
Board testing
So to test some of the peripherals we decided to give the example projects a shoot. A brief description of the available example projects can be found below.
In the video review above some of these examples are being demonstrated. So to see the example projects in action please have a look at the video.
- Demonstration: This is the demonstration that is pre-programmed into the board when you get it. This example demonstrates the Accelerometer and LED functionality by indicating how much you tilt the board using timer outputs for the LEDs. This example also shows the USB OTG Client functionality as it will enumerate as a USB HID Mouse on your computer and the mouse will move according to the tilt of the board.
- Audio_playback_and_record: This demonstration is divided in two parts, an InFLASH and an USB_KEY. The example demonstrates how to use the Audio DAC to play sampled audio data, either pre-programmed into the flash or recorded to a USB Memory stick as a wave file. The recording is done using the on-board chip microphone, and the USB Host functionality of the USB OTG is used to connect to a USB Memory stick to save the wave file.
- FW_upgrade: The firmware upgrade example is actually a USB Memory stick bootloader, making it possible to program the device (upgrading the firmware) by putting the binary firmware file onto a USB Memory stick and pluggin it into the USB OTG connector. The bootloader will then program the binary file into the flash and reboot the device.
- Peripheral_Examples: The peripheral examples folder contains 19 different examples on how to use the different chip peripherals like ADC, IOs, DAC, Timers etc.
Compiler options
I think the biggest issues I had getting started using the board were actually finding the right compiler. The example projects provided by ST supports four different compilers out of the box: IAR EWARM, Keil MDK-ARM, Altium TASKING and Atollic TrueStudio. All these compilers are more or less expensive but you can actually find free alternatives.
On ST’s homepage they recommend their users to download and use the Atollic TrueStudio compiler. The Atollic TrueStudio relies on the GNU GCC and consists of an Eclipse based IDE with project generation feature, register view etc. At the time where we got the board a Lite, no-code-limited version, of the Atollic TrueStudio STM32 were available. The only limitation were in debugging where you could only have one breakpoint placed at a time. For us this wasn’t a problem and we really loved this free but very powerfull compiler.
Unfortunately Atollic have now decided to combine their other ARM compiler suite with the STM32 one, which means that the Lite versions has also been combined. The Lite version of the ARM compiler suite is limited to 32KB of flash but has no debugging/breakpoint limitations. I think this decision is very sad because the free IDE and compiler combination were great for hobbists who could develop as large applications as they want.
As an example you should be aware that you are not able to compile the Audio InFLASH example with the new Atollic TrueStudio for ARM, as it uses much more than 32KB of flash. Maybe you can still find the STM32 Lite version of Atollic TrueStudio out there, but I think the problem will be the licensing as it requires a web-license even for the Lite version.
Instead you could have a look at other alternatives. ST has made a list of some of the compilers you can chose from but I have limited this list to the following five:
- Atollic TrueStudio
- RKit-ARM with Ride7
- Rowley CrossWorks
- IAR Embedded Workbench for ARM
- Keil MDK-ARM with Keil uVision
- CooCox IDE
CooCox IDE – A free compiler alternative
I will briefly talk about the last one as this one is the free but promising alternative to the other more or less expensive compiler suites. The CooCox IDE also relies on the GNU GCC compiler which device support is constantly being updated. The IDE itself is also Eclipse based and it integrates nicely with many different programmer and debugger adapters, fx the ST-Link.
Today (1. April 2012) version 1.4.1 of the CooCox IDE were released, adding support for the STM32F4 family. This makes it a great compiler suite for use with the STM32F4-DISCOVERY board.
The IDE comes with a project generation feature too so it is very easy to get started making your own projects, as it can also include the necessary CMSIS and booting files for you if you like.
As for what the example projects regards you should actually make any changes to the code. To use them in CooCox you should simply create a new project with the booting files and then add all of the sources, including the libraries from lower level folders. Finally you should remember to add the include paths and symbols/definitions and you should be good to go.
The CooCox IDE requires the GNU GCC to be installed as a seperate package. On Linux this is a pretty easy task as GNU GCC is built for Linux. On Windows this is a bit more complicated, though GNU GCC has already been crosscompiled by many different people. On the CooCox homepage you can download their version of the crosscompiled GNU GCC, though this version is relatively old so it doesn’t support the new STM32F4 family.
Instead you should download the latest YAGARTO GNU ARM toolchain, install that and point CooCox IDE to that – then it will work.
Good to know
As a final note I will let you know that you should remember to change the automatically included “system_stm32f4xx.c” when generating new projects. In this file the different PLL settings are set, and as the standard settings are using a 25MHz HSE value (oscillator input) we have to change these. This is done in two simple steps.
1. In the “system_stm32f4xx.c” file you should change the following line
to
In the project Configuration dialog you should add the following symbol to the “Defined symbols” list
A sample project for the CooCox IDE, where one of the on-board LEDs blinks one time at a second, can be downloaded here: LED Blink example for CooCox
Pros and Cons
Pros:
- Powerfull ARM Cortex-M4 processor with FPU
- On-board USB programmer and debugger
- Easy access to all I/Os
- Well documented examples
- Good peripheral libraries provided by ST
Cons:
- Hard to find a good and reliable compiler/IDE
- The demonstrations can’t be used out of the box with any free compiler/IDE
Conclusion
So to sum up the STM32F4-DISCOVERY board is a high-quality but inexpensive development board featuring the latest STM32F4 microprocessor series from STMicroelectronics.
The board comes with a lot of on-board features which makes development much faster and easier. It makes it possible to try out some of the processor features without having to make your own processor board.
The board contains two large connectors for all of the microprocessor I/Os, which makes the board even more usable for your projects. You can make your own expansion boards without having to worry about laying out and soldering the TQFP package of the microprocessor itself.
In short the board and especially the microprocessor on it is working very nicely, and you will definitely see us using this board and microprocessor some more in the future.
Usefull Downloads
Hello Thomas.
What do you think about using Raspberry Pi as quadcopter’s brain?
@Kalys Osmonov
We will soon be getting the Raspberry Pi to review and I will be able to make a better decision by then.
But now I would say that using the Raspberry Pi would actually slow down the controlling routines a bit. Let me elaborate.
As the Raspberry Pi is running a real operating system, an embedded Linux OS, all your applications will be running as multiple tasks. For our QuadCopter we need high priority tasks for the PID filters to be able to regulate the motor speeds fast enough.
Fair enough that the Raspberry Pi has got 700MHz processor and FPU too, but we are not that close to the real processor and I/Os as we will be when using a microprocessor.
Indeed it will be possible to use the Raspberry Pi, and it might even be easy to program because of the Linux, but I think I will stick to my microprocessors when we are not talking about larger systems requiring Internet connectivity, displays, input devices etc.
Hi Thomas,
thanks for your review, I also have a STM32F4 Discovery board but haven’t had much time to explore it, maybe I’ll follow your recommendations.
Would it be possible for you to share the code from your previous demos? (Github or other related Opensource repo server)?
Just a quick question, would it be possible do compile the CooCoxIDE project using an opensource cross-toolchain and flash the board, this way you could easily set up and initial project (even with the IDE limitations) but compile it in the command line?
Regards,
Nelson Neves.
@Nelson Neves
Dear Nelson.
You welcome. I really hope you get more time to enjoy all the great power of the STM32F4.
Which previous demos do you think of? Ones from previous projects like with the STM32F103 or projects for the STM32F4? Any specific you have in mind that you would like to be uploaded.
Because yes we’ve already got Github and are planning to release all source codes for upcoming/shown projects on there.
Regarding your question the answer is short: yes. As the CooCoxIDE relies on the GNU GCC as it’s compiler what it does when you click compile is generating the appropriate Makefile and then simply runs the GNU GCC compiler with the right arguments.
I don’t know if it is possible to extract this temporary generated makefile but I guess it might be.
Best Regards
Thomas Jespersen
Hi Thomas,
On your twitter account, you declared that you are able to connect ENC28J60 to STM32F4 Discovery. If you don’t mind, could you please share the project? (Code+Schematic)
Thanks in advance
Opti
@Opti Zyme
Dear Opti.
Yes that is correct, though the code and library is not finished yet for public release.
But if you simply would like to use it for testing or inspiration you can find it here: STM32F4_SPI_Ethernet.zip
Good luck.
Regards Thomas
Dear Thomas,
Thank you very much for your attention. I will try to convert in Keil, if i can, i will post you the code.
😉
Hi Thomas,
Thanks for this indepth review of the board. It was very helpful.
Hi Thomas,
Very informative review of this board. I’m interested in obtaining one, and after seeking a free IDE for it eventually found your post and checked out CoIDE from Coocox.
Above, you said their version of GNU GCC was a bit old and didn’t support the STM32F4? But following their link to install a GCC toolchain (http://www.coocox.org/CoIDE/Compiler_Settings.html) there’s Cortex-M4 support listed there for GCC ARM, the recommended compiler. Locating the GCC ARM project on Launchpad, Cortex-M4 support is listed there still.
Could you please clarify what this means? I’m just more in favor of using ARM’s own GCC over YAGARTO-not that I can tell the difference 🙂
@M.
In the earlier versions CoIDE the Cortex-M4 was not supported. But in an early release version I was testing you could enable the Cortex-M4 functionality by installing another compiler, the YAGARTO one.
Of course the latest GNU GCC ARM found on the Launchpad site supports the Cortex-M4 but now the STM32F4 (Cortex-M4) including different libraries and examples is also supported natively by the CoIDE.
I’ve just installed the latest version of CoIDE myself today together with the GCC ARM and it works perfectly fine 🙂
Regards Thomas
Thanks alot, Thomas! Zooming off to order mine right away!
Great review, Extremely useful. thanks so much!
Hi Thomas,
Any chance on getting a download link to the ‘non limited Atollic TrueStudio STM32’ version?
Thanks in advance,
Bas
@Bas ten Hoor
Dear Bas.
I have the installation file on my computer but unfortunately I don’t think I’m allowed to publish it as Atollic has updated the version.
Go for a search on the internet and look for “Atollic TrueSTUDIO for STMicroelectronics STM32 Lite 2.3.0”
Hi Thomas,
I try you solution on stm32f4 discovery + enc28j60-h
but program stack on:
if( ES_enc28j60Revision() <= 0 ) {
// Failed to access ENC28J60
while(1); // Here stack
}
i cant get revision, but why?
Thx.
Hey Thomas,
Where did you get the project files for the audio record & playback?
@Chris LJ
The Audio record and Playback example can be found within the Discovery firmware package: STM32F4-Discovery_FW_V1.1.0
Regards Thomas
@Nikolay
got same Problem here. Seems to be something with init of enc26j60. did you solve the problem yet?
Hello,
Could ypu please share the pin connection of Discovery to ENC28j60?
You could check the netduino plus 2
this board uses the enc28j60, just download the firmware source
beware it uses a LQPF64 pins chip not the LQPF100.
@Vishal K M
The connection between the STM32F4 and an ENC28J60 module is a simple SPI connection.
For our project it has to be connected to the following pins:
Regards Thomas
Hello,
I have been trying to alter the usb demonstration project for a while (weeks actually) into a gamepad. So if you plug it in your computer, the computer should recognize a hid gamepad.
But as soon as a try to change the descriptor from mouse to gamepad the computer marks it as non functioning. I would really like to get this to work, and I have tried changing almost everything but to no avail. Could you have a look at it?
Regards,
H. Smeitink
@H.M.
To modify the HID example to become any other devices you are correct about changing the descriptors.
Though these descriptors has to be changed in a very special matter and you have to change several values including the PID, VID and type descriptor.
Please have a look at the following Microchip example on how to make a USB gamepad: http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1824&appnote=en011980
From this PDF you should be able to extract the necessary descriptor values.
Regards Thomas
I actually fixed it, I was right to just change the descriptor, but I also had to unistall the drivers in windows, after I did this it worked right away
Thanks for your help
Thank you very much, I will try to connect with ENC28j60
What’s a good IDE to use with STM32F3… I understand that there is a limit to 32Kb of Flash code memory, but is there a way around that.
@Sam
Yet again I would recommend the CooCox CoIDE as they have JUST added support for the STM32F3 devices as well.
Regards Thomas
I have the same problem as Nikolay and elec8Blu. I can’t find the solutuion.
Did you or anybody ?
@Ferdezo
Apparently the code stops before the initialization of the ENC28J60 chip due to a problem with the revision/version check of the controller.
Which board and chip revision do you have? You might have to check the ES_enc28j60Revision() command to see if it’s just another revision of the chip that you have, which makes it stop the initialization.
Hi Thomas,
did You ever finished the STM32F4_SPI_Ethernet
regards
Joerg
@Joerg
Hi Joerg.
What do you mean with finished?
Doing more debugging of the project and implementing more features? No unfortunately I didn’t do that and don’t plan to.
A lot of new devices making Ethernet and WiFi connectivity much easier has come to market the past half a year due to the growing Internet Of Things industry. The prices for these modules are therefor also coming down, so it doesn’t make a lot of sense any longer to use the ENC28J60 module with these new modules available!
Regards Thomas
@Thomas Jespersen
Hi Thomas,
I am having some issues with getting a good data rate in and out of a DE0-NANO unit (FPGA). I need to pump a live 10mbps video stream into an FPGA or microcontroller at one side of my system and be able to extract a similar rate at the other side of the link. I have a STM32F407VG Discovery board also for use. I will have to use UDP protocol for the ethernet interfaces and custom protocols for transit of packets between the two sides of my link.
My question for you is: how much time/trouble in man-hours was it for getting to where you did with interfacing STM32F407 Module with Stm32f4Discovery. Is it a few hours of playing or well over a week? or month? I have much more serious aspects of my capstone to work on if it is liable to really take long. I am fine with manipulating at register level, assembly and C so I am presuming it will all be easy enough. Some kind of heads up on whats to be expected would be well appreciated!
@Bouen
Hi Bouen.
What module are you referring to?
For the general use of the STM32F4DISCOVERY boars you can get quite far in a day, just trying out the example projects.
But for what sounds to be quite a resource and speed intensive application that you are thinking of, including high speed Ethernet, this would definitely require a lot longer time to develop than just a week.
Not to mention that I am not sure if you can achive 10mbps processed throughput!
Best regards
Thomas Jespersen
Hello,
There are GNU Tools for ARM Embedded Processors, here:
https://launchpad.net/gcc-arm-embedded
and also the source code for an implementation of a standalone native code Forth that runs on ARM Cortex M chips: http://mecrisp.sourceforge.net/ , nice work !
Best regards !
Petro
Hello everyone!
Great article. If anyone is interested, recently, ST launched a free GCC STM32 integrated development environment called System Workbench for STM32. Just blinked the discovery board leds and it seems to work just fine. Here’s the link:
http://www.openstm32.org/System+Workbench+for+STM32
Another thing, they also developed a code generator with a graphic user interface that generates all initialization code for IAR Embedded Workbench, Keil MDK-ARM, Atollic TrueStudio and SWSTM32 (the free gcc IDE I just told you about). The code generator is called Cube:
http://www.st.com/web/catalog/tools/FM147/CL1794/SC961/SS1533/PF259242?s_searchtype=partnumber
Have a good one!
This group STM32Duino has ported libraries to the Arduino IDE. Probably some would turn their nose up at that but for people like me I don’t need to learn yet another IDE or compiler and it’s quirks. I may yet try out CooCox IDE though.
Hi , does any one have an idea how to work on the audio jack on stm32f407, or the functions HAL i should use, or i any onechave an example of its code, plz help.
@Hussien kazan
Please take a look at the STM32F4DISCOVERY board firmware package which includes 22 example projects among them an Audio project demonstrating how to use the onboard DAC connected to the Audio Jack.
Hello Thomas.
What do you think about using Raspberry Pi as quadcopter’s brain?
@La Carmen
As an onboard computer it would make sense, however I would not suggest to run the real-time critical control algorithms on a Raspberry Pi.
Hello Thomas,
Thanks for sharing this review about the STM32F407 Discovery board, it is really helpful. Can you or anyone else here help me to implement the RS485 Modbus protocol on this discovery board? The need is to read data from the industrial drives using the discovery board.
@SAJIT SINGH
A quick search lead to the following results:
– https://github.com/MahdiKarimian/STM32-Modbus-SerialDMA
– https://github.com/urands/stModbus
– https://github.com/kiltum/modbus
– https://github.com/eziya/STM32_HAL_FREEMODBUS_RTU
Have a look and see if any of these can be used.
Hi Sir,
I want to know that the three pins of the Audio jack are internally connected to which pin numbers in the STM32F407G-DISC1.
Please help.
Thank you so much.