cancel
Showing results for 
Search instead for 
Did you mean: 

CubeMX and CubeMX Example programs

Posted on May 08, 2016 at 11:07

It is far from intuitive how to re-create the functionality of the CubeMX example or Application example programs using CubeMX. So why are they part of the CubeMX repository environment.  For example, I am currently trying to integrate an application based on the F746 Discovery board using the LCD display.  I am able to easily compile and run the ''Hello World'' STemWin Application example. However, if I try to initialize the board and project starting from a CubeMX framework, it is far from clear what stuff needs to be added manually or otherwise to integrate the BSP support, STemWin ligraries, etc. I give this as an example however this is true for ANY of the CubeMX example programs that use BSP files and other supporting configured example code.  Has ST or anyone else solved this and shared their results?  And how are these ''CubeMX'' examples by any definition?

#s
4 REPLIES 4
Posted on May 08, 2016 at 13:12

They are HAL examples, CubeMX is a rough framing tool, and at some point you have to take the output and polish it into something usable.

Why are they HAL examples? Probably so they aren't as board/chip specific, and they are more complex than a point-and-click interface can be expected to configure.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Walid FTITI_O
Senior II
Posted on May 09, 2016 at 11:16

Hi bauch.aaron.001,

STM32CubeMX is a graphical software configuration tool that allows generating C initialization code. It reduce the timer spent by user to identify the MCU 

that best meets their requirements (core architecture, features, memory size, performance…) and develop the basic configuration of his application. It optimize the timer taken

to migrate to new platforms and update the C code to new firmware drivers adds unnecessary delays to the project.

STM32CubeMX graphical interface performs the following functions:

  • Fast and easy configuration of the MCU pins, clock tree and operating modes for the selected peripherals and middleware
  • Generation of pin configuration report for board designers
  • Generation of a complete project with all the necessary libraries and initialization C code to set up the device in the user defined operating mode.

The project can be directly imported in the selected application development environment (for a selection of supported IDEs) to proceed with application development

It contains a consistent set of middleware components such as RTOS, USB, TCP/IP, Graphics. Some packages like BSP and Stemwin still not supported in the code generation.

It should be added manually, by the user, to the project generated under project's workspace.

For more details, Please, refer to STM32CubeMx user Manual

http://ds.arm.com/media/resources/db/chip/st/stm32f4series/DM00104712.pdf

.

-Hannibal-

Posted on May 11, 2016 at 07:28

Hi Hannibal,

I am quite aware of what CubeMX is and have ben using it and debugging it for a few years now on several of your MCU families.  I have read the user manual you reference and it does not provide any help in actually realizing any implementation implied by your statement:

''

It should be added manually, by the user, to the project generated under project's workspace.

''

A nice concept but, if it is possible at all, this is what your examples should show.

It makes no sense to place HAL examples that do not use or work with CubeMX generated code in the CubeMX repository.  This only gives the false perception that they are examples of how to make code based on CubeMX init routines play with the hardware of the reference hardware designs ST provides.  Since CubeMX has the supposed capability to initialize all of the peripherals used in these examples, it would be extremely useful to start with that as examples of using the init code in real systems, with correct parameters for real hardware, rather than using hand-coded init code with no comments and no clear relationship to code generated by CubeMX.  I understand that some of the middleware and the BSPs are not now, and may never be integrated into CubeMX.  However examples of how to combine their functionality manually (as you so glibly recommend the user do) would be instructive and a good debugging tool for ST to see if CubeMX actually works in real-world environments like its customers are struggling with. 

Walid FTITI_O
Senior II
Posted on May 11, 2016 at 11:28

Hi bauch.aaron.001,

Thanks for your contribution. Yes, there is a working plan to align between Hal examples and the generated code from CubeMx to ensure more easy to use for users. Meanwhile, The code generated by CubeMx is considered as a start to figure out the best requirement and configuration typos needed. User can take an example code as reference and import needed functions to its CubeMx project at the user spaces.

-Hannibal-