1
\$\begingroup\$

it seems that:

  1. ST has moved to Cubemx code initializer and generates only HAL drivers
  2. Keil has introduced DFP and Manage-Run-time-Environment which use HAL drives

although ST's cubemx and Keil's run-time-env so useful are so handy, but HAL drivers are somehow buggy yet. meanwhile there are lots of codes on git-hub,etc for Stm32F4 all written with Standard Peripheral Libraries(std_lib) .

Is it possible to use both Standard Peripheral Library and HAL drives together in one Keil project?

\$\endgroup\$
2
  • 1
    \$\begingroup\$ You could probably use a mix, if you use only one of them for a given peripheral, or keep track of what each are up to, but it's not exactly the cleanest practice. You really should clean up the preface to your question, and it is HAL with only one "L" for layer. \$\endgroup\$ May 29, 2016 at 6:16
  • \$\begingroup\$ thanks for the answer, how may i use both of them? does cubemx suggest a way to do that? (by the way HALL changed to HAL mistype!) \$\endgroup\$
    – HsVz
    May 29, 2016 at 8:40

1 Answer 1

1
\$\begingroup\$

Yes, it's quite possible and it has saved my life for a project I was working on where I had everything built around HAL.

Believe it or not, I kept resisting the transition to that HAL thing for so long, until I found myself forced to use it for my project due to many advantages it provides on certain aspect.

However, part of my project is to control a slave device over SPI and I had the library for the SPL from ST. After spending a tremendous time trying to solve an issue I had with the receive part of the SPI over HAL, and after giving up trying hundreds of examples and code snippets for the SPI, I have finally managed to figure it out by mixing the SPI driver from the SPL with the rest of my project, which was built with HAL.

Here's what I did in Keil uVision to get it to work for me without any problem. I have created pre-compiled objects for the SPI and any dependencies used by SPI and had those imported/linked into my HAL project. Of course, I have removed everything about HAL_SPI in the project and now the project compiles and runs quickly and smoothly. I can now drive my device with the SPL based SPI functions, and still enjoy what HAL has to offer for the remaining modules of the project.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.