First STM32F7xx libraries are out!
After one day spending trying to make a good implementation of libraries for future use, I decided to switch to HAL drivers because of STM32F7 line which does not have STD drivers.
So I decided to make libraries that way, that are supported also with STM32F4xx lines. Each line uses HAL driver for it’s version, but all projects are done in a way that you select target in Keil uVision (F4 or F7), click rebuild and everything is setup and ready for start.
Supported devices
For start, I have to say that you need to have installed newest packs in Keil (if you use it) for F7 and F4 lines to be able to use these libraries and projects provided by me. I’ve managed to get properly in working state these boards:
- STM32F4-Discovery with HSE 8MHz clock
- STM32F429-Discovery with HSE 8MHz clock
- STM32F401-Discovery with HSI 8MHz clock
- STM32F439-EVAL with HSE 25MHz clock
- STM32F401-Nucleo with HSE 8MHz and HSI 16MHz clock
- STM32F411-Nucleo with HSE 8MHz and HSI 16MHz clock
- STM32F7-Discovery with HSE 8MHz
My plan is to support F0 series also, because with F4/F7 series you get mainstream power, but F0 can be used for small projects. There is not need for F1,F2 or F3.
Current libraries
So, for start, I’ve made these libraries (Already posted on Github) which are compatible with F4 and F7 lines:
- RCC: For setting up clock control for your board, supporting internal or external clock, support for enabling I and D cache for F7 series
- GPIO: For controlling GPIO pins
- DELAY: For delay functions using Systick and DWT counter
- EXTI: For external interrupts
- DISCO: For leds and buttons for all F4 nucleo board, F4 discovery boards, F439 Eval board and F7-Discovery board
- ONEWIRE: For onewire-based devices like DS18B20
- DS18B20: For controlling/reading DS18B20 temperature sensor
- USART: For communication with UART protocol
- SPI: For SPI communication
- GENERAL: General library for different things
- CRC: CRC calculation unit
- SDRAM: For SDRAM communication on F429-Discovery/Eval and F7-Discovery boards
- LCD: Single library for STM32F7-Discovery, STM32F439-Eval and STM32F429-Discovery LCD boards using LTDC and DMA2D
- BUTTON: To control multiple buttons using STM3Fxxx devices
- FFT: FFT example using LCD
- IWDG: Independent watchdog library
- RNG: Generate random number in STM32Fxxx
- CPU LOAD: Measure CPU load using sleep mode and DWT counter
- STRING: Create strings on STM32Fxxx devices
- ROTARY ENCODER: Rotary encoder for STM32Fxxx devices
- I2C: To use up to 4 I2C peripherals at a time
- TOUCH: For touch controllers on STM32F7-Disco and STM32F439-Eval boards (built-in) or any other touch controller user can imagine with support for touch orientation to match LCD orientation.
- RTC: For internal RTC on F4 and F7 lines
All libraries are tested on these boards:
- STM32F7-Discovery
- STM32F429-Discovery
- STM32F439-EVAL
For now, libraries are only available on my Github account where you can download it with default project for Keil uVision. Libraries are almost fully compatible with my previous for STD drivers on F4xx lines. Only some functions are added/changed because now are used HAL drivers and not STD anymore.
You can select your target in Keil uVision (F4xx or F7xx) and hit rebuild and then download. You are ready to RUN!
I’m waiting for your opinion about that feature supporting more series with single library file.
Example
This is a simple example from my “project template” used for turn on and off leds with button.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
/** * Keil project template * * Before you start, select your target, on the right of the "Load" button * * @author Tilen Majerle * @email tilen@majerle.eu * @website http://stm32f4-discovery.net * @ide Keil uVision 5 * @conf PLL parameters are set in "Options for Target" -> "C/C++" -> "Defines" * @packs STM32F4xx/STM32F7xx Keil packs are requred with HAL driver support * @stdperiph STM32F4xx/STM32F7xx HAL drivers required */ /* Include core modules */ #include "stm32fxxx_hal.h" /* Include my libraries here */ #include "defines.h" #include "tm_stm32_exti.h" #include "tm_stm32_disco.h" #include "tm_stm32_delay.h" int main(void) { __IO uint32_t i; /* Init system clock for maximum system speed */ TM_RCC_InitSystem(); /* Init HAL layer */ HAL_Init(); /* Init leds */ TM_DISCO_LedInit(); /* Init button */ TM_DISCO_ButtonInit(); while (1) { /* If button pressed */ if (TM_DISCO_ButtonPressed()) { /* Turn on ALL leds */ TM_DISCO_LedOn(LED_ALL); } else { /* Turn off ALL leds */ TM_DISCO_LedOff(LED_ALL); } } } |
Check my GITHUB account with new repository for new library system.
Recent comments