Frank's Random Wanderings

STM32F2xx Processor Learnings

I’ve been doing a lot of work recently with the new ST processor, the STM32F2xx family. It’s a Cortex-M3 part running at 120 MHz. It’s a nice part, however I’ve lost a lot of time discovering, well, let’s not call them “bugs”, let’s instead call them “undocumented features” of the part. At the time of writing (Aug 2011) I’ve reported a lot of this to ST, however they have not yet been documented in any errata or updates. So I’m posting everything I know here, in the hope it’ll help others using this family of ST processors.

The next few posts will talk about some of the peripherals of the STM32F2xx family, mainly the DMA controllers and the DCMI port. I’ll also touch on the SDIO SD Card interface. However for this first post I want to mention a couple of things related to “getting help” for these processors, so you can avoid some of the pain I’ve suffered.

ST Web Site

The ST website is found at Sounds pretty simple. For some reason ST breaks their processors down into two groups: “microcontrollers” and “embedded microprocessors”. Given that ST puts ARM-based CPUs in the “embedded microprocessors” section, and ARM Cortex-M3 parts are used in embedded applications, this is where people tend to look. Which is as good a reason as any why they’re not there. The ARM Cortex-M3 parts are found in the “microcontrollers” section of the ST website, and that’s where you’ll find the datasheets, programming manuals, errata, etc.

The very important software, called the “Standard Peripherals Library”, is found in the “Resources” subsection, then look under “firmware”. You will absolutely want this, as it contains start-up code for the processor, examples of how to use the peripherals, etc. It contains a wealth of useful information. Be careful to treat it as example code however, not necessarily production-ready code, until you’ve confirmed it’s completely suitable for your needs. You’ll discover it’s often lacking in error-handling, among other things. However for getting things running quickly, it’s a huge help.

Web Forum

ST runs a forum here:
I’m a little loath to post this link, because I know it won’t last long – the forum address periodically changes. ST has a lot of problems with their forums.

The forum will throw a lot of error messages at you. Like this:

And this:

This is a good one – even their error message contains a spelling error:

Or this crowd pleaser, the “Windows Sharepoint Services” error message:

And a great many more. That’s “normal”. Well, ok, it’s not normal for any decent forum, but it’s normal for the ST forum – it’s not anything you’re doing wrong.

It’s critical for your own sanity that you keep a copy of anything you post to the forum, before you hit the “OK” button to submit your posting. Just doing a copy&paste is probably sufficient. Because you’ll be very unhappy if you take a bunch of time to write your masterful post, only to get a “this page doesn’t exist” message when you submit it, thereby losing all your work.

The forum sometimes crashes and falls apart completely, requiring the entire forum to be rebuilt at a new web address and all the old messages to be copied over to the new site. At the time of writing this happened only a few months ago. So if you see postings that don’t appear to make any sense (missing titles or missing bodies) that’s probably because you’re looking at an earlier posting that didn’t entirely survive the transfer from the last crash. A lot of attachments (code snippets and the like) were also lost in the crash.

The forum has a search function, however the search covers the entire set of ST forums, not just the STM32 subforum. You cannot narrow the search. Performing a search for “PLL” for example, will return many hundreds of responses, covering a broad range of processors, making the search function pretty much useless. You’re better off doing a google “advanced search”, specifying something like this as the website:
At least this way you can limit your results to the STM32 forum.

The forum has some genuinely helpful people on it, and it’s worth getting on there. It’s just that the ST forum software has some real issues, but these tips should help you skirt around the worst of it.

Tech Support

I surmise that the tech support interface is based on the same code as the forum, because in many ways its quite a bit worse than the forum. I actually feel a bit sorry for the ST tech support folks, because I’ve dealt with them a few times and always found them to be very pleasant and helpful. But they’re stuck with this interface every day, and I’ll bet they hear about it. It can’t be easy for them.

The comments made about the many and assorted error messages for the forum, and the necessity to keep a copy of your work before hitting the submit button, also apply to the tech support form. But more so – it appears (in my limited experience) that the ST tech support form throws even more errors than the forum does.

Also, there’s no way to see your posting to the tech support form, or know if they ever received it. So save a copy for yourself, in case you need to re-send it a few days later.

The text entry box is slightly larger than a postage stamp – you can forget about trying to see your formatting. You cannot attach files (like source code, or an oscilloscope screenshot, or anything useful like that) to your submission. Text entry is limited to 4000 characters, so doing a copy&paste of code doesn’t work too well either. What I do is tell them I have these things and can email them – when they reply they provide an email address to send them to. However aside from that, they want all submissions to go through the postage-stamp web interface.

Once again, like the forum, it’s worth using tech support if you need it. I find the folks to be helpful, and I generally see a response about a week after I submit it. If you’re in a hurry this might not be ideal, but if you’ve tripped over a hardware “funny” and can prove it, this is going to be your best bet. For general software questions however, you’re probably better off using the forums.

The Mythical Reset

The ST documentation sometimes uses the terminology “reset” when referring to bits. This can get confusing in places. I asked ST tech support to clarify what “reset” means – does it mean bit set (bit = 1) or bit clear (bit = 0) when talking about the DMA EN bit. Here was their response (3 August 2011):

“resetting the EN bit” means setting to EN=1. … The EN bit is reset (EN=0) …

You know it’s confusing when even their own tech support people can’t tell you if “reset” means a ‘1’ or a ‘0’!

From reading other portions of the documentation, I believe the correct answer is that ST means a bit clear (bit = 0) when they use the term “reset”. Update: ST tech support has now confirmed this: reset means bit equals zero.

That’s it for this post – the next post will talk about the STM32F2xx DMA controllers.

4 thoughts on “STM32F2xx Processor Learnings

  1. Adolf Hiltur

    It’s now 2015 and nothing at ST have changed to the better! Actually it have changed to the worse as ST is ramping up the number of different devices. Documentation for some devices is at staggering rev16 even the device it self is 7 years old yet the manual contains the same errors as they was first written in 7 years ago! Some other manuals is stomping on rev 1 for very loooong times! Also ST have dropped the 500Mbyte HAL bomb on us.

    Tank’s for all the great DMA info Frank it’s really helpfull in way ST newer will provide!

  2. frank Post author

    True, it is a little odd the first time through. It is a pretty common technique though – I’ve seen other processors do essentially the exact same thing. So at least it’s fairly common.

  3. Gordon Scott

    The “reset” gets doubly confusing with interrupts flags, where one writes a ‘1’ to clear the flag to zero.

    Of course that works well, because you read the flags, then just write the data you read to clear them, but it does feel slightly odd to me.

Leave a Reply

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