Skip to content
HannesH edited this page Mar 13, 2021 · 4 revisions

Hardware Abstraction Layer

About HAL

The HAL is a low level abstraction from the hardware actually present on the board. In our case the HAL is used rarely, but we used it a lot in the beginning, so you may find this page useful if you want to start with your own project idea. It is esspecially useful if you want to run a higher level software on different hardware.

Suspend- and Resume HAL Tick

If you use NSC-Functions and are waiting at some point within that function, you might experince the issue of waiting indefinetely. This is caused by the secure code actually suspending the HAL tick. So be aware that whenever you call a NSC Function to firstly call HAL_ResumeTick and then HAL_SuspendTick().

Control Pins with HAL

There are mainly three function with which you can control the Pins on the Board:

  • HAL_GPIO_WritePin(GPIOx, GPIO_Pin, GPIO_PinState): Set or clear the Pin
  • HAL_GPIO_ReadPin(GPIOx, GPIO_Pin): Read the state of the Pin
  • HAL_GPIO_TogglePin(GPIOx, GPIO_Pin): Toggle the Pin upon each call

Pins consist of letters and numbers and are mapped to the above function in the following fashion: Pxy can be described by GPIOx and GPIO_PIN_y. For further reference consult the documentation for HAL on STM32L5 (this link will download a pdf)

Important Pins

Some Pins you might want to know what they actually control:

  • PA9 controls the red LED
  • PB7 controls the blue LED
  • PC7 controls the green LED
  • PC13 controls the User Button

Clone this wiki locally