I have been using an 8-bit AVR MCUs to build line-follower robots with students for a few years now. Now I would like to step up to an ARM Cortex-M3 because I’d like to add some more CPU-intensive features like odometry and sensor fusion.
The requirements are:
8 analog inputs,
4 PWM outputs,
2 quadrature encoder inputs,
Self-programming wirelessly without physical access
to the robot.
Multiplatform toolchain + IDE (OS X, Linux, Windows).
The steps I’ve taken so far are:
I’m using this STM32F103C8 based board. I believe this MCU has everything I need, including the 2 x QEI which I planned to implement in software but this one happens to have it in hardware, so great:
I’ve followed this to set up my toolchain + IDE:
I’ve found that the documentation for this chip is scattered among a number of PDFs, which I downloaded:
STM32F103x8 datasheet http://www.st.com/st-web-ui/static/active/en/resource/technical/document/datasheet/CD00161566.pdf
Reference Manual http://www.st.com/st-web-ui/static/active/en/resource/technical/document/reference_manual/CD00171190.pdf
A few other documents like AN2606 (memory boot modes), PM0075 (flash programming manual) and AN3155 (serial bootloader protocol), which I’ll probably need in the future.
I also downloaded the STM32F10x standard peripheral library, but that in turn recommended me to get the newer STM32CubeF1, which I believe is just a marketing rename of the above, so I got both:
Finally, I’ve also got “The Definitive Guide to the ARM Cortex-M3” by Joseph Yiu, which I’m reading as I wait for the boards to arrive.
My questions are:
I’m a bit overwhelmed by documentation, to say the least, and I’m not even sure I got it all. For example, the datasheet and the reference manual state that the chip has 3 timers capable of quadrature encoded inputs. But, I can’t find documentation of the registers that control the timers anywhere in the PDFs above. What am I missing?
Should I use the (older?) Standard Peripheral Library, or the (newer?) cube thing? What’s the difference? I understand that both libraries save me from manipulating registers directly and are the recommended way to go. Am I right?
Where is the documentation for the libraries (besides the embedded doxygen comments, which are nice and all but I’d rather have a searchable html/pdf)?
I chose Eclipse + GCC ARM + OpenOCD as my toolchain because I consider this is the only option that will run on the 3 main OSes without code size or other limitations. Are there any more options?
Page 324 of the Reference Manual has details of the encoder interface using TIM1 and TIM8.
– Leon Heller
Dec 13 ’15 at 12:14
May I suggest Embedded Systems – Shape The World ARM-Cortex-M3, but it is from TI. Also I was able to configure Eclipse + GCC ARM + OpenOCD for ubuntu it was rather tedious, and not overly reliable at least me.
– Mahendra Gunawardena
Dec 13 ’15 at 14:11
ARM-gcc solutions are in general quite stable, and about the most portable option out there. Emphasis tends to be more geared towards builds driven by a Makefile or build automation, so integration with existing organizational software development practices is excellent. What IDE (if any) to edit in and drive experimental builds with tends to be a much more personal decision, and one which doesn’t necessarily see as much tool-development effort put towards it. Personally, the last thing I want to have to deal with is a target/toolchain which assumes I will change IDEs just to work with it.
– Chris Stratton
Dec 13 ’15 at 22:59
As it comes to datasheets they are indeed divided. “Reference manual” is complex descriptions of how to do things, configuration and detailed considerations about the whole MCU. “Datasheet” is on the other hand only a brief description of MCU features, pinouts, packages etc. There is also very helpful document for every STM32 line (F1,2…7) “Getting started with STM32F7xxxx MCU hardware development” which provides you with many informations if case you would like to design a custom board.
In comparison to AVRs, registers descriptions are sometimes put a bit aside from main description of particular chapter.
STM32CubeMX is not a library, just a useful program from ST, which enables you to set pinouts, its configurations, set systems clocks etc and then, at the end, generate a code and the whole project. The project can be generated specially for Eclipse (System Workbench for STM32) in which you just import this project and you’re ready to go.
The new library is HAL (“hardware abstraction layer”) and try to use it. That’s the new thing and sometimes it’s hard to find examples on the Internet but don’t teach your students outdated technologies. HAL is convenient to use and has documentation, so I think it’s better choice.
Which library? Anyway it shouldn’t be a problem to google them, I think.
Even if you would like to use only one OS (like Windows), Eclipse (AC6 = System workbench for STM32) is – I think – the best option. There is for example Keil’s uVision 5 – but that’s really terrible IDE – it lacks most of features IDE should offer (refractoring, click-and-search, proper error checking, finding references and many, many more). So, all in all, the Eclipse is pretty much the only reasonable choice for IDE for STM32.
Actually, you can use just about any IDE which can be made to drive an external compiler.
– Chris Stratton
Dec 13 ’15 at 22:55