All STM32F4 libraries

Because there is a lot of libraries I have done, I will make a table with all of my libraries at one place. When new library will be created, it will be posted here. These libraries work on both Discovery boards, if not, it will be specified. Actually, libraries should work on STM32F4xx series of microcontrollers if they have peripherals that are need for library. All STM32F4xx MCUs don’t have everything inside. 🙂 Libraries are tested on my 4 STM32F4 boards:

  • STM32F429 Discovery (STM32F429ZI)
  • STM32F4 Discovery (STM32F407VG)
  • Nucleo F401 (STM32F401RE)
  • Nucleo F411 (STM32F411RE)

Library structure

Every library, that is uploaded and tested, is also described here on my site. Sometimes I upload some libraries and projects on my Github account, but I don’t release them here. This means that they are not yet fully tested and ready to work, they are still buggy probably. So when I describe my library, each post has Dependencies section. There are 2 main lines, CMSIS and TM. In CMSIS section you have specific core modules, that must be included from standard peripheral libraries, TM section is my section. Some libraries requires my other libraries, so in this case they are in TM section.

Source files

Every library is uploaded to my Github account where you can download it. Also, you can download it from table below. They are updated like libraries on Github. If you need hex files from projects, then you have to go to my github and open project folder. When you are inside project folder, you will find project.hex file. Each project has 3 targets included for STM32F4 boards, so maybe currently .hex file is not created for your board. In this case you need to download repository and open project, select target, compile and download. I’m constantly updating my libraries, so make sure you have the latest version, before you ask for help that something is not working. Maybe someone asked before and I already fixed it. If your problem is still not solved, then post a problem and please provide your code which does not work.

I would be glad, if you post a comment and give me a feedback, how and if these libraries help to you at all.

Github clone

If you have any problems porting my libraries into your projects for some reason, you can download my entire repository from Girhub here. On the right side you have link “Clone in Desktop” or “Download ZIP“. This will allow you to directly open my projects and just hit compile and download. Of course, you have to make sure that you don’t use wrong “target” (set correct MCU) and that you don’t use let’s say LTDC library on F4-Discovery, because F407 MCU don’t have LTDC inside, or use DAC on STM32F401 series, because they don’t have DAC peripheral and so on.


All my softwares are published under GNU GPL v3 license. This means that you are allow to modify, share and use my source and other stuff in personal or commercial use. If you modify source code, it has to stay under GNU GPL v3 license too. I reserve a right to shut down this website at any time.

If you want, you can make a donation to my Paypal account and support my work in future. Paypal link is below.



