Skip to content

Hardware Abstraction Layer

Tom Tzook edited this page Oct 15, 2017 · 8 revisions

The FlashLib Hardware Abstraction Layer provides abstract control of IO for several platforms, thus allowing easy development for multiple robotic platforms.

Concept

The Hardware Abstraction Layer (HAL) is a method to allow simple use with multiple platforms. It provides an abstract layer to perform IO actions with any platform allowing users to code once and use on all platforms. Each platform will have to provide an implementation for the abstraction to be used. Several built-in implementations are available, but users might have to implement their own if implementation for the wanted platform is not provided.

Using the HAL, provides our robot with the following layers of code:

HAL

  • Control Layer: The highest layer, where most user code is written. This layer consists of device usage, motion algorithms, control loops, etc.
  • Device Layer: Provides interfacing with electronic devices: Motor Controllers, Sensors, etc. User code can be written here as well, but usually it's not necessary.
  • Hardware Layer: Made out of 2 parts, this is the lowest layer. It provides electronic interfacing and IO.
    • Interface: The interface part provides an abstract code for IO usage. This part is merely abstract and does not directly interface with hardware. Since it is abstract, this code can be used for multiple platforms without a problem. This is the basic HAL.
    • Control: The control part is responsible for directly accessing the hardware on the platform. Each platform needs a separate implementation of this part, since the hardware is different. This layer contains the HAL implementations.

Implementations

Since there are a lot of platforms available on the market, we will provide implementations for only several platforms.

BeagleBone Black

BBB

Developed by BeagleBoard.org, BeagleBone Black is a cheap robotics platform. It has a 1 GHz ARM processor which runs a Linux-based OS, two 200 MHz Programmable Real-Time Units (PRUs), 512MB of DD3 RAM and 128 pin headers available with variying features, including: SPI, I2C, UART, ADC, etc.

What makes the BeagleBone Black such a great platform is its PRUs. While the main processor runs the main robot code, we can use the PRUs to perform real-time operations. Examples for such operations include real-time IO, real-time event responses, real-time calculations and more.

The Beaglebone Black currently has one implementation: A basic IO manager which runs on the ARM processor. Uses a thread to perform time sensitive tasks, but cannot promise to perform them with accuracy. The actuall IO interation is done with the help of the BBBIOlib.