New library system built on STM32Fxxx HAL drivers
As you maybe saw, when STM32F7-Discovery board arrived, I switched to make libraries also for this board. And if you want easy libs for this boards, you have to switch to HAL drivers provided from STMicroelectronics.
HAL drivers are basically supported for all STM32 families, so I decided to make a library in a way, that will be very easily to used with any STM32 family, especially targeted to these 3 series:
- STM32F0xx: For very basic and small project can be easily used with powerful peripheral set and with 48MHz is just series device,
- STM32F4xx: For everything else what STM32F0xx can’t done. This family is very supported by users, so having support for this family is great advantage,
- STM32F7xx: This should be only used if you need LCD, AUDIO, USB, TOUCH, FILTERING and some “heavy duty” stuff on single project.
New library system
My new library system fully depends on HAL drivers from ST. Currently I have support for F4 and F7 devices but will add support for F0 also in near future. So, to use my libs for HAL drivers, you must have these libraries on your computer:
- STM32F4xx_HAL drivers included in STM32CubeF4 package in case you use F4xx series
- STM32F7xx_HAL drivers included in STM32CubeF7 package in case you use F7xx series
You have to include all *.c files to your project to avoid any missing functions from my libs. I never checked where they are basically declared because I always add ALL libs for specific package in project and I don’t care where it is, or it is not included.
Second thing, all my libs includes at least 2 files:
- stm32fxxx_hal.h: File, where defines for different family is set up. This file is included in my library section also and HAVE TO be used in any project. It should not be changed, or you may get into troubles. This file then includes F4 or F7 header files depending on define you have selected if family is F4 or F7
- defines.h: Project file, where any change to my library should be done. This allows you to easily upgrade my library file without changing settings you made in library. This file is not included in library section, but every project has its own file where changes for library (if possible) are done. This file must be created by user and can be empty if no changes for library is made.
- Other includes may be done in case that specific library needs any other libraries from me. For example, DISCO library (for leds and buttons) uses my GPIO library.
In order, to get my libraries properly to work, you have to make some specific compiler defines (if it is possible, use these defines in options for target, global defines for your target):
- Specify STM32 family you will use:
- STM32F4xx for STM32F4 series
- STM32F7xx for STM32F7xx series
- And so on..
- Specify STM32 family device you will use:
- STM32F429xx for STM32F429-Discovery board
- STM32F746xx for STM32F7-Discovery board
- And so on..
- Specify some other settings depending to different library you use. You should always check library for possible changes!
All available libraries built for HAL system can be seen here on Github. I will add them to this site when I had some more of them.
On Github account are also some examples, which can be used as reference how to use library in your project.
Let me know what you think about that down in comments. Have a nice coding 😉