NR Name Description Download
1 Default project Default project for Keil uVision and Coocox Coide Keil uVision
CooCox CoIDE
2 Led and button Leds and buttons for Discovery boards
3 Delay Delay functions and max core clock
4 USART USART library for all USART peripherals
5 SPI SPI library for all SPI peripherals
6 ADC ADC library to read analog voltage
7 DAC DAC library to convert digital value to analog voltage
8 ILI9341 ILI9341 LCD controller driver without LTDC support
9 I2C I2C library for all I2C peripherals
10 STMPE811 STMPE811 Touch screen library for STM32F429 Discovery
11 BUTTON BUTTON library for ILI9341 LCD and STMPE811 touch screen controller
12 ONEWIRE OneWire library for onewire devices
13 DS18B20 DS18B20 Temperature sensor library
14 SDRAM External SDRAM on STM32F429 Discovery board
15 DS1307 DS1307 External I2C RTC Clock library
16 HD44780 HD44780 (and compatible) LCD driver controller
17 NRF24L01+ NRF24L01+ 2.4GHz transceiver
18 ILI9341 LTDC LTDC support for ILI9341 LCD
19 RTC Internal RTC on STM32F4
20 WATCHDOG Internal Watchdog on STM32F4
21 FATFS Read SD card with SDIO or SPI communication on STM32F4 using FatFs by Chan
22 RNG True random number generator for STM32F4 devices
23 MFRC522 Read RFID Cards with Mifare MF RC522
24 USB CDC Device Virtual COM Port for STM32F4 devices
25 AM2301 AM2301 (DHT21) temperature and humidity sensor
26 ROTARY ENCODER Connect rotary encoder to STM32F4
27 GPS Read GPS data on STM32F4 device
28 L3GD20 Measure axis rotation with STM32F4
29 USB MSC HOST Read USB flash drive with STM32F4
30 HC-SR04 Measure distance with HC-SR04 ultrasonic and STM32F4
31 USB HID HOST Read USB mouse or keyboard with STM32F4 device
32 KEYPAD Read matrix keypad 3 x 4 or 4 x 4 with STM32F4
33 PWM Use all timers for PWM on STM32F4
34 USB HID DEVICE Turn STM32F4 into USB HID Device as keyboard, mouse or gamepad
35 LIS302DL/LIS3DSH LIS302DL or LIS3DSH accelerometers on STM32F4-Discovery board
36 DAC SIGNAL Create signals with STM32F4 and DAC using TIM and DMA
37 BMP180 Read atmosferic pressure with STM32F4
38 EXTI External interrupts for STM32F4 device
39 LOW POWER Power consumption modes for STM32F4
40 MCO OUTPUT Output clocks from STM32F4
41 STDIO Use printf and/or fprintf on STM32F4
42 SERVO Control RC servo with STM32F4
43 MPU-6050 Read accelerometer and gyroscope data with STM32F4
44 IDENTIFICATION Read unique ID, flash and revision from STM32F4
45 BKPSRAM Interface 4kBytes backup SRAM memory on STM32F4
46 SWO DEBUG Debug STM32F4 with SWO feature in Cortex-M4
47 CRC CRC calculation unit on STM32F4
48 PWM IN Measure PWM input signal with STM32F4
49 OTP One-Time programmable memory on STM32F4
50 STemWin STemWin for STM32F429-Discovery board
51 DMA2D GRAPHIC DMA2D ST’s Chrom-ART Accelerator for STM32F429-Discovery board
52 ETHERNET Ethernet on STM32F4
53 GPIO GPIO for STM32F4
54 GENERAL General library for STM32F4
55 USART DMA Extension library for USART library with DMA TX functionality
56 SPI DMA Extension library for SPI library with DMA functionality
57 BUTTON Connect buttons to STM32F4xx
58 STRING Dynamic string allocation for STM32F4xx
59 RCC Dynamic PLL settings for STM32F4xx
60 CPU LOAD Measuring CPU load for STM32F4xx
61 SSD1306 SSD1306 I2C OLED LCD for STM32F4xx
62 FFT FFT library for STM32F4xx
63 DMA DMA library for STM32F4xx
NR Name Description

All libraries at one place

About defines.h file

All my libraries include defines.h file. This is file, where you can overwrite default settings for libraries (eg. change pins), so it’s important that you have this file inside your project.



Owner of this site. Also electronic enthusiasts, web developer, 3D printer fan, handball player and more. Big fan of STM32F4 devices. In anticipation of the new Discovery board for STM32F7 lines.

You may also like...

Read before commenting!

Before you make a new comment, make sure you agree with things listed below:

  • - Read post to make sure if it is already posted what you are asking for,
  • - Make sure you have the latest version of libraries used in your project,
  • - Make a clean and grammatically correct written message,
  • - Report as many details as possible, including what have you done so far,
  • - Do NOT post any code here. Use Pastebin,
  • - Do NOT post any error codes here. Use Pastebin,
  • - Specify STM32Fxxx family and used Discovery/EVAL/Nucleo or custom made board,
  • - Make sure your clock is set correct for PLL,
  • - If you are using my HAL drivers, please check this post how to start.
