Please enable javascript, or click here to visit my ecommerce web site powered by Shopify.
Jump to: navigation, search

ROCK Pi 4 now supports libmraa and device tree overlay

Community Updates

A lot of our users want to use the HATs on ROCK Pi 4, HATs stands for Hardware AT Top. HATs can extend the hardware capabilities without making one, it's highly welcomed by makers and diyers or even professional projects. The compatibility design of ROCK Pi 4 makes it can work with a lot of existing HATs on the market. That's on the hardware side. What frees and empowers the ROCK Pi 4's 40pin GPIO is the update we are going to introduce today, the device tree overlay support and the libmraa.


Device tree is widely used in ARM Linux world to describe the hardware, so the kernel knows the hardware resources such as memory addresses, gpio assignment, IRQ number etc. But on the HATs world, the hardware resources are dynamic, the users may use different HATs and different HATs requires different resources, the kernel should know that the user has changed the hardware. The way to update the device tree without recompile the device tree blob is called device tree overlay.

To use device tree overlay, you need to install the latest u-boot, u-boot will parse and load the dtbo files before booting the kernel. Also, you need to update to the latest kernel, which we provide a hardware configuration files on `/boot/hw_intfc.conf`, which shows as below:

# Hardware Interface Config


# DTS Overlay Config
# 1. check the name.dtbo in /boot/overlays
# 2. add intfc:dtoverlay=name as below


You can just enable/disable the buses by set on/off, and load the dtbo with the `intfc:dtoverlay=xxx.dtbo`. The detailed parameter explanation can be found on the Rockpi4/hardware/devtree_overlays page.

MRAA is a project by Intel, now maintained as an open source project.

Libmraa is a C/C++ library with bindings to Java, Python and JavaScript to interface with the IO on some hardware platforms, with a structured and sane API where port names/numbering matches the board that you are on. Use of libmraa does not tie you to specific hardware with board detection done at runtime you can create portable code that will work across the supported platforms.

We have added libmraa support for ROCK Pi 4 and made a debian package. Pull requests are sent to the official libmraa, hope it will be officially supported soon. For more detailed usage of libmraa, please refer the Rockpi4/dev/libmraa wiki page.

With libmraa and device tree overlay, we can support a wide of HATs and sensors, users can program it with some high level languages such as python or javascripts. If you have some project ideas, let us know.

-- Radxa Team, 2019 in Baoan, Shenzhen, China