STM32F4/29 Discovery with CMSIS library in Keil uVision

From this moment, I will use in my projects Keil uVision. It’s true, that Coocox is free, but it has some bugs, which are great fixed in Keil. Keil has some limitations for free (32KB flash support, no optimization) version, but for our examples and libraries, it is just fine. For updates, look at my Github projects repository, where are all projects and libraries. There is no included my libraries in bottom project, you have to download it manually from Github. All of my examples should work in Keil.

November 03, 2014 Update

I got some emails about this messing in Keil right now. For that purpose I’ve made a 2 new project templates. It’s features are almost independent of Keil version.

  • Supports various STM32F4 boards
    • STM32F4-Discovery
    • STM32F429-Discovery
    • STM32F401-Discovery
    • STM32F411-Discovery
    • Nucleo-F401RE
    • Nucleo-F411RE
    • STM32F446xx any device
    • For Nucleo boards, you can now choose (With target inside Keil uVision) if you will use with internal RC 16MHz oscillator or with external 8MHz crystal connected.
      • If you have connected crystal to Nucleo board, then don’t use “internal” option when you select target

        Keil uVision available targets in project

        Keil uVision available targets in project

  • All PLL settings are now set from “Options for target” window under “Defines” in “C/C++” tab
  • Standard peripheral drivers are included, no need to use the one provided in Keil uVision
    • They are basically dead for Keil uVision
      • But still perfect for the low level programmers and will be always available.
    • New HAL drivers are now supported with Keil, which don’t work with my libraries
  • Project template is split from standard peripheral drivers
    • This allows you to use the same drivers for all projects
    • When new update occurs, you just update everything from one place.
  • You need now installed STM32F4xx pack from Keil with at least version 2.2.0
    • This is because of STM32F411 device support for Nucleo-F411
  • When you need to add modules to your project, just hit right click on the left at “STD_Periph_Drivers” group, click “Add Exiting files to group STD_Periph_Drivers” and find your .c files in a included folder “\00-STM32F4xx_STANDARD_PERIPHERAL_DRIVERS\STM32F4xx_StdPeriph_Driver\src
  • I will (I hope) convert all my project to the new version, so they will be compiled without problems with new Keil uVision packs installed, but without HAL drivers.

Download project templates below:

  • Keil project with included STD Peripheral drivers 1.5.0 for STM32F4xx devices
  • Keil project with included STD Peripheral drivers 1.5.0 for STM32F4xx devices and USB configuration
    • STM32F429 and STM32F446 clock is set down to 168MHz
    • STM32F411 clock is set down to 96MHz
      • For Nucleo-F411
      • For STM32F411-Discovery
  • Both projects will toggle all leds on board every 500ms by default

November 04, 2014: All projects on Github are updated with project template like these two above, with STD peripheral drivers and new Keil STM32F4xx packs version 2.2.0 or newer.

Project folder structure

  • Targets
    • 5 folders for different targets selected
    • inside each folder are output files, including .hex file
  • TM
    • Folder, where you place my libraries for your project
  • User
    • User files, as main.c, defines.h, etc

Make your say about that.

October 31, 2014 Update

Keil has dropped support for standard peripheral library for STM32F4 in new MDK-ARM 5.12 version. New packs that are supported are STM32CubeF4 “HAL” drivers, which are totally incompatible with STD libraries.

So when you install packs for STM32F4, don’t install it with Keil, but go to their website and manually download version 1.0.8 for STM23F4.

Download pack 1.0.8 for STM32F4 from Keil packs here.

Step by step configuration in Keil uVision

Tutorial below has sense only if you are working with Keil uVision version between 5.0 and 5.11. Newest versions does not support STD peripheral drivers. You need to add them manually.

In this step-by-step tutorial we will set new project for STM32F4 or STM32F429 Discovery board and show, how to use CMSIS libraries, which are integrated in Keil uVision.

  1. Download Keil uVision from here. You will need to pass some information to their “registration” form, but you will be able to download Keil uVision MDK v5.
  2. Install as normal, nothing special, when finished, open it. First time Keil uVision
  3. On top menu select Project -> Manage -> Pack Installer… Keil uVision packs
  4. If you don’t have installed them yet, make sure these are installed:
    • ARM::CMSIS (Core CMSIS functions)
    • Keil::MDK-Middleware
    • Keil::STM32F4xx_DFP (Functions for STM32F4xx Series)
      • Install them manually, if they are not listed here. You need version 1.0,8 if you want to use my libraries with Keil packs. How to do this, look at the begginning of the post.
  5. Close Pack installer
  6. Go back to top and select Project -> New uVision Project…
  7. Save it to computer. I choose My documents with subfolder “uVisionFirstProject“, and project name is “hello_world“, then click Save.
  8. A new window should be opened, “Select Device For Target ‘Target 1’…“, find here your device:
    • STM32F429ZI (for STM32F429 Discovery board)
    • STM32F407VG (for STM32F4 Discovery board)
    • STM32F401RE (for Nucleo F401-RE board)
    • STM32F401VC (for STM32F401 Discovery board)
    • and click OK
  9. A new window “Manage Run-Time Environment” should  be opened Manage Run-Time Environment
  10. Select options:
    • Under CMSIS select CORE,
    • Under Device select Startup
    • Under Device -> StdPeriph Drivers select Framework and all other components you will need in your program, (GPIO for pins, SPI for SPI communication..)
    • If you need DSP (Digital Signal Processing) instructions for some reason (FFT, arm math, etc), you need to select DSP under CMSIS.
  11. Click OK, window will be closed. In program on the left look at Project.New project created
  12. Click on “plus” on the left under “Device” group and open “system_stm32f4xx.c (startup)” file and search for

    and change it to (This is number in MHz, to match your crystal frequency. STM32F4/29 have both 8MHz crystal)

    If you are working with STM32F429 (or any other device, which works with 180MHz) and USB application, find something like that in the same file and edit 360 to 336 to decrease speed to 168MHz
  13. Rename Source Group 1 to User
  14. Right click on Target 1 and select Add Group…, and rename it to TMMake new Groups
  15. Go to your project directory, in my case “My documents\uVisionFirstProject” and create new files “main.c” and “defines.h
  16. Go back into uVision program, under User folder on the left make right click and select “Add Existing Files to Group ‘User’..” and select files main.c and defines.hAdd existing files to group
  17. Go to top in uVision and select Project -> Options for Target ‘Target 1’..
    • Under Target set Xtal to 8
    • Under C/C++ -> Define type: “USE_STDPERIPH_DRIVER,STM32F4XX,HSE_VALUE=8000000″ (without quotes; if you have other crystal, like 16MHz, type 16000000 for HSE_VALUE”)
    • Under C/C++ -> Include paths click on “” and set paths to (without that you files will not be found and you will get errors):
      • Your project folder, in my case path is “My documents\uVisionFirstProject”,
      • To folder, where your (my) external libraries are saved, in my case path is “My documents\STM32F4_libraries”
    • Under Debug find ST-Link Debugger and click settings

    Set Xtal to 8Mhz Set preprocessor symbols Include setup On top right select ST-Link Debugger and click Settings

  18. Under debugger settings in Debug tab set PORT to SWSW Debug mode
  19. Under Flash Download tab click on Add button and select “STM32F4xx 2MB Flash2MB Flash download
  20. Hit OK, than again OK and again OK.
  21. Open your main.c file in uVision editor and make int main function
  22. Press F7 to compile and make sure there is no errors.Project ready and compiled well

