How to turn on SPI feature on NanoPi Fire 3 running Dietpi

I am definetly having trouble with this board because there really is not that much information I could find on the internet.

The problem is I recently try to add a ADXL345 to the board but Dietpi doesn’t seem to have SPI turned on by default, and I have no idea where to start looking, I have checked Dietpi-Config, found nothing related to SPI there.

Plaese Help!!!

In dietpi-config → advanced options i see an entry “SPI state”.

MichaIng can you have a look pls.

I had a look into the image. Similar like NanoPi 2 series, the S5P6818 SoC based NanoPi M3/Fire3 and NanoPC T3 have a hopelessly outdated kernel provided by FriendlyELEC only, support never made it into upstream Linux. We use the slightly newer Linux v4.14 by Armbian (vs v4.4 by FriendlyELEC), but there are no device tree overlays (anyway not supported by this Linux version) and the U-Boot config is very minimal with no hints about additional features. So I’m AFRAID if the SPI interface is not available OOTB, there is nothing we are able to do :frowning:.

Also on the FriendlyELEC wiki, there are instructions about how to enable it for a bunch of other SoCs, but not S5P6818:

But let’s have a least a look whether there are related kernel modules available:

find /lib/modules -name '*spi*'

I got these modules after running

find /lib/modules -name ‘spi


then I ran

modprobe adxl345_spi

nothing shows in

ls /dev/spi*

That adxl345_spi module looks so well. Das it have options?

modinfo adxl345_spi

Sorry for such delay, held up recently.

modinfo adxl345_spi Shows

filename: /lib/modules/4.14.180-s5p6818/kernel/drivers/iio/accel/adxl345_spi.ko
license: GPL v2
description: ADXL345 3-Axis Digital Accelerometer SPI driver
author: Eva Rachel Retuya
alias: spi:adxl345
alias: of:NTCadi,adxl345C*
alias: of:NTCadi,adxl345
depends: adxl345_core
intree: Y
name: adxl345_spi
vermagic: 4.14.180-s5p6818 SMP mod_unload aarch64`

Before the driver can serve the ADXL345 you have to wire it up in the devicetree.

but as Michalng mentioned up a few posts, the kernel does not have device tree overlays, that’s the tricky part.

and I asked friendlyarm official support about this issue, who have replied a not so friendly answer, that in order to use spi feature with this board, I have to write my own driver for it.

Then I ask if there were any technical supports or document related to spi specifically, they said not able to provide any of that because this board has simply gone out of production.

Devicetree overlays can be written, that’s not the problem, but if your kernel doesn’t have a driver for the SPI IP, then you lose. A look at the base devicetree may provide indications of unactivated SPI master nodes. But if there are no traces, there is a high probability that there is no support.

Since the SPI IP is usually part of the SOC, the TRM should provide all the necessary information, nothing is board-specific except ultimately the outer wiring. And this should be described by devicetree for the driver.

1 Like

Let’s have a look at the device tree for toggles then:

find /proc/device-tree -name status | while read -r line
echo "$line: $(<"$line")"

Thanks for helping out.
I ran the code, but returns nothing.

A look at the DTB source code should be more meaningful here because you do not know the exact search term before.

I found this blog has a lot of information about this board,

The devicetree disassembly shown there contains three deactivated SPI instances:

spi0 = “/soc/spi@c005b000”;
spi1 = “/soc/spi@c005c000”;
spi2 = “/soc/spi@c005f000”;

An overlay for spi0 would look something like this, but since I don’t know the real wiring, the values used (interrupt-parent, interrupts) are incomplete:

// SPDX-License-Identifier: (GPL-2.0+ OR MIT)

/ {
<---->compatible = “nexell,s5p6818”;

&{/soc/spi@c005b000} { // spi0
<---->#address-cells = <1>;
<---->#size-cells = <0>;
<---->status = “okay”;

<---->accelerometer@0 {
<----><------>compatible = “adi,adxl345”;
<----><------>reg = <0>;
<----><------>spi-max-frequency = <5000000>;
<----><------>interrupt-parent = <&gpio1>;
<----><------>interrupts = <0 IRQ_TYPE_LEVEL_HIGH>;

In addition, it is unclear whether kernel driver support for compatible = "nexell,s5p6818-spi"; is available.

1 Like

Since no /proc/device-tree/**/status exist, is it possible to still enable it that way or may that kernel build simply not support device tree overlays? It is still based on the original kernel by FriendlyELEC Linux v4.4, Armbian just managed to raise the base version to 4.14. For this SoC I wasn’t able to find newer mainline Linux builds.

My overlay enables a fully defined SPI master device node, if no predefined node exists you have to provide all properties.

There is nothing a kernel needs to support for the application of a DTBO, the kernel uses a DTB and cannot even determine how it is maybe composed. The DTB is assembled before the kernel starts.

The absence of predefined nodes suggests that there is no driver support and adding the devicetree properties does not magically generate the driver code. Look in the sources for a driver that supports nexell,s5p6818-spi

Okay, so most importantly we’d need a kernel driver for this SoC’s SPI.

Exactly, and since s5p6818 nor nexell is mentioned in mainline devicetree binding documentation, it can be assumed that the blog post refers to a legacy kernel fork. The available driver is probably in an unusable state for mainline usage, so that hardkernel answered like this:

1 Like