Daily Archives: May 29, 2014

STM32CubeMX and STM32F series MCU

Since the release of STMicroelectronics the STM32CubeMX V4.2 app on April 30, users have capability to create a Cube project based on an evaluation board (I use STM324x9I_EVAL1 and STM32F429I-DISCO boards). This is a fantastic capability for prototyping where users must contend with an existing board design where many MCU pins are already allocated to on board devices (Ethernet, SDIO, USB OTG HS, USB OTG FS).

I have created some example projects using code generated directly from the tool that specialize some of the example projects bundled with the STM32_Cube_FW_F4_V1.1.0 firmware package.

Each example bundled with the STM32CubeF4 firmware contains a readme.txt file with a detailed description. Any waveforms produced by the example may be viewed on a oscilloscope or a logic analyzer (I use a Saleae Logic 16).

One of my current projects involves generating configurable PWM outputs using synchronized timers in a master-slave configuration (a common task). I call the project dual phased PWM (TIM_PWMDualPhased.ioc). It is a baseline project that may be extended for any number of uses such as lighting control, motor control, parametric testing and so on.

As noted in the ST forums, the learning curve for this microprocessor is a bit steep (I’ve used TI MSP430 & CodeComposer as well as Microchip PIC MPLAB 8.x & MPLABX – and agree).

Even if you are experienced with embedded MCUs, plan on a couple of weeks to digest the user guides and datasheets and self train on STM32CubeMX. It is best to work through as many examples as possible, then attempt a project based on a STM32CubeMX evaluation board baseline configuration that is extended to meet prototype needs.

Before designing a prototype, be sure to spend sufficient time with the STM32CubeMX pin assignment and IP configuration.

Consider peripheral clock speed needs on both the high speed and low speed peripheral bus. The STM32F429NIH part (STM324x9I_EVAL) may operate SYSCLK at up to 180MHz. If the APB Prescaler is set to divide by 2, this presents very high clock speeds to devices on the low speed peripheral bus that may exceed some peripherals’ operating limits.

Users may code directly to the HAL library API, but in prototyping it is much more efficient to use the STM32CubeMX tool. Generated code may contain bracketed user code sections that are preserved as configuration changes are made and code is regenerated.