Navio 2 driver for raspbian?

I’m using Raspberry Pi 3 and Navio 2 for a real time drone project where the latency is a major concern. I wanted to use Fully Preemptible Kernel on Emlid image, but there does not seem to be any real-time patch for version 4.4.36 (Is the kernel source code here?). So I started with a stock Raspbian 4.4.50.

I found this rcio-dkms repository which seems to be the drivers for Navio 2. I cross-compiled it and it installed fine. Using lsmod I can see the rcio_core and rcio_spi are running. However, when I start PX4 the PWM is not working properly.

ERROR [linux_pwm_out] PWM period failed
ERROR [linux_pwm_out] PWM: Failed to open duty_cycle.
ERROR [linux_pwm_out] PWM output init failed

The Raspbian I’m using is Linux raspbian 4.4.50-rt63-v7+ #2 SMP PREEMPT. I want to know if I’m doing anything wrong or installing this module is not enough to make Navio 2 run on raspbian? This is my first time compiling a driver for linux, any help would be appreciated.

Or if anyone can tell me how to enable Fully Preemptible Kernel on Emlid image 4.4.36-a7765e7-emlid-v7+ #41 would be awesome as well.

Thank you.

I just compiled the emlid-stable-4.4 kernel from source, this does not seem to have drivers for Navio 2 as well?

Hi Jiyang,

Have you figured it out?

Hi Tatiana,

Unfortunately, I’m still trying to figure this out.

Basically, I think there are two choices. I can try to make the drivers work on a customized RT patched raspbian. However, the rcio-dkms I found on emlid github repository does not seem to work well. The following shows when inspecting with dmesg

rcio spi1.0: rcio_gpio: GPIO is not supported on this firmware
rcio spi1.0: rcio_pwm: Error in pwm running count

My second choice is to patch a Emlid raspbian or just configure it to be fully-preemptible. But the source code in github seems to be outdated and does not have drivers either.

I’m currently looking for some possible user-space drivers. Do you have any better suggestions? Thank you very much.

Have you tried to update the firmware with emlidtool rcio update?

Hi Jiyang,

Did the firmware update help?

Hi Tatiana,

It didn’t work. There isn’t a “rcio” option in the emlidtool. Here is the output after running emlidtool rcio update

usage: emlidtool [-h] [-v] {info,test,ardupilot} ...
emlidtool: error: invalid choice: 'rcio' (choose from 'info', 'test', 'ardupilot')

The emlidtool version is 0.8.8.

I was able to upgrade emlidtool to 1.0.7 and updated the rcio firmware successfully. After using insmod for the two kernel module (rcio_core.ko, rcio_spi.ko) built from rcio-dkms, the emlidtool shows all parts run successful.

emlidtool version: 1.0.7
Vendor: Emlid Limited
Product: Navio 2
Issue: Emlid 2017-03-23 5e28de2c424cadfb61a62b88e9c0af98a6d25545
Kernel: 4.4.36-rt49-emlid-v7+
RCIO firmware: 0xfd610bbf
2018-08-14 02:12:12 raspbian root[1040] INFO adc: Passed
2018-08-14 02:12:12 raspbian root[1040] INFO pwm: Passed
2018-08-14 02:12:12 raspbian root[1040] INFO rcio_status_alive: Passed
2018-08-14 02:12:12 raspbian root[1040] INFO lsm9ds1: Passed
2018-08-14 02:12:12 raspbian root[1040] INFO gps: Passed
2018-08-14 02:12:12 raspbian root[1040] INFO mpu9250: Passed
2018-08-14 02:12:12 raspbian root[1040] INFO ms5611: Passed

However, when using PX4, I’m still getting errors

ERROR [linux_pwm_out] PWM enable failed
ERROR [linux_pwm_out] PWM period failed
ERROR [linux_pwm_out] PWM: Failed to open duty_cycle.
ERROR [linux_pwm_out] PWM output init failed

The Servo example in /Navio2/C++/Examples/Servo doesn’t run either.
Can't init channel 0

Any help? Still haven’t found a way to make the pwm works.

Hi @chenjiyang1991,

It’s not an easy task and it requires a lot of work and maybe some additional research. I hardly can provide you with a detailed description of all step-by-step actions, however, I recommend you to try to repeat it with our 4.14 RPi firmware.

Please try to follow this steps with 4.14 firmware:

  • apply RT patch to it;
  • cross compile rcio-dkms against the kernel by setting KERNEL_SOURCE(?)=<path to kernel>.
1 Like

I finally solved the issue. For kernel 4.14, the latest version of rcio-dkms works well.

However, for older kernels, older drivers are needed. Specifically for kernel 4.4, I choose to use v0.8.3 as v0.6.5 does not even compile on Emlid provided image. I didn’t find a preempt patch specifically for 4.4.36, but patch for 4.4.38 seems to work. After installing the v0.8.3 rcio-dkms, the emlidtools still complains that pwm failed. But both Navio2 example code and px4 runs fine.


This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.