cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 BSP Documentation?

Terence D
Senior
Posted on January 12, 2018 at 03:14

I've just purchased an STM32F469 Discovery development board.  I've got the latest version of STM32Cube and able to build and run various examples on the board.  What I'm not finding is some decent documentation for the BSP drivers. 

There is of course the STM32469I-Discovery_BSP_User_Manual.chm located in Drivers\BSP\STM32469I-Discovery\ but this is pretty basic Doxygen documentation generated from the headers and not really a 'how to use' document.

Does any 'how to' document exist for the BSP drivers?  I would love a document that explains, for example, the basic initialization steps necessary to use the LCD screen on the board.  Just some basic explanations of how to initialize like 'first call BSP_LCD_Init(), then call BSP_LCD_LayerDefaultInit(), etc'.

Anyone know if a document like this exist?  Googling is turning up nothing.

#stm32 #lcd #stm32f469 #bsp
1 ACCEPTED SOLUTION

Accepted Solutions
Posted on January 12, 2018 at 08:56

You are not the first one;) The problem is that ST does not generate code for the BSP using CubeMx so the examples provided for the BSP are diffucult to integrate with the new project (I guess it is your ultimate goal)

I prepared several CubeMX project file for a few disco boards e.g.

https://community.st.com/0D50X00009bMM6pSAG

 

And prepared a procedure how to handle BSP in Cube:

https://community.st.com/0D50X00009bMM6QSAW

 

View solution in original post

9 REPLIES 9
Posted on January 12, 2018 at 08:56

You are not the first one;) The problem is that ST does not generate code for the BSP using CubeMx so the examples provided for the BSP are diffucult to integrate with the new project (I guess it is your ultimate goal)

I prepared several CubeMX project file for a few disco boards e.g.

https://community.st.com/0D50X00009bMM6pSAG

 

And prepared a procedure how to handle BSP in Cube:

https://community.st.com/0D50X00009bMM6QSAW

 
Posted on January 12, 2018 at 17:30

Bogdan - Thanks for the reply and helpful links.  So, I take it that it is largely correct to assume that people/firms are not using the BSP code in production (real world) software, right?  And are instead likely using the HAL or LL APIs?

Posted on January 12, 2018 at 17:48

I am a hobbyist - LL drivers require more understanding of the underlying hardware. I am just switching to LL because I can save a lot of memory.

ST wants SPL (previous library, before HAL/LL era) users to switch to LL. They released special tool for this purpose. So I guess professionals will use LL in the future.

I guess professionals use own libraries closed to LL levels. HAL consumes to much resources (memory at least). Switching to LL is really useful if you want to understand what is going on under the hood - I am spending a lot of time on debugging when trying to use LL drivers because many times I do not know what driver to use.

But the real answer (what drivers are likely to be used by professionals) may come from real professionals like

Turvey.Clive.002

Posted on January 12, 2018 at 19:17

I view CubeMX as a rapid prototyping method, ST has their BSP model to suit portability across DISCO, NUCLEO and EVAL boards.

In the more practical sense people aren't selling products which bolt a DISCO board into a box and proclaim 'job done'. There is going to be custom hardware and custom software, and how much of the BSP you use and discard depends a lot on expediency and whether that fits into the existing corporate methods for product development. ie the migration to a new product is likely to look a lot more like the previous product than a disparate paradigm some other manufacturer invented.

In the commercial sense you can't do this when the wind blows in the wrong direction

void Error_Handler(void)

{

while(1);

}

The code as provided has zero accountability for failure, and if you ship it to end customers there are going to be zombies at your door, and a tech support department coming after you with pitchforks and torches. Bosses are generally uninterested about why it is someone else's fault your product sucks. There is a disclaimer in the license which basically states 'you use it, you own it'.

My expectation is that most corporate users would have a handful of people create a proof of concept design, pitch that to management, and then take a much larger group and with more time and specific goals (budget, build cost, sell cost), and refactor the snot out of the code and design.

If you like the BSP, and haven't committed to a specific board or chips, it will likely provide a lot of flexibility. You need to review the BSP examples and the level of abstraction ST is shooting for, and then cherry pick and modify the parts you need, or require specific adaptation to the board and display, etc that you want to use in a final product. You work out the kinks in your design, or test areas of the design where new parts can be plugged into existing working boards before committing into your own.

Writing extensive documentation for the BSP is dull work, and not going to be done by the people you'd want to write it, nor in a way that is super helpful or timely. Be a chameleon, absorb the examples, and create something that reflects what it does in the context of your own use case. Need a new display, find the closest match in terms of signalling or controller, fork the example and plug in the specifics from the datasheets and manuals. Do it incrementally based on your ability and comfort level, testing and verifying as you go.

When you have everything functioning take a step back and take an overview about what it took to make it work, and what parts are extraneous. You might determine that the HAL is too bulky and gets in its own way, and then you'll look at if things can be done more efficiently with the LL.

Other corporate users, where there is legal liability for failure, will have rules about writing every line of code that goes into a product. Others with existing libraries might port those onto the STM32 architecture rather than adapt to ST's models and paradigms.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Pavel A.
Evangelist III
Posted on January 12, 2018 at 20:40

I would love a document that explains, for example, the basic initialization steps necessary to use the LCD screen on

> the board.  Just some basic explanations of how to initialize like 'first call BSP_LCD_Init(), then

> call BSP_LCD_LayerDefaultInit(), etc'.

> Anyone know if a document like this exist? 

While it's not a document, a project 'skeleton' generated by CubeMX  contains the initialization code, in a workable order. Unfortunately this is not 100% intuitive, I had to make and throw away half dozen of Cube sketches before understood (hopefully) how to get a usable result.

For custom components like so called 'BSPs', you just look at the example projects and then drill into the sources.

As to the size of HAL code vs. LL: yes it is fatter, but not too much. It

 matters when you use a 32 KB limited teaser version of Keil. Most demo projects fit in this size. By the time you hit the limit, you need to learn enough to be able to kick the greedy guys out and switch to a truly free toolchain. Or give Keil or IAR the money

-- pa

Posted on January 12, 2018 at 19:52

Turvey.Clive.002

Thank you for sharing your experience and thoughts. I am watching your posts for some time and I am impressed. You are so patient, you are answering sometimes very stupid questions even though it takes a lot of time. I enjoy this forum very much mostly because I can read your posts and few others competent people.

We hobbyist are very lucky having free support much faster than any regular support you may have from vendors ( I am network engineer working with many vendors all over the world). Thank you!.

Posted on January 12, 2018 at 20:50

Excellent post Clive!  Thank you for sharing this insight into how professional embedded software engineers might go about using existing libs, or writing new code, to accomplish their goals.

idrissmc
Associate II

can someone helps me how to use the LCD on the STM32F413H-Disco, I want to display a message on it.

Have you got some suggestions please?

thanks

I haven't done much with my STM32 boards lately. I did mess around with the STM32F429 some though and made a ball bounce around the screen. The code is on GitHub if interested: https://github.com/tmdarwen/STM32/tree/master/STM32F429/BouncingBall

I'm not 100% sure about this, but I'd think for displaying text you're going to need to either make an array of pixel positions for each letter of a font or find some that someone has already created or maybe an STM32 SDK has these already??? For example, I recently purchased this OLED display from Adafruit. Fortunately they have an open source lib for graphics that allows you to easily display text:

https://github.com/adafruit/Adafruit_SSD1306

https://github.com/adafruit/Adafruit-GFX-Library

Hope this helps at least a little.