How to use state machines generated by Sinelabore with the CubeMX tool from STM

This example shows how easy it is to add statemachines to STM32 CubeMX projects.

The example was created for the STM32F103C8T, for which very cheap eval boards are available.

The graphic shows the typical development flow for a CubeMX project and where the Sinelabore State Machine Generator comes into play.

 Example project generated with the CubeMX and Sinelabore

In the example, CMSIS RTOS API is used with 2 tasks, a message queue and a timer. The state machine runs in Task02 and receives its events from the timer callback function cyclicTimer0Callback. And also from the default task. The state machine is kept simple and generates a blinking pattern that is terminated after some time by a FailSafe event.

The Statemachine was created with the integrated Statediagram Editor. To modify the machine, start the editor, load the model and regenerate the code after your changes.

Follow the steps below to create the example itself. It is assumed that you have installed the GNU Arm compiler tools and a debug interface. Links to the tools you need can be found below.

Now you can call make and flash the created elf file into the board with the debugger.

In one console run the debug stub;

In another console run the debugger:

The ARM Tools and CubeMX make it super easy to get started with the STM uC family and the Sinelabore Statemachine Generator completes the toolschain perfectly.


Links