Library 54- General library for STM32F4xx devices

For 54th lib I decided to make it’s name to be “General”. With this name I mean that in this library, a lot of different stuff, maybe unrelated between, but very useful things will be implemented.

It allows you to make software reset, get reset source, disable or enable global interrupts (NVIC) and more.

It will be updated frequently but for now it’s just a start to use it in your projects.



  • Support for software reset with callback
  • Get reset source, what resets your MCU
  • Disable or enable global NVIC interrupts
  • Get different clock speeds in your system
  • Operate with DWT counter inside Cortex-M4 CPU
  • Precise delay using DWT timer
  • Check if number is odd or even or if it is power of 2
  • Round float numbers
  • Convert float number to integer and decimal parts


    • STM32F4xx
    • STM32F4xx RCC
  • TM
    • defines.h
    • attributes.h

Functions and enumerations


  • Example shows how to get reset source and how to get frequencies inside your system.

Project is available on my Github, download library below.



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!
  • stracho

    Why don’t You switch to just CMSIS Library without HAL or SPL ?

    • Good question. Probably because it’s too much work then 🙂

      • ajx

        What about libopencm3? It’s very good and doesn’t have as much bloatware as the standard ST library.

        • I like this what I have now and other uses this too.

  • Pingback: All STM32F4 libraries - STM32F4 Discovery()