Comment will be deleted on breaking these rules without notification!
  • Shehwar

    very nice and informative….thanks a bunch =)

  • Amit

    After long search about stm32 i found this site most usefull and descriptive, well done. Keep up posting more tutorials.

  • Bican Guzeler

    Your tutorials are very helpfull thanks for that, but i could not find any tutorial about how to add and configure libraries for keil ?? can you add one tutorial just for that ? Thank you so much again

  • Ernest

    Hello my friend, I want know, if you could help me for create a library for a TFT-LCD with driver SSD1963 800×600, I dont know how start.

  • phivu

    Hi, I would like to have one iibrary template like you did and guide me more detailly how to make one project with your library through email or here. Actually, the last time i downloaded stm32f4_dsp_stdperiph_lib but when i apply them into my project, It shows me many errors most of time ( in attached file).

    • You cannot use all .s (startup) files in your project. Only file for which mcu you are working with.

      • phivu

        Ok. I removed unnescessary files and it can operate now. I will test that library in the everning. However, I’m wondering that stm32f4_dsp_stdperiph_lib can be used to program for stm32f401 RE nucleo board?

  • abdurrahman korkmaz

    please somebody can send any example project running on keil without errors

    • Everything is working…
      …go to my github and download everything. From there open Keil project and have fun.
      Make sure you have STM32F4xx packs 2.0 installed

  • Cahya

    Hi, thanks for the libraries, it’s really great and helpful, and it’s much easier than using the code from ST directly.
    By the way, the stm32f4 discovery board has an audio codec, do you have any plan to create a library for this audio chip? That would be great also.

    • Hi,

      I’ve made some tests using this and was working quite good.
      It’s basically hard to make a library for “independent” hardware.

      I think I will make a release for that.

      • Cahya

        That is a good news, thanks for that. Actually, I would like also to do audio programming on the STM32F29 board, but unfortunately ST doesn’t include the audio chip in this board anymore.

        • F429 is “LCD chip” somesort :)) you have lcd here and sound on another. Thats the point of discovery boards. Discover some peripheral on differebt boards 🙂

          • Cahya

            Yes, but it would be really great if this board has both audio and lcd, it could become a multimedia board 🙂
            Anyway, I use your libs with plain gcc without keil, and create a simple stm32f4 project template where other people can use it as starting point:

          • Then eval board is for you :))
            Uf, looks nice.

          • Cahya

            Good idea… but it’s too expensive 🙂

      • Cahya


        I found a nice “audio library” (it is just Audio.c and Audio.h) for stm32f4 discovery board (I think I showed the link already here: It is nice since it is simple to use. For testing, I wrote another music player (read mp3 and wav file) together with your library:

  • Burak

    Thank you very much for the library that you prepared and share to everyone. I always wanted to make something similar but I’ve never had a chance and time to make any. Most of them are commonly used and needed topics. I wonder that are you planing to make any library which is based to HAL driver instead of standard peripheral library? If you are, I am excitedly waiting for it.
    As addition, I use TM Library at STM32F2 based MCUs. It is really easy to migrate.
    Kind Regards.

    • Yes, I will start with them soon. Just waiting for stable HAL release from ST, somewhere in July as I saw on their forum.
      HAL drivers are structured in different was, a little bit “harder” for independent library for peripheral drivers. I have to find a good way to make.
      I’m thinking to make libs in connection with CubeF4. So in CubeF4 you set your pins for peripheral and then you can use my lib.
      Actually, HAL drivers already have everything for let’s say send/receive data over SPI, no need for special commands for that.

      Then, I should make a libraries for external components to connect to STM32.

      Yes, STM32F2 and STM32F4 are almost identical in programming way (AHB and other buses are here-here) and only difference is between M3 and M4 Cortex.

  • Helmi Maulana

    i’m sorry but i still got some problem on how to define the board i use for your projects

  • enrico


    The best public work that i have see for stm32f4 micro!!!

    But the target file for the default keil project are missing in the last update?
    Thanks for your work!!

    • Thanks 🙂

      Hum, how you mean target files?
      You must open project in Keil uVision and do build or rebuild.
      Of course, first select your target there in program.

  • Syrer

    I used some of your libraries for my Nucleo stm32f411, great job indeed. I would like to know how did u add the various targets to the project. I am willing to start with another controller – it may be the stm32f405RG. How can I add this target to the project and keep it in the drop down menu?
    Something like this does not really help:

    • First you need to make a new target.
      Project -> Manage -> Components, Environment, Books…

      There create new target, and give him a custom name.
      Then, you will also need a startup file for your STM32F405 file. It is included in standard peripheral drivers from ST.
      You will need to include this file in your project also.

      • Syrer

        I see you included 2 startup files for the STM32F4-Discovery board. Namely the startup_stm32f40_41xxx.s and the startup_stm32f40xx.s, should I do the same?

        And how about the Defines under the C/C++ tab?
        The last and the first one i have to delete and add the “STM32F40_41xxx”, I assume, right?

        • STM32F411xE this is what you need to remove.

          • Syrer

            and probably only the startup_stm32f40xx.s as startup file 🙂

          • Logical.

  • carlos

    I am testing the examples with TFT, well in files version 1.2 puts it works. see drawings on the screen
    but the same example downloaded from github with superior version does not work, I think the modification of GPIO file making it fail, have been comparing line by line but I do not see failure

    • Yesterday Ive reupload gpio lib to github, because I forgot upload latest version. Try to redowbload github again.
      I have tested LCD and it worked.

  • carlos

    another question, on the internet there any example with stm32f429 discovery together using the TFT and ethernet,

    apparently it’s for conflict of pins, I’ve been watching the pins with cubemix and it is true, but this page,
    say as changing discovery to get
    I have not bought the PHY module, so do not know if it worked, you know something about uniting two examples one of tft and other ethernet is viable?

    • You can use spi for lcd on discovery and will work both.

  • carlos

    I downloaded it again, and it works with respect to tft, that I had found in a store, 7 or 8 tft one euro each, ja ja ja , but no driver, so I wanted to use the LTCD, anyway, knowing that you can use spi is good news

  • Bublo

    Would be great to use your libraries with freeRTOS. It is possible to create simple example project (e.g.Blinky) with freeRTOS using your TM libraries and standard peripherals drivers? Thanks for answer.

  • Vitcho

    First of all i want to thank you for the quality of your website, for your effort, support and generosity.

    But despit all those good library, I can not found a library for Wifi expansion boards (For exemple Discover Wi-Fi).

    I wonder if you are planing to make a wifi library? If you are, I am excitedly waiting for it.

    Best Regards.

    • Hi,

      please contact me via email wit more info about that module.

  • athiranairnk

    Hi, I have got great help from your tutorials and libraries for my project and thank you very much for your efforts. Right now I am in urgent need of MODBUS Master library for STM32f4. I found a slave library but master library is no where to be found. So I ported Arduino Simple Modbus Library to work on STM platform, but still it has issues. Can you please help me with this. If you develop a MODBUS Master library then it would be great. Awaiting your response.

    • Currently im nit ready for this.

      • athiranairnk

        Can you please tell by when you will be free. I wanted the work to be done for my college project.

        • Ouu, so you say for your college?
          Isn’t college point to do something by yourself?

          I won’t do that only for you, sorry.

          • athiranairnk

            can you please share your email id. I will explain. I am not telling to do the whole work. I have done a part. Need your help to solve some problems. And by college project I meant the work we have to submit for academic purpose. Not a project of colleges

          • I won’t share email address here.
            But if you open about section or you check any of examples (libraries), you will see my email there.

  • Marwen

    hi,my project is a pid speed controller with stm32f4-discovery,i need help because i can’t start using this board.please help

  • ritesh

    hii..I have got a stm32f407 discovery board and I have to use it in my project work.
    but the problem is that I haven’t ever work on any microcontroller and I don’t know c programming, but I am very excited to work on this could you tell me how should I start and what are the prerequisites, so that I could be able to write program for my project.
    thank you

    • Hi,

      You can start here.

      • ritesh

        okk, If I start learning c programming and with any 8 bit microcontroller like 8051, then will it be helpful.

        • hari

          You just simply start C programming for embedded systems, may be start with a simple gpio toggle example

    • hari

      Tilen Library is the Best thing you can start off with, He has done a large variety of project , i think he is familiar with all the peripherals in that board, so you can download his whole library and import it to a “Keil u vision” IDE and start programming the board

      Just search in the google “how to start programming with stm32f4”

  • LB IN HB

    Thank you for all the work you have done. I am just starting with the STM32 line and these libraries are making it a much easier transition.

    What would I have to modify to make the libraries work on the other STM32 lines? like the stm32F303 or stm32F107?
    I am using Keil uV5.

    • You have to change low level things like pin handling, register checking and so on.

  • Ilya Yorevich

    Can’t see camera interface driver.
    Can you add STM32F4 camera interface driver + OV2640 jpeg camera driver ?

    • You are right.
      2 reasons for that:
      – F4-Discovery does not have LCD and then I need 2 wiring,
      – F429-Discovery does not support DCMI when using LTDC for LCD on board.

      • Ilya Yorevich

        In fact it is more interesting to use exactly OV2640 and exactly in JPEG mode (OV2640 have JPEG compression on chip and STM32F4 DCMI have a JPEG camera support). So, after picture capturing, you can send it to PC via USART rather then show on LCD. Camera module could be connected to STM32F4 with wires.

        If you some day decide to play with STM32F4 DCMI + OV2640 camera write me — I can send you OV2640 I2C settings (in fact they are closed by OmniVision). OV2640 module can be finded on ebay at cost 10$

        • I will check which camera is on my f439 eval board. Maybe is the same.

        • rboldu

          Hi Ilya!

          I’m working in a project where I’m trying to use the STM32F4 DCMI + OV2640 to create a webcam. In a future I would like to put some “light” image processing on board, but at the beginning I just want to create a webcam and learn. Which resolution do you think that is the maximum that I can use? Also, do you have experience with UVC class?


          • Ilya Yorevich

            STM32F4 have memory limits 128KB SRAM and 64KB cash SRAM. For your code you should reserve 30KB or more SRAM (if more — it is better, because STM32F4 runs very slow when it runs form flash memory, so the better to put your code into SRAM).

            So for single camera frame you can use only ~80KB..100KB SRAM or less. It is around 800*600…..1024*768 JPG frame for OV2640. ANd 320*240 BMP frame.

            PS In fact I’m slightly disappointing about STM32F4 and decide to use another CPU. It’s low end chip because of high resource limitation (same pin sharing between different peripheral, DMA channels limitation, very slow speed when runs code form flash etc and many more). I’m using 10 years older and twice cheaper AT91SAM7S256 and got the same performance as STM32F4 for my application. STM32F4 is only advantage — float point operations and DCMI interface. If you don’t need it, you don’t need STM32F4

          • Can you clarify your speech with sources? I think you are not telling the truth. Execution from flash is 1 cycle. It has 4 stage pipe which allows that.

            What are DMA limitations?
            What are pin limitations?
            Just want objective answers here 😉

          • Ilya Yorevich

            Flash prefetch buffer is effective only in straight line code, but if code is branching (if then goto) instruction execution time is increasing.

            Abot pins limitation — most of pins peripherals are on A, B, C ports, 3-4 peripheral pins on each pin. So despite of ST32F4 has 6 uarts, 3 SPI, 2 I2S, 3 I2C, DCMI etc — I can’t use all of them in same project.

            I spend a lot of time and find a way to use 2 I2S, 2 UART, 1 SPI and 2 I2C only in same project. It is not too much for 9$ IC ST32F407

            About DMA limitation. A normal way — it is separate DMA channel for each peripheral. STM32F4 have shared DMA channels, so

            1) you can’t use DMA data transmission at same time to all peripherals

            2) you should have a complex software which would distribute DMA resources.

            I spent at least 2 month and built a VoIP project with STM32F4 using CODEC, Microphone, 2 UART, 1 SPI — all runs with DMA (also I have use your driver, because I was unable to run HAL), but it is too much time.

            So my final verdict STM32F4 is general use MCU, wih complex and intricate architecture, which is suited in high and mid-ranges cost (not low cost)

          • If you have 64pin device then sure they are on abc pins all.
            I2S,2x uart and 1 spi can all work together with dma if you know how to configure it.

            All that your atmel can do?

          • Ilya Yorevich

            i had use 100 pin count STM32F407VGT6 same as on STM32F4 discovery. Yes – I2S,2x uart and 1 spi can all work together, but I want 2xI2S, 6x UART, 3x SPI, USB and DCMI and all together. And I can’t use it because of pin limitations and DMA limitations.

            And yes — 10-years old 64-pin count 4$ AT91SAM7S256 do same things as STM32F407 for my application and much more because of separate DMA channel to each peripheral, so I will use STM32F4 only if need some DSP calculations and DCMI.

          • Looks like your programming skill is not good, no offense here 😀

            I dont care why you need 6 uarts (probably example to blame stm) but have you heard when for tx, rx irqs? Using dma for real fast things like sound and irqs for slow like uart. But you will now say to me you use 10Mbit uartand you need dma 😀

            Actually, I so dont care :))

          • Ilya Yorevich

            I’m working on home automatization on apartment buildings (security, intercom, light control, custom IP cameras). And always need as much as possible uarts as IC can.

            I use Uart at 4mbs 3G GPRS modem and/or WIfi/Ethernet modem and at 6mbs speed in RS485 mode to send/recieve Audio, Video (M-JPEG) and control data to multiply nodes.

            Why not?

            Also another STM32F4 fail — it has not support for 485 frames. I means that Atmel AT91 has interrupt when uart frame with variable size come in (you don’t know it’s size at recieve moment) — as quickly as 1 byte delay, I was unable to find same interrupt in STM32F4.

            I think if you need high programming skills to do some simple task like send data to several RS485 nodes at high speed, you are use wrong IC. STM32F4 is good MCU, but you know I’m expecting much more at start, and during it’s studying I was find more and more limitations.

          • Werner Pfundstein

            question: have you finished your voip project? i mean: have you a running system with STM32F VoIP?

        • Mike K

          Hi, could you please share with me the code?

          • Ilya Yorevich

            you can check Arducam project. Just google it. I have got OV2640 setup data from here from Github.

        • ferkad

          I’m looking for a way to configure OV2640 in JPEG mode. Can you send me your OV2640 settings. By the way it’s a good subject for an interesting article.

    • marco

      hallo, i am working with STM32F4 DCMI + OV2640 camera, and its not work, can you help me? , can you send to me a project sample or samting?

  • John Doe

    This site is awesome! Thanks for putting it together.

  • Derek Mundondo

    Hi Tilen, I would like to ask if you have worked with a the ESP8266 on the STM32F4 board, I am looking at making a WiFi web server and I would appreciate a little guidance so that I don’t waste time going in the wrong direction. I haven’t found suitable material at the moment. I am not asking for code. I am more than willing to do the work myself if there is no ready library.

    Thanks in Advance

    • Hi Derek,

      Yes, I tried this module with F4, about 8 months ago. Because of very unstable version of ESP software for AT commands, I stopped with library development. It worked very bad.

      • Derek Mundondo

        Hi Tilen
        Thanks for replying. I have been doing a lot of research on the module for the past two weeks and I haven’t found something solid yet. Will update you if I get everything up and running perfectly.
        Your site is by far the best stm32f4 discovery site I have come across. 😉

  • krishna

    can u give me an idea how to add this libraries to proteus 8

    • As far I know you need .hex file for proteus simulator, or what you mean here?

  • SD11

    could you please let me know where you can download the CMSIS libraries? In this website so many tutorials use them, but I have no idea how to find the roc and gpio libraries.

  • Derek Mundondo

    Hi Tilen

    Quick question. Do you use USART to communicate between the STM32F4 the ESP8266?

    Kind Regards

  • fikri

    Hii I just want to make touchpad. Is this a similar, if similar how can i do , I really try all of think , but ı didnt do that 🙁

  • Christian Julius

    Why does this not work? 2 x 407er Boards, 2 x RF Modules, 14 Cables to the pins mentioned above, 2 Hex files from the GIT, 1 RS232 Converter … and always: “LOST” on terminal. Neither the arduino, nor the com between the stm32 works :-(((((
    And in another source i found out that unplugging the RF module changes nothing in results from Transmission_Ready Routines. What can be wrong whith such a simple configuration? Ok,Arduino is another topic, the protocols differ because of CRC8/16 and other things, but the the ping pong between the STM32 must work

    • 14 cables? What cables? What pinout about? What modules??

      “Ok,Arduino is another topic, the protocols differ because of CRC8/16 and other things” CRC8/16? What is the sense here? Don’t understand nothing.

      • Christian Julius

        Simpler: 2 STM32F407 Disco Boards with each a NRF24L01 (7 cables needed), each Board flash with the hex files “receiver” and “transmitter”. Pinout conected as shown in the library description for the 24L01+. Very simple, eh? So, why does this not work? Most functions of the lib are “output only”, so it is difficult to check if the module really works. The status register reads out as 0x14 3 times and then always as 0x00. Dont know if this is ok.

        I am really fed up with this RF24L01 device, never had such problems. the RFM12 was much easier and I wrote thr driver on my own.

  • Murtaz Naqvi

    Can you help me in getting rid of Error: L6406E in keil

    • This error has also a message which describes where is a problem.

      • Murtaz Naqvi

        Error: L6406E: No space in execution regions with .ANY selector matching ov7670_control.o(.bss).

        • Is it not understandable what is going wrong? There is no memory for your job!

          • Murtaz Naqvi


  • Amir

    Good Evening everyone. i want to ask u about how to read gamepad(joystick) and show the value on the display. i’ve tried my program, but it’s just show the value on the displa. But actually it’s doen’t work. The value is 255 and not change even if i pressed or released the gamepad button.. if everyone can help me. thanks a lot.

  • Kyaw Kyaw Aung

    Hi, TM.
    If I want to use a timer(Timer4) with interrupt flag set every 1 second (for STM32F4 Discovery), am I setting the following time base structs correctly?
    Prescaler = 83999, TIM_Period = 999, CounterMode = CounterMode_Up, ClockDivision = TIM_CKD_DIV1

    • No. Prescaler is 16-bit value.

      • Kyaw Kyaw Aung

        My bad. How about this? Prescaler = 8399 and Period = 9999. Thanks in advance

        • I assume TIM4 is connected to APB2 so it works on 168MHz if PLL is properly configured.
          So you need (Prescaler + 1) * (Period + 1) to be 168M for 1 second.

  • thanh hai nguyen

    i need rs485 librarly. Help me!

    • I think it is pretty straight-forward. Use USART lib and add control pin for your transceiver.

      • thanh hai nguyen

        thank for your reply. how to assign address to slaves ?

        • Rs485 is the same as uart except differential pair is used. How you will use protocol, is your choice. You will have to figure out some packet control or use something like modbus.

          • thanh hai nguyen

            ok. thank you so much. i gonna try.


            Hello friend,
            i am also right now searching out for library related to RS-485. Can you please help me in that sense if you have got any solution for same.

          • What exactly you need in RS-485 library? You need UART and a pin to toggle transceiver to TX or RX mode. Not so hard to do I would say!

          • Pavan Yashwant Jadhav

            Please reply if you can elaborate more about how to use USART library to make work for RS-485??

          • RS-485 is nothing else than UART with differential signals. So for differential part, external hardware takes job for you.
            That’s all. Use UART like normal and that’s all.

  • jonathan

    thank you very much for the great work. Do you have an I2S library somewhere? I would like to read 24bit I2S from a digital MEMS microphone. Since digital microphones are getting used more and more I think this would be nice to have.


  • Victor

    Hi! Is there any library for CAN BUS communication??

  • GoBen

    Hi Tilen, have you ever worked with OV7670 camera module? Can you write a library/example project about it, please? It would be a great help!
    Thanks. Your webpage is awesome!

  • robert offner

    Hello Tilen, thank you for all the work you put into those libs. I would likke to try some of them but i can’t even compile a simple project. I am new to ARM Programming and coming from AVR am overwhelmed by the configuration necessities. (Clock Vectors,..). I am working with Gnu ARM Eclipse (neon 4.6.2) with CDT and some templates installed. Here comes the first problem – i don’t know which template to use. The templates are named as follows:
    “Empty Project” – nothing inside
    “Hello World ARM C Project” – only a main.c file, no initialization as far as i can see
    “Hello World ARM Cortex-M C/C++ Project” – main.c, Linker scripts, Directories for HAL Drivers, CMSIS Drivers, __initialize_hardware
    and finally
    “STM32F4xx C/C++ Project” with everything from above plus HAL Drivers.
    I tried since two days with different templates to compile your example (the 07-USART Example from your newes libs depending on HAL) because i don’t know where to put the various files.
    As far as i understand it i need the CMSIS Files and the HAL Files and the TM files right?
    Even if i copy all the files in my project AND add the directory to the include and to the sources path i get undefined references. It would be a great help if someone could make a bare metal project for GNU ARM Eclipse with your libraries as a starting point.
    best regards,

  • Võ Kiệt

    can use all library for 32f411VET ???

  • hitesh lunagariya

    i am not able to use stm32f429i dicovery in landscape mode how can i use it in landscape mode

  • FerhatYOL

    TCS3200 Color Sensor Library

  • Ferhat YOL

    Hi tilen, Your works is very good

    Have you ever worked with the TCS3200 color sensor before? Do you have a library for this sensor?

  • idan

    hi, i have this problem :
    #error “tm_stm32f4_disco.h: Please select your board. Open tm_stm32f4_disco.h and follow instructions!!”
    i don’t anderstand it, can you hlpe me

    • The error says it very clear. You have to set your board you are using in case you want TM DISCO lib. This lib has preselcted LED and BUTTON pins for you so you can use TM_DISCO_SetLed and TM_DISCO_Button… functions. Open file and check what you have to do in order to get it to work. Very clear message.