How to improve hardware programming skills?
First of all,


  
    An engineer that I met suggested me to skip all these things and fresh start with fpga boards but that confused me even more.
  


FPGAs and uCs are very different things programmed in very different ways with only a few of similarities. Both skills are quite usefull, yet these are two different areas that one should not unite.

If I were you, I'd stay with the STM32 both trying the SPL and HAL. A bit more difficult projects, like, for example, a single-channel oscilloscope with spectrum display (The STM32F407 should be more that enough for this), will teach you a lot especially on this family of microcontrollers.


  
    All examples gives error and I stuck in there.
  


Figuring out the errors and fixing them will give you far more experience than just copying the examples and studying the way they work.

Lastly, it is still possible today to code using SPL, it is not completely "killed", it is rather "not recommended" or "obsolete". Try changing your toolchain, maybe? I ain't got any problems with SPL on an Eclipse toolchain on xUbuntu 16.04.