cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4, Tips for a beginner?

upgrdman
Associate II
Posted on May 24, 2012 at 08:52

I have lots of experience with the Arduino and the STM32F4 is my first ''real'' step into microcontrollers. I've downloaded all of the PDFs and the firmware from the STM32F4DISCOVERY page. They have been helpful but I'm still lost at how to do some of the basics. Reading the demo code helps but it's not all that clear.

Are there any guides that walk you through the process of something simple and explain why each section of code is needed or beneficial?

Are there any libraries that abstract away some of the dirty work? I don't expect anything as easy as the Arduino library but maybe something half way there?

I'm comfortable with C and don't mind doing things by hand if needed. Are they any tutorial collections / videos / books / magazines that are aimed at bringing a beginner up to speed with this MCU?

Lastly, how does the ARM ecosystem work? Will code for one ARM work on another? Do all ARMs share common qualities? Any good books you can recommend?

Thanks!

-Farrell
5 REPLIES 5
Posted on May 24, 2012 at 10:53

Download the STM32F4 firmware libraries, the regular one and the DSP one. They have example code for peripherals, and source code for the libraries. Start by digesting those.

ARM has plenty of technical reference documentation on their site, ST has material covering their unique peripheral set.

Books, Joseph Yiu has several books on the Cortex-Mx series.

ARM compatibility depends on the exact architecture. The Cortex-Mx parts will not run 32-bit ARM instructions (seen on classic ARM7 and ARM9), but will work with the 16-bit Thumb, Thumb 2, or subset thereof. Thumb code from ARM7 and ARM9 will run on an M3 for example, Thumb 2 code will not run on ARM7/9. Interrupt handling is different.

If ARM10/11 are important go read the TRM, the should run 32-bit code and 16-bit code.

The Cortex-M3 doesn't have an MMU, precluding the use of WinCE/Mobile/Phone and full blown Linux.

The STM32Fxxx parts don't natively support SDRAM, and are relatively slow (ie sub 400 MHz - 1 GHz)

If you pick the right architecture/cpu in your development environment the instruction choice will take care of itself.

Download an eval copy of Keil, IAR or Rowley. Personally I'd lean towards Keil, and it has supported projects in most of the firmware downloads, as well as broad board support.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
upgrdman
Associate II
Posted on May 24, 2012 at 22:20

Thanks for the info. Yiu's newest book seems to be on the M3, is code for the M4 just a superset of M3 code, or did anything big change?

Will all M4 code work on STM's 32F4? Is the only difference between the STM32F4 and other M4's the peripherals?

Thanks,

-Farrell

Posted on May 24, 2012 at 23:00

For the most part the Cortex-M3 material will be helpful to understand the M4.

The ST implementation of the M4(F) contains a 32-bit FPU, this is an optional unit, and will not necessarily be present on other M4 platforms. With a suitable compiler option it will build code to handle ''float'' math in hardware, otherwise it will do ''float'' and ''double'' math in software.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
frankmeyer9
Associate II
Posted on May 25, 2012 at 09:59

Will all M4 code work on STM's 32F4? Is the only difference between the STM32F4 and other M4's the peripherals?

 

This topic is only briefly dealt with in the ST datasheets, because it is very well documented on the ARM web page - as clive already mentioned.

The difference between M3 and M4 is quite small (regardless of the FPU), compared to the difference M0 to M3 or M0 to M4.

Posted on May 25, 2012 at 16:41

The thing to remember with ARM is that the designs have a lot of optional modules and features, which the user of the design can cherry pick. For example very low gate count implementation will lose the ETM (Embedded Trace Module).

Beyond the peripherals you'll also need to understand the memory speeds, and that things like flash have suitable wait states. For example Renesas and Fujitsu both have intrinsically faster FLASH implementation, while ST uses the ART contraption to mask the ~35-40 ns speed of theirs.

As a general rule you're always going to want to recompile code for a new target. You always want to understand the hardware being used in your design.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..