ROCK Pi 4 Now Supports Libmraa and Device Tree Overlay
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 possible to 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 intfc:pwm0=off intfc:pwm1=off intfc:uart2=off intfc:uart4=off intfc:spi1=off intfc:spi2=off intfc:i2c2=off intfc:i2c6=off intfc:i2c7=off # DTS Overlay Config # 1. check the name.dtbo in /boot/overlays # 2. add intfc:dtoverlay=name as below #intfc:dtoverlay=at24c02 #intfc:dtoverlay=two-color-led intfc:dtoverlay=console-disabled #intfc:dtoverlay=console-on-uart4 #intfc:dtoverlay=devspi
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.
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.