If you go to my Github account and download all files from there, you will be able to run projects directly from directories, no need to copy each needed library to your project. My Github account Have a nice programming time 🙂

Known bugs

  • ST-LINK USB communication error
    • If you have installed MDK5.11a version of Keil uVision, then you have a problem downloading hex file to the discovery board via ST-Link, says “ST-LINK USB communication error”. Solution is here.


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

    Hi Tilen, I have a question for you. I’m following your project here and on GitHub and I noticed that you use the “old stile” STM32F4 programming. Have you tried the STm32Cube firmware and the configuration of the peripherals using STm32CubeMX.
    I’m using it and it is very good…

    • Majerle Tilen

      I don’t know what you mean by “old style”, because this libraries are “the newest” out. I’m not using HAL drivers, just basic CMSIS files. They are also included in Keil uVision.

      • Myzhar

        Ok ,sorry… You use CMSIS directly, not the frontend by ST.

  • Lazar

    In Keil MDK-ARM v5.11a always getting ST-LINK USB communication error. Before flashing I check is ST board visible in ST-Link -> Debug -> ST-LINK Debugger -> Settings, and it shows that everything is okay, but when I try to flash it shows me error I said.

  • Sajid Shaikh

    Thanks a lot brother.
    Keep up the good work.
    I’ve been through many examples and tutorials to get that bloody led blink, and thanks to you I have my blinky working.

  • Nguyen Master

    Hi brother!

    I have an error is the font in the Config window is too large, so all
    options properly can not indicate in the Config window. In the first
    time i had to use it but it normal, next somedays i don’t know why it
    becomes like this. I think my OS had some problem, I use Win7 64bit
    and KeilC ver 5.11.
    The Picture of this problem here:

    Thank you so much!

    • Hi.

      Are big fonts only in Keil or entire computer?
      On the desktop, right click and select option to select resolution for you computer or lcd. There should be option to set lower size for fonts. Maybe this will solve problem.

      • Nguyen Master

        Thanks for your answer Brother.
        I installed it for along time ago, everythings is ok, but now it appears problem like this with the same windows configuration, nothing change, and I tried to change many revolution already but its still not solve the problem. I think when i install another software, maybe it has an effect on fonts of Keil but i dont know how to fix this font itself.

    • doantn

      Hi Nguyen Master,

      Please refer the method 4 of following link
      I fixed it by the method 4 in my laptop,

      • Nguyen Master

        Thank you so much. The problem was solved :). You’re my saviour 🙂

  • Вася Пупкин

    Hi Majerle ! Can I ask you, what bugs has Coocox ? Is it bugs of Coocox itself, or some bugs has Gnu Arm Toolchain ? I’m new in STM32 and now use Eclipse + Gnu Arm + OpenOCD, as describeb in . It is good toolset ? I know, that gcc generates not very optimized ARM code, but I not need in professional optimization. Thank you very much, you have a nice blog !

    • Compiler specific. One of them is that it has no implementation for sprintf,…

      Just start with coocox or free edition of keil.

      • Вася Пупкин

        Thank. So I’ll download Keil and run it under Windows on VmWare… :((
        I live on linux and all my soft (mainly for FPGA) also under linux. Maybe Keil will run under wine, but not all programs runs with it. ActiveHDL(very cool FPGA modeler) for example cannot.

  • Brandon Fessler

    Great site Majerle! I was wondering if it is possible for your libraries to work on the STM32F411RE NUCLEO boards? I have been trying this with no luck; Keil’s lack of support for the Standard Peripheral Library in 5.12 unfortunately coincides with version 5.12 adding support for the 411RE MCUs. I’m a bit stuck on this one, any suggestions would be helpful!

    • Hi.

      If you download ST’s peripheral drivers for STM32F4 you have all files you need for F411. Startup, peripherals, .h, everything.

      Just open keil, select your device and include manual files there which you need.

      Download first created project here for keil with CMSIS 1.4 files included.

      “Default Keil uVision project with CMSIS v1.4.0”

      Inside are files also for F411, but you also need F411 startup file which is included in standard peripheral libraries for stm32f4. Link to ST site is in my section “STM32F4 links”.

      It can be a little bit tricky, I should make a video tutorial about that.

      • Brandon Fessler

        I’ll give it another shot, thank you Majerle! And I’m sure many people would appreciate a video tutorial, myself included ; )

        • I’ve updated post, now with STM32F411 support too.
          Have a nice coding 🙂

          • Brandon Fessler

            Works great on the NUCLEO F411RE now! I wish the ST libraries made as much sense as yours do.

          • Great. Nice to hear 🙂

            I sould suggest you that you mount 8MHz crystal and 2 capacitors on Nucleo board :))

          • Eky Hamzah Arrizalio

            what type of lcd is it?
            sorry for my bad english

          • ILI9341

          • GunterO

            I use these (cheap) LCD’s with my Arduino projects, but haven’t done this on the STM32 since I just moved from Arduino to STM32. Care to share the library you are using for this LCD?

          • It is posted on the web!

          • GunterO

            Ah, okay, I’m sorry, I will look a bit better then 🙂

  • Pingback: Fix Keil Uvision Error Flash Download Failed Windows XP, Vista, 7, 8 [Solved]()

  • Daniel Solís Piñan

    I cant find Device -> StdPeriph Drivers select Framework,

    • You have new Keil install, and tutorial above does not work anymore.
      It says about that.

      You can aswell download default project template if you want to use STD periph drivers.
      Currently, you are using HAL drivers.

      • robotic arm

        Could you please elaborate on how we have to proceed if we can’t find STD periph drivers?
        I am completely new to this and I am going to do a project on remote control of robotic arm using STM32F4 discovery board
        I need a tutorial and as you said I can not proceed with your tutorial if I don’t have STD. Kindly, let me know how I should proceed.

        • Hi, you can download my Keil project template on above in the beginning of this post. Drivers are included there. Project is prepared, you just add drivers you need in your project, so i think you will need timer (TIM), GPIO, RCC (clock).

          If you are working with other IDE, then you need peripheral drivers from

          Look at my “STM32F4 links” section for CMSIS.

          • robotic arm

            Sure, will do that.

  • Greg

    I have new computer and I had to install new mdk-arm since I lost my 5.11 version installer. Now I have 5.13 and it has HAL drivers and none of my prewious project work anymore. Any way around this? Does anyone have older version installer?

    • Greg

      Thank god I found a 5.11a version on the internet 🙂

      • If you use external libraries (CMSIS) you can have which version you want.
        I have on my Github prepared projects for MDK 5.12 and newer

        • GunterO

          Yep, I’m using 5.13 and all is working. But I installed the “Legacy support for Cortex-M devices” from Keil as well.

          • OK, but is possible to use F411? 😉

          • GunterO

            Well, I not sure this is the answer to your question, but I tried your Default_Project (blinking LEDs) on my Nucleo-F411RE board, in combination with Keil µVision 5.13, and all is working fine!

      • robotic arm

        Can you please share link of site where you have found 5.11a version?

  • robotic arm


    In the templates, I could not find device in the left side column.So,I tried adding it by going to the manage run-time environment. But I could not add it and it shows a message depicted in the figure.

    • Noo. If you want runtime environment use then you have to use keil stm32f4xx Hal drivers. My libs does not support them.
      Also, tutorial above is not valid anymore if you have keil version 5.12 or above.

      Use external files for libs.

      Download my repo from github and open one project there. You will see how it is structured for actual design.

      • robotic arm

        Ah! fine. I have 5.13. That’s the reason. I will check github. Thanks a lot!

      • robotic arm

        It is sad that I can’t access github any more. It has been blocked by India. Is there any other way through which I can access your work?
        Else do you have a link for keil version 5.11?

        • Tryvto access via proxy. If still dont work i will upload zio file to one sharing website like megaupload.

          I dont.

          • robotic arm

            Tried that.. wasn’t able to access.. 🙁

          • I will make a repo download and will upload do megaupload. Do you have access there?

          • robotic arm

            Yes, I can access megaupload.


            This is the fastest solution for me right now. Dropbox. Try and report.

            BTW: Happy new year!

          • robotic arm

            Thanks a ton! Was able to download. And Happy new year to you too! Have a great year ahead! 🙂

  • Pingback: How To Fix Coocox Remote Communication Error in Windows()

  • Fawad Aslam

    Hi. i wanna know when will you start the tutorials of HAL drivers, please dont take this as a spam.i didnt know where to ask other than this….

    • Sure, but I’m waiting stable HAL release first.
      Somewhere in July will be.

      • Fawad Aslam

        OK.thanx… i have a question. i have mdk 5.12 and i have downloaded your above project but i dont know how to add this driver in keil.

  • Vinícius Jean Ferreira

    Hello! I will try to follow your tutorial and use your libraries, but I am doing this because I have tried too much to use Hal Drivers. I can use all functions os the Board, but not the display. I don’t know why, but the Cubemx do not let us to use the BSP libraries, this is very weird.

    • Ok, let’s check.
      What is the problem? LCD not working? Compiler error?
      Anything else?

  • Syrer


    I tried the HAL-Library first, and now I’m thinking about using the standard library instead. I tried to follow your tutorial but in step 10 I can not find the menu point “Device -> StdPeriph Drivers”. I have instead the STM32Cube HAL! even though i didn’t install the packs via keil, I imported them after downloading them manually as you stated. Got a fix for that?

    What about the Board support option? should i keep it as it is, even though I’m using STM32F411RET Nucleo


    • Ok, yes I know your feeling now. Terrible.
      If you go back to previous version, then F411 is not supported.
      Just stay at this MDK version with HAL drivers and use STD drivers as files from other source.

      Like I did in my project template above.”Keil project template with CMSIS 1.4.0″.
      Download it and try to open and you will see how it best way.
      This tutorial is not reliable anymore.

      • Syrer

        Yes, terrible! I am new to STM32 and the first thing i had to face are the HAL-Drivers, imho stupid re-implementation of the CMSIS.

        Oh, You mean to ignore the HAL-Drivers and include the STD-Drivers as if they were “normal” drivers? Hmmm ok, i will give it a try. The STD and the work you did deserve that anyway. Thank you for the quick response.

        • Yes.
          I have built’in HAL drivers in keil, but have STD drivers in external folder and I include them which I need in project.
          Simple solution which will work for the rest of my life 🙂

      • Syrer

        One more issue, if you take a look at the project structure in keil, there are some locked files which i can not modify. Did you lock them or it’s some how my fault?

        • Locked files are my libs and Standard peripheral drivers.
          The files with RED dot. It means that they are not included in compile.

          Try to change your target. Currently you have selected STM32F429-Discovery above and you will see that other fill will be used for compile.

          • Syrer

            I see, thanx. Well i won’t disturb you anymore for now. I will spend some time discovering what to do and post questions at the end of the day, if any 😉
            Greetings from vienna..

          • No problem at all.

            If you want “discover” my libs, you should also download my Github repository to your computer and open example directly from there 🙂


            If you have any questions, just ask 🙂

  • GunterO


    I’m quite new to STM32 and your wonderful toolset. I played around a bit, and all is working nice, thanks for making this easier for us 🙂
    I wonder, it may have been asked before, but are you planning to add TCP/IP libraries as well? Or do you have an (easy) way to implement something like lwIP into my project based on your template? At the end, I would like to use a Nucleo board in combination with an ENC28J60 ethernet, just because this combination is very cheap and powerful.
    But before doing that (need to learn basic stuff first), I would like to have your template working in combination with my STM32F4-DISCO and baseboard which has an ethernet PHY (SMSC8720A).

    • Don’t be one of those, who first time saw some MCu and wanna do ethernet projects.
      I have in mind this.
      Just have to do it clean with DP83848 PHY and hopefully with ENC too.

  • Félix de Mûelenaere

    In stm32f4_discovery_lcd.c , the LCD_DrawFullCircle isn’t working properly. LCD_DrawCircle works but I do not fully understand how the algorithm works. The defined decision Variable D is mysterious.
    D = 3 – (Radius << 1); why this choice for initializing D?
    later in the function
    if (D < 0)
    D += (CurX << 2) + 6;
    D += ((CurX – CurY) << 2) + 10;
    Could some1 explain the Algorithm to me, I do not understand how this decision variable works and is beeing used.

    • Don’t spam. This question has nothing to do with this post!

      • Félix de Mûelenaere

        That’s Not a constructive reply my friend. It would have been better if you had pointed me in the right direction instead. This Discussion is about the STM32 board and it’s packages. So why isn’t my question relevant here?
        EDIT: helped me a lot

  • Jan Mikolaj Zalewski

    When I try to compile, this pops out.
    FCARM – Output Name not specified, please check ‘Options for Target – Utilities’

    Target not created.

    Build Time Elapsed: 00:00:00

    • Strange,

      do stuff what your error says to you.
      Also, make sure that in tab “Output” in “Options for Target”, output name is set to anything.

  • Francisco Pinheiro


    I am new to STM32F429 and I am trying to use my MAC OS 10.10.3 o program the uC. I am using a VM with Keil and I am facing some troubles to getting started. First thing: you said to manually install a pack STM32F4xx_DFP version 1.0.8, unfortunately I have access only to new versions STM32Cube HAL. Is there any chance to add this pack version 1.0.8. Later on on you Tutorial you mention caching the define of PLL_M. Unfortunately on this pack I do not have it. I believe it is owed to the fact I am using STM32Cube. Isn’t it?

    Any help will be highly appreciated. Thank you in advance.

    • Ignore tutorial.

      Download newest HAL pack (for Devices library) and download my Keil project template and work with him.
      Do not use built-in drivers in keil, unless you want to use STM32Cube.

  • fezai

    hi i want to know if i can implot my algorithme of cryptography in stm32f4dis-wifi and use it to crypt

    • I think that F4-Discovery (F407) does not have hardware cryptography built in, so to use hardware, answer is no.
      But if you have anything done by software, then yes.

      • fezai

        im having a pfe in the securisation of embarqued systeme with the elliptic cryptography using STM32F4-discovery with KEIL uvision 5 this is my first time with keil and i dont know how to implement a program or how to use the source of keil would please help me thx

      • fezai

        so there is any possibility to use any other STM32F4-DIS to implot the algorithme of cryptography ?

  • Tôn Quyền Ngô

    Hi Tilen,
    Now I’m using KEILC v5.14a, and ST-Link V2 for Debugging, the problem i have now is I can’t connect my STM32F4-Discovery Board to the software, it keeps saying:
    “ST-LINK USB communication error”
    “Error: Flash Download failed – Target DLL has been cancelled”.
    I also use the ST-Link Utilitiy and it can’t connect too.
    I’m using your GPIO Project for testing, so i don’t the the problem is the code. After surfing some forums, I guess the fault is that maybe I rewrote the pins of the ST-Link USB in some projects ago and make my Board “brick”.
    So can you show me how to fix that problem (including how to do in hardware (connecting pins) and software(reset chip))?
    Many thanks in advance!!!

    • Go to project’s debug options, ST-Link settings and make sure that you see ARM device detected.
      Also, make sure you have correct set jumpers on your discovery board, try connect under reset.

      Try to connect to ST-Link only via STM32 ST-Link Utility program.

      • Tôn Quyền Ngô

        I have checked ARM device: STM32F4xx Flash 1M, jumpers are set right, Port SW, Max Clock 4Mhz, STLINK/V2, but can’t choose mode in ST-Link Utility, and please show me how to connect to ST-Link only via Utility Program?

        • Tôn Quyền Ngô

          I have figured out how to solve this problem. The reason of this error is that i’ve code some Pins connect to the ST-LINK USB port by default, and make the board confuse and can’t be flashed directly by KEIL C.
          Solution here:
          – Restart the PC.
          – After restart, first open only ST-Link Utility, don’t open KEIL C.
          – Connect STM32F4-Discovery board to PC through ST-Link USB (the CN1 port).
          – In ST-Link Utility, go to Target->Settings, and press refresh to update your Board.
          – Then choose Connect Under Reset in Mode, choose SWD for Port and 1.8 Mhz Freq (i choose that) -> Press OK to Exit.
          – Now open a Hex file of project that’s not using any pins of ST-link Port (PA11-> PA14), in my case I choose hex file of Tilen’s GPIO Projects -> the software should recognise that hex file.
          – Go to Target-> Automatic Mode: the file you’ve already open it, so leave as it be.
          – In the Actions box: choose “Full chip Erase” (This should fix the communication error, can’t find ST-Link Problem), then choose “Flash programming” and “Run Application” Options.
          – Press Start, wait for it to eraset the chip and download code to the Flash, and you will see 4 LEDs (Pin PD12-> PD15) on the board light up.
          –> So the board now “debricked” and can be flashed by KEIL C again.
          Hope this help people stuck in the situation like me, many thanks for your support Tilen! 🙂

  • leonardo

    Hi, what is the best way to get your library working? I’m new on keil and I can’t finde 5.11 installation program. Can you make a new tutorial for current version of keil? or can you give a link for a keil install that are compatible with this tutorial?


    • Don’t try to use this tutorial anymore.
      Download newest keil program, download my project template I have at the beginning of this post and start coding. That’s the faster mode for beginner.

      • leonardo

        Ok, I see.
        I’m interesting on geting runing library 62… any advice?


        • So where is a problem?

          • leonardo

            I’m sorry, I just download your project and saw that all necesary libs are on it (std library, CMSIS…) so no problem at all.

          • leonardo

            I have to instal Keil.STM32F4xx_DFP.2.5.0.pack right?

          • Yes.

  • Craig

    I am just starting out with the STM32 and have learned a lot from your posts and site. Thank you!

    Keil does not seem to be keeping up with STM32Cube and i am having some compatibility problems selecting FreeRTOS and LwIP then bringing the code into keil and later trying to do further configuration of these items within uvision. So i am considering using RTX and the TCP stack in the keil CMSIS library.

    I hope this isn’t a stupid question somehow, but which do you think has more potential, fewer bugs, decent code size: FreeRTOS or Keil RTX and LwIP or the CMSIS ethernet in the keil library? I see that the latest pack also includes Micirum RTOS and Oryx TCP so more to choose from.


    • Hi Craig,

      using Keil RTX requires Keil license to run it. If this is not a problem for you, then that’s ok.
      I prefer FreeRTOS here. It’s free, after some years you can compile code on free GCC based compiler and so on.
      Cube problem in Keil is not because of Keil. Keil puts libraries which ST sends them. So ST is the one who does not prepare code for Keil to be up to date.

      • Craig

        Thanks for the input!!. I have a mdk-arm pro license but am not sure it is worth the money. it is dozens of broken little things that irritate and annoy every day–for example, the latest pack for keil has startupstm32f4 v
        2.3.1 header dated from march or something but in cube it is 2.3.2 dated last month. uvision is unhappy if startup and other support files are not
        selected so either ignore the uvision environment manager or let it add the files but the build then has several [presumably] identical files to those brought in by cube. so every visit to the environment manager is followed by manually going through the compile/link errors to see what outdated files keil added that we have to exclude from the
        build and then hope there were no substantive changes. They also recently added the option to manage the stm32cube from
        within the run time environment portion of uvision but this seems to be completely
        broken and constantly asks to build the same file. however, if allowed to build it starts from
        scratch and not the existing cube project. If i just used keil and HAL or cmsis it may be ok, but i am making an effort to start with the STM32Cube and import code to uvision. uvision will compile the stmcube code just fine but if we try to use keil to manage any other features or even manage trivial things like the LwIP something always breaks. It is as if the basics haven’t been tested and constantly one thing fixed / one thing broken. so i have great fears that their rtx and tcp stack will be hit-or-miss. For crying out loud, i can crash uvision with whitespace in a pathname ! this is 2015, not 1985. So we are really torn between sticking with keil or going to freertos which at least offers a path to openrtos or even safertos which emphasizes stability.

        So what would be the advantages of sticking with keil? i really don’t want to justify keil now and then have to reverse the decision in a few months and start over with freertos/openrtos.

        • Keil post in libs what ST sends to him. So if ST does not send updated versions to Keil, then there is nothing to update and are still old. That’s the reason.

          I have to say that I never faced problems like you have. When Keil 5 was released with software packs, I started to use them, but then they drop support for STD periph drivers because ST says that.
          So I started using Keil only as compiler and IDE, nothing else. I don’t use Keil’s built-in libs, software packs and don’t know what else it has. Not because of Keil, but because of ST in this case.

          LwIP and other stuff worked more than great for me always.

  • Name


    I started using keil uvision, but is have some problems with it. I use your template. I try your libraries, they are very good. The programs are working well. But sometimes, when I want to load a new program to my STM32F4 discovery, I got az error message: “Flash Download failed – Target DLL has been cancelled”. Then I can’t load any programs on the discovery, and also can’t erase. I try to unplug-plug, reboot the computer, load az older, good program, always the same error message. Than I load a simple program on the STM32 with an another software (Sissy) than I can load programs with keil uvision again. But I don’t know, why I got this error message (once, twice a day). Is some configuration is keil wrong? Or I dont know.
    My other question is, when I choose my board (STM32F4 doscovery) in the “Options for target” menu the Xtal [Mhz] value is 12.0 Is it good? Isn’t the STM32F4 168 MHz?
    Sorry for my bad englich, I’m hungarian. Thank you for your help

    • Make sure, you have updated software for everything. Drivers for ST-Link on Discovery and on computer.

      Xtal value is value in MHz for XTAL = External crystal. This value does not care in our case here with this configuration.
      What is does care is HSE_VALUE, and is set to 8000000 in C/C++ tab in settings for target.
      Then there is PLL for increasing frequency from 8MHz to 168MHz inside STM32F407.

      • Name

        thank you for your fast answer!
        Another question: How can I write my program in C++ language. Because now i only can write programs in C.

        • You need to declare project as C++. So, you have to create another project.

          • Name

            sorry I can’t find how can I declare project as C++. Can you help be a bit? Do I have to create projekt using the step by step configuration?

          • In uVision, click on “Project” -> “Create new Project” and that’s all 🙂

          • Name

            I understand how can I create new project 🙂 I just don’t know, how to use it with your template configurations.

          • You can’t directly 🙂

  • h.mehrabian

    First time, i followed this tutorial precisely and got no error with Keil 5.15.

    But, for GPIO tutorial, i do this CMSIS tutorial again. In Step 10, the framework faded out surprisingly and beside of that STM32Cube Framework was replaced.

    After compiling, i got this error:

    sytem_stm32f4xx.c(564): error: #20: identifier “HSI_VALUE” is undefined

    • Reading tutorial again, you will see that it says it does not work with this version anymore.

      • h.mehrabian

        yes, i know
        But, i reinstall the software and then, the error is gone.
        One more question:
        By using this tutorial and in general CMSIS, can we use Keil’s Debug (simulation)?
        I have tried but, it didn’t work.

        • With enabled debug output, you should be able to run it without problems.
          Options for target->Output->Enable Debug output

          Then in Debug tab, select simulator.

          • h.mehrabian

            tnx, i can go to Debug however, it didn’t run and instead of showing main.c, it shows system_stm32f4xx.c. With pressing F11, it just loop in following program:
            HSEStatus = RCC->CR & RCC_CR_HSERDY;
            } while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT)); ”

            This is the error in command page:
            *** error 65: access violation at 0x40023800 : no ‘write’ permission
            *** error 65: access violation at 0x40023800 : no ‘read’ permission

          • h.mehrabian

            I googled this problem and found same unsolved problem in net.
            However, i’ve found some example for STM32F10 that it works but, for STM32F4, nothing!!.

            Have u ever give it try to simulate STM32F4 in Keil?

          • Never tested. Don’t know why would I use it 🙂

  • manju nath

    Hai Majerle Tilen

    I am getting this error while i compile .
    TargetsSTM32F429_Discoveryproject.sct(7): error: L6235E: More than one section matches selector – cannot all be FIRST/LAST.

    • Sounds like .s file is missing in project. Make sure it is added. If still not works, send project to my email without .o files which are tooo big.
      PS: Download my project template and check for differences in project structure.

  • David Perkins

    “When you need to add modules to your project, just hit right click on the left at “STD_Periph_Drivers” group, click “Add Exiting files to group STD_Periph_Drivers” and find your .c files in a included folder “0-STM32F4xx_STANDARD_PERIPHERAL_DRIVERSSTM32F4xx_StdPeriph_Driversrc“”

    What application should I be in? Please provide some context!

    • As mentioned, we are talking about Keil uVision software.

  • tuvshuu

    hello guys, I have one problem. When I choose pack of stm32fxx, not a driver pack. what can ı fix it? help me guys

    • Make a clean question here please. I dont understand a bit.

  • Mark

    Hi, I received from Build Output this error:
    srcsyscalls.c(47): error: #5: cannot open source input file “sys/stat.h”: No such file or directory

    What could be it’s problem?

    • Hi,

      this are GCC related problems. Looks like syscalls.c wants stat.h file which does not exists. Try to remove include and check if it will work or check if google knows about that problem.

      • Mark

        Uncle google was my first dude to ask 🙂

        I had to remove the file syscalls and then it worked. Remving the include had done nothing 🙁

        Anyway thanks for replying 😉

  • Alina

    Hi Tilen!
    I followed all the steps correctly. But at the end, when I included stm32f4xx.h header file at the top, it got underlined as an error saying “stm32f4xx_conf.h” file not found. Why is it so? What step i might have skipped?
    Thanks in advance

    • Hello,

      as mentioned, this steps are not working anymore in new Keil versions.
      I suggest you to do this:
      1. If you are using Standard Peripheral Drivers, then go to my Github repo for F4 series and download repository with examples AND default project in Keil
      2. If you are using HAL drivers, then also go to my Github repo for HAL drivers and also download it. There is again default empty project which you can use in your projects.

      Hope this helps.

      • Alina

        I don’t really know the difference between the two drivers. I am using stm32f4 discovery board. I need to detect certain frequency sounds and then notify via gsm module that the particular sound frequency has been detected. Could you please guide me? This is my first time working on the stm32f4 discovery board. I came across your library 62 of FFT. Would that help?

        • Difference is obvious. Function names, compatibility and so on.

          Well It is quite hard project for beginner like you.
          But yeah, FFT will help for detecting frequency in signal.

  • Alina

    The ‘getting started’ guide first says to:
    ‘Check jumper position on the board, JP1 on, CN3 on (DISCOVERY selected)’.

    What does this mean? Do i have to make a connection via wires between the two? how do i know that the jumper 1 and CN3 are set to ‘on’ position?

    • Alina

      Actually my stm32f4 discovery board is not showing up in the computer folder although I have installed the drivers successfully. I thought maybe this would be the possible fault.

      • On means junper is there.

        Near usb mini you have a status led. 2 colors led. Please report status.

        • Alina

          LD1 and LD2 both are red and on constantly. Not blinking.

          • LD1 which is COM LED is 2 colors led.

            If RED led is constant ON, then communication with computer is OK.

          • Alina

            But why isn’t it showing up in the computer folder? How would I import the keil code to the board?

          • Computer folder?

            F429-DIsco is not shown as Folder in Computer.
            But ST-Link is shown in Device manager.

          • Alina

            Ok thank you. actually when I connected a nucleo board, it showed up in the computer folder as a device. I thought discovery board would do too. Thanks btw!

          • You upload program directly from keil. “Download” button does the magic.

          • Alina

            Please answer one more thing. The code is of more than 32KB. I don’t have the keil license. What other toolchain would you recommend me to use which is for free?Atollic, IAR etc.

          • Atollic is based on GCC compiler. GCC is free, so you can use it.

          • Alina

            Thank you.

  • Danm

    Hi Tilen,
    I just installed the latest version of Keil compiler, which is 5.17, then tried to install the STM Device Support Pack version 1.08(at the link you provided) instead of the current version 2.7,and that looked to work ok but there were now two packs, so I deleted the 2.7 version, but now it didn’t build and refused to use the 1.08 version, it showed an X next to 1.08 in the pack installer.

    Are you sure it’s possible to use 1.08 with the current compiler?
    Maybe I can use an older version of the UVision compiler to use your STD peripheral drivers. What version do you suggest?

    • Im using packs only for device description for compiler. I use st drivers as external files and not ones from keil packs.

  • Sever Spanulescu

    Hi everybody,

    Avoiding HAL by using the 1.08 pack is actually quite simple. In Pack Installer, at Keil::STM32F4xx_DFP (point 4), you must NOT update, but click on Previous and select 1.08 instead the last version, as in the attached picture. If you already installed 2.7, you may remove it and then install 1.08 from Previous. Let Keil cry for the last 2.7 version, but some tens of errors will be suddenly solved. Anyway, good job, Tilen!

    • That’s true what you said, except problem comes with old packs if you want use drivers on new MCU devices.

      For example, 1.0.8 pack does not support STM32F411, F410, F446, etc, so you can’t use these devices there.
      If you install newest pack and use files (standard peripheral drivers) as outside .c files (like I do in my examples) then you can avoid any problem at all.

      • Sever Spanulescu

        Sure, that’s the right general way. I just gave a quick solution for STM32F407VG. I agree that HAL for STM is not mature yet, and I haven’t used it in the last months. I tried some of my projects in IAR IDE for Discovery and they work immediately in Keil 5.17 with 1.08 pack

  • virusi

    Hey you can check for more configuration of Keil Uvision configuration

  • Matthias

    Hi Tilen,
    I have just found your site and I am really impressed about your work. I have no experience with standard library drivers and HAL drivers but I I’ve found your statement “”HAL drivers are totally failed project from ST” very interesting. What does that mean? Do you think the new HAL driver concept of Keil is flawed? You will stick to the standard library drivers? As far as I understand the HAL driver are integrated in Keil MDK, the standard drivers not. Will St provide two flavors of the drivers (HAL drivers and standard drivers?). And why do you think ST (resp. Keil) are going that way? (I hope my question makes sense, if I got everything confused, sorry for that).


    • Hello Matthias,

      you must understand from start 2 things:
      1. ST is the author of STD or HAL drivers,
      2. Keil just “use” what ST suggest for their MCUs.

      On start of Keil Middleware (Keil 5.0 up to 5.08 I think) STD drivers were used, but later HAL were used because ST thought it is better idea.

      So the idea of STD drivers is to have functions for register access, like insted of enabling one bit for USART enable like USART1->CR |= 1 << BIT_FOR_START; you use USART_Cmd(USART1, ENABLE); and USART is enabled with settings you used before. For me, very well and great idea because you have to call only functions you need. In all that functions are only basic functionalities for working. To get something really big, you have to do all job by yourself, like to get DMA for USART you need: Init DMA, Init USART, Enable DMA STREAM, Enable USART DMA, etc. But you do it yourself and you learn very good.

      With HAL, process is different. As name HAL is, Hardware Abstraction Layer, are libraries for everything. In those functions everything is enabled on start, on calling HAL_USART_Send_DMA or something like this and you already enable DMA for USART and data are sent. This is not so well from learning perspective because you need more digging to get what you need and to find out what it does.
      On other hand, this concept is the same on multiple STM32xxx families and porting project from one family to another is not so hard, where on STD drivers, it may have been tough job.

      In HAL, you have a function name same on all families but different content inside to match the same functionality for these devices.

      New series does not have STD drivers anymore but only HAL. I don't like that fact, but this is a fact we have to deal with. Now I'm using HAL for F7 series where others are not available.
      For F4 I still more like STD but there will come time I will have to switch even If I don't want it.

      • Matthias

        Hi Tilen,

        ok I got the idea and I don’t have anything against a general HAL concept but I think it is not a clever idea to have all that code generation stuff in CUBE. You’re totally depending on the guys doing that code generator and it will be hard to fix bugs. I guess what’s needed is a concept like Linux, open source with well defined interfaces and everybody has a chance to participate, fix bugs and extend features. Sure the uC manufacturer should create some kind of low level basic library to simplify stuff but on top of that I don’t like the idea to be dependent on some code generate. Especially not if this generator is coming from companies I don’t trust much in software development. (But I never used Cube so maybe I have the wrong impression). But what I like much more is the mbed IoT platform approach (or Riot), that’s a different focus but IMHO the better idea. An opinion/experience with mbed.
        And what do you recommend for starters for “old” devices? Your libraries and the STD or start with Cube?


        • You can still use HAL, but don’t use CubeMX code generator, totally failed 🙂

          I like STD because I know exactly what is going on low level, but HAL you don’t know.

          • Matthias

            Ok, that’s propably a dump question, how do I use the HAL without CubeMX? Do you mean I shall use the Stm32 Cube HaL and not the Stm32 Cube Framework (in the manage runtime environment?)

          • You have Hal drivers. Those are library files. Then you have Cube package with hal drivers and examples etc. And here is CubeMX which is project generation software.

            You need hal only to start 🙂

          • Matthias

            ok, I think I got the idea, thanks a lot.
            But what do you do with your libraries? Adapt it to the HAL drivers? And do you have an opinion about mbed Iot platform or Riot?

          • I port some to hal.

            Web platforms are most useless things ever. Some day, mbed will shut down and your projects go away.

      • Jupp Kaltofen

        Well, i am with you in the kernel of the descripted aspects about the STD vs. HAL Drivers. I am raised by using the STD-Drivers and find the way going to use the HAL’s exclusive for the F7 a strange way. I don’t want to port all my source projects to HAL because that’s maybe need service anywhere in the Feature and none of the STD are available anymore. ST had decide to use HAL instead STD Driver libs because they had changed and expand their platform to be a faster and powerful competioner to Arduino. The Nucleo board line and the the newer Discovery are use the socket/Interface design of Arduino. To get the sofware running between the board variants, they need more Hardware abstraction. Well, the created function naming started with an underscore are one of the less lucky decision.
        The second scene is the implementation of HAL in Keil’s IDE. I mean that this is a worse because you can not encapsulate the hole Project including the Driver versions that based upon. If you maybe update the HAL, your Project is maybe not works, has got a different behavior or will not compile wthout inventing more development work again. You can not freeze the entire Project.
        I am also with you in the aspect of the less readable source Code of the HAL’s because they uses hundrets of macros and definitions who’s are processed at compile time.
        Well, my conclusion of them is also similar as yours – we need to handle them or we Need to use our own solution to solve it.
        To get back the encapsulation posibillity, an alternative IDE for the used Keil IDE is required.
        The MBED Option to Flash a Firmware without an IDE is welcome but very depend on ARM’s develop Environment.

  • Jose

    I need to know how to make my own libraries and adicionarlas.

    • You need to create .c and .h files with the same name and add your functions inside.

  • Aydin Ozcan


    When I try to add a new library to project, i get the error numbered L6218E Undefined symbol bla bla. I am trying to include ADC library for my STM32F429_ILI9341_LTDC project. I have read the tutorial and followed the steps but still I am having this issue. I guess I am missing some part in tutorial. What might be the problem?

    .TargetsSTM32F429_Discoveryproject.axf: Error: L6218E: Undefined symbol ADC_CommonInit (referred from tm_stm32f4_adc.o).
    .TargetsSTM32F429_Discoveryproject.axf: Error: L6218E: Undefined symbol ADC_Init (referred from tm_stm32f4_adc.o).
    .TargetsSTM32F429_Discoveryproject.axf: Error: L6218E: Undefined symbol ADC_RegularChannelConfig (referred from tm_stm32f4_adc.o).

    • My ADC library has also described which STD libs you need to use it.

      • Aydin Ozcan

        Thanks man u are the real MVP

  • Aydin Ozcan

    Hi again,

    I am trying to implement the capacitance meter given above. For that, I need to measure the time how long it takes for voltage going from 0V to 2.5V(for example). I will use ADC functions of course but I am not sure what to use for tracking time purposes. Can you point out the functions or sample projects that use those functions if there are any?

    • Use ADC in polling or IRQ mode and check each samples and calculate voltage from ADC result.
      I’m not sure what functions you are looking for here.

  • Chu Du

    Hi Tilen,
    Can you explain to me the line 14 of Step by step configuration in Keil Uvision (Right click on Target 1 and select Add Group …, and rename it to TM) and how to use the library, such as for example “Leds and buttons for Discovery boards “

    • I assume you did not set include paths for .h files.

  • sanji winarno

    hello tilen,
    i used uvision 5.17 for stm32f407vg (discovery board).
    at step to configure pll_m, i cannot find “#define PLL_M 25” systemstm32f4xx.c (startup).
    where i can change pplm value to set 8 for 8m crystal?
    thanks you

    • Of you would read post, you would see that this tutorial does not work anymore.

  • Skandinaff

    Hi Tilen!

    So I’ve made a project, based on your FFT example with STD_Periph_libraries, but now I need to migrate it to stm32f427 MCU on a separate boadrs.

    What do I need exactly to change? I’ve tried to change device in target options, but after that, I got error “No ULINK Device found”.

    I am trying to flash my custom board using Discovery boards as a programmer.

    Would greatly appreciate any help with this matter,


    • select your device, go to “Debug” tab and choose ST-Link and in settings set the same as original was.

      • Skandinaff

        Oh, cool! It actually works, thanks.

        So, do I need any other adjustments to the project, it order to get it up and running on the 427 mcu? I am able to flash now, but device still doesn’t work as it should.

        • Saying “it doesn’t work as it should” is very abstract. Describe what is not working.
          PS: Startup files are different.

          • Skandinaff

            Yes, sorry, it sure is, let me clarify then. I’ve developed functionality of the “device” on a stm32f429 discovery board. Now, I made a PCB, though I had to use stm32f427. I’ve changed all the ports and peripherals in the project, according to specification of 427 mcu.
            Basically, device get readings from several sensors, and communicate via USART. So my only way to debug the new board is via USART and with several onboard leds. But USART doesn’t work, and I can’t get the leds to flash.

            Yes, I’m aware of Startup files, so I’ve added startup_stm32f427_437xx.s instead of startup_stm32f429_439xx.s

          • Skandinaff

            Okay, so I’ve actually got it up and running, I am able to control LEDs now.

            However, USART still doesn’t work. On the kit I’ve used USART1, with pin pack 1, and now I intended to use USART3 with pin pack 2. I’ve changed the initialization function, and others that handle packages, but still no result. Usart interrupt never occurs.

            Is there maybe something more to settings of USART that I am missing?

          • Clock control? HSE crystals are the same? they works?

          • Skandinaff

            Hm, good point! Well, I use 8 MHz crystal, same as on the kit. I also put 8 MHz in target options.

            Was there another place where I set up clock?

          • Target clock has nothing to do. in C code is everything.

          • Skandinaff

            Fair enough. Though, according to datasheet, 429 and 427 have identical in terms of clock, so I assumed that I shouldn’t change anything.
            And in which files clocks are defined? system_stm32f4xx.c ?

          • Skandinaff

            Okay, so I’ve figure out something more.
            I’ve checked the clock by putting a meander signal on some gpio and measured it with oscilloscope, it’s all good.
            The only remaining problem is USART. When I try to send a string from the device, it only sends one character and freezes. And it does not react when I send something to it.
            Are there any fundamental differences between how USART1 and USART3 work?

          • Skandinaff

            Okay, so I’ve got everything to work! Apparently there was a problem with defines in my USART implementation.
            Anyway, thanks a lot for your answers and efforts, really appreciate it.

  • John Doe

    Hey man awesome guide. But I have a question; I have set up uVision according to the guide. But when I try to open a project from your GitHUb files (by using Project > Open Project) then uVision resets all the settings we change in the guide (e.g. Options for Target 1 -stuff). Is there a wway to avoid this? If not, is there a way to open a project like that and still be able choose Device so that I can pick components in “Manage Run Time environment”?

    • What problems technically you have? In most cases, only debug settings are reset, so ULINK is selected by default.

      • John Doe

        I experienced the problem described in this link:
        And I couldn’t select the proper algorithm because the ST32F4-device hadn’t been introduced to uVisoion, or uVision had “forgotten it” when I opened the new project. The data was put to default values.

        • Reading post would actually help 😉

          “November 04, 2014: All projects on Github are updated with project template like these two above, with STD peripheral drivers and new Keil STM32F4xx packs version 2.2.0 or newer.”

      • John Doe

        I guess it’s kind of the same problem as described here aswell:
        They solved it by installing the Pack. I have the 1.0.8 installed and I’ll try to update the version. May this cause problems?

      • John Doe

        It worked to updated the PACK. Thanks for the quick answer though. 🙂

  • Aydin Ozcan

    I cannot read the same values from different ADC pins. For example, values I read from A0 and A5 are different. I couldn’t read anything related to this issue in datasheet. In addition to that if I try to read from A4 pin, G14 pin which I configured as output and high, always keeps the low value. I don’t know what may be behind this issue. I am using G13 and G14 pins for voltage sources(output) and keep toggling these pins if that is of any help.

  • Tony

    Thanks for this awesome guide. But I have a problem when I compile my program ( step 22). It comes with” 1 error Target not created filename.axf”
    Thank you!

    • I would say there is an error before that message?

      • Tony

        Thank you. It works now. The reason is I did something wrong. Thanks

  • Tony

    Hi there,
    I really got a issue after setting up Keil-MDK. I’ve been trying to search on Google but I did not get it.
    Here’s what I got when compile a new Project.
    Help me, please!

    • I’ve absolutelly never saw error like that so I have to dig this up first.

  • sill

    thanks for these great tutorials
    about HAL driver and STDPERIPH Driver… Are you still believe that HAL driver is a failure project of STM. I mean I am completely agree with you but, what you have said in 2014, is it still what you think? Why keil doesn’t support STDPERIPHs anymore???

    • Still the same opinion.
      Keil does not support because ST says what to support.

    • Sever Spanulescu

      HAL drivers are very good for their portability. It was very easy for me to use the same HAL code for Cortex M1, Cortex M4 and Cortex M7. Of course, some very useful functions are absent (for example I didn’t found a HAL one for changing the compare value in TIM), and some of them may be too slow, as they make many inside tests of the context, but they are easy to use and I recommend HAL if time is not critical. If you are interested in speed, use direct registers programming.
      I’d also say that CubeMX is very good for the initialization part of the project. If you used StdPeriph before, everything that Cube generates will be very clear and you may recognize every instruction and may modify them as you like. So Keil is right to promote HAL. You can always mix it with the registers programming.


    I am getting below error when i build the project. What is the problem ? Thanks.

    .Objectssdcard.axf: error: L6002U: Could not open file .objectsmain.o: No such file or directory

  • Jay Katira

    Hello TM, I am doing a project for GSM module , I can read http easily with your projects and all support docs. but i am expanding some functionality. In that i am getting a data from http page and store it to EEPROM, I am reading that stored data easily but for further process i need to convert it in integer form from character. then i have to on and off my I/O . But i m facing problem while i am comparing all stored data. I am storing 4 strings only. I have written c code for that. It goes in while loop once then it stuck there for rest time. If i use keil debugger then it will process it but in real time its not continuing while loop. keil has given me 32k flash programming and my program use 25k only. i cant understand whats the problem really?
    Can you help me for this?

  • Sameena Shaikh

    Under Device -> StdPeriph Drivers select Framework and all other components you will need in your program, (GPIO for pins, SPI for SPI communication..)

    Hi Tilen,
    I am very new to this. I have installed the std_peripheral_libraries. But i dont find this part in the manage run-time window. The plus sign at device just gives me st32cume framework. How can i use the std peripheral libraries???

    • There is mentioned about dropped support for SPL drivers in Keil. You don’t use SPL drivers anymore.

      • Sameena Shaikh

        Then how can i use the standard library???

        • Calm down. Stabdard library is just a name of driver. ST released new drivers, either HAL or LL, depends on knowledge and control you wanna have of device. They are all part of Cube sw. If there is no any historical background, start with LL if you want the same as it was previous in SPL.

          • Sameena Shaikh

            Yes i am working with hal libaries but after some projects got stuck with something so thought of doing it with std lib. How can i start using ur libraries keeping in mind i am a total beginner???

          • Sameena Shaikh

            I have 2 boards stm32f407 and stm32f429. I have to use both of them.

          • Sameena Shaikh

            LL driver???

          • Sameena Shaikh

            LL drivers?? Can you give me a step by step procedure to use ur libraries?

          • Then just include LL drivers to the same project and use them similar as SPL before. They are compatible with HAL and can work together.

  • NeilDegruthTR

    I installed 1.0.8 pack with file that i downloaded from Keil site. But i tried to create project STM32F411 series isn’t listed. What can i do?

    • This article is very old and in the meantime ST changed the drivers from SPL (supported in 1.0.8) to HAL or LL. LL drivers are ~replacement of SPL drivers. I suggest you to focus on STM32CubeMX software from ST to generate first project and then start from there.