Main menu

Post navigation

Erlang/ALE Update

We have spent the past couple of weeks adding more peripherals to Erlang/ALE, our library for embedded systems. The first version of ALE only had support for General Purpose I/O (GPIO) but with the recent commits we have added I2C, SPI and PWM. You can fetch the latest version at our Github repository.

Raspberry Pi is still our reference platform but in order to make ALE more universal we have started working on defining a platform abstraction mechanism that will enable supporting other boards and architectures easily. The way this works is simple: ALE consists of platform independent layers that interface with a collection of platform specific, low level drivers that provide access to hardware. This is demonstrated by the diagram below.

The highest level provides the peripheral APIs, such as GPIO, I2C, SPI and PWM, allowing Erlang applications access these hardware units. These are implemented following the OTP standards, using gen_server and supervision hierarchies.

The Middle layer is the interface mechanism, a glue layer between Erlang and the low level C drivers. It deals with the translation of Erlang terms to and from C types, using the interfacing mechanisms provided by Erlang: Ports and NIFs.

In the lowest layer we find the peripheral implementations that contain the specific instructions to access the hardware peripheral on the silicon device. As mentioned before, ALE on its own does not include drivers for any specific architecture. On our reference platform, the Raspberry Pi, we achieve this by using pihwm as our peripheral implementation layer.

While the platform architecture is still under development, you can find the documentation for the peripheral APIs and the interface mechanism here.

As always, comments and suggestions are welcome. Drop us an email or post a comment here.