SPI Device Interface

Hey, I'm pretty new to thus stuff, so I appreciate any help I can get.

I'm trying to get the Le Potato to communicate to some Arduinos using a NRF24L01.
I think I should be able to interface using this RF24 library (https://github.com/nRF24/RF24), but trying the example results in: Unable to open SPI device: No such file or directory

It's looking for the device at /dev/spidev0.0, which doesn't exist.

I started out with the Ubuntu images from Libre Computing, and got frustrated.
So, I tried loading their Raspbian image and using the raspi-config to enable the SPI interface.
...still no luck (after verifying the /boot/config.txt contains dtparam=spi=on, and rebooting)

I took a look at some forum posts that reference device-tree overlays, but I'm really not sure what I'm doing with them.
This one never really seems to come to a usable conclusion:
https://forum.armbian.com/topic/6448-le-potato-gpio-pins-on-sys/
...maybe I just don't understand what they are talking about.

This one references a new linux source, and I'm not sure how to compile it for Le Potato, and that seems like a lot of effort unless I'm sure it will work:
https://github.com/libre-computer-project/libretech-overlays

Again, my goal is just to get this communicating through the NRF24L01 through the SPI interface.
I don't care which OS I use, as long as I can do that... and run a NodeJS server.
If anyone has had any amount of success with this board, I would love to hear how you got there.

Thank you in advance for your responses!

Tagged:
Tagged:

Comments

  • edited October 24

    The driver for SPI CC is already in the kernel. https://lore.kernel.org/patchwork/patch/790416/
    It needs to have the proper device tree bindings to bind GPIO pins to the SPI driver. You have to modify the dtb file by decompiling it first, adding the SPI nodes, and then compiling it.

    Device tree overlay support is still not in the Linux kernel itself and we plan to add support for them in approximately two months. The Raspberry Pi way of doing it is very proprietary and should not be used as a reference for anything in Linux. Right now you have to do the dtb mods by hand.

  • Thank you very much for the reply!

    Most of my development has been in the Windows world, so I'm still figuring out the lower level ins and outs of Linux.

    When you say support is in the kernel, does that mean any of the distros provided in the downloads section of the Le Potato page will support it, os it doesn't matter which one I use? (https://libre.computer/products/boards/aml-s905x-cc/)

    I found some examples for how to decompile a dtb file (http://beginlinux.blogspot.com/2014/01/convert-back-dtb-to-dts-file.html), but I'm not sure where to find the dtb file that needs to be decompile, or what I need to add to enable the SPI nodes; I assume the dtb file will be specific to the distribution? And the SPI nodes will be specific to Le Potato?

    If you have the information on exactly where the dtb file is, and exactly what needs to be added, that would be most appreciated. If you do not have that information, if you can point me to a good resource that will guide me further, that would also be appreciated.

    Thank you again!

  • It's a bit complex unless you've worked in embedded. Device trees were developed by IBM for their Power architecture. It is a substitute to the standardized BIOS mechanics of x86/Windows.

    Device tree is a hardware description and binding. It lets an operating system like Linux know how the hardware is laid out and what drivers to use with which IO. It requires some reading. As for the patches needed to the device tree file, you can find more info here:

    https://patchwork.kernel.org/patch/9746585/

    Otherwise Google is your friend. Be sure also to use the schematics on the libre.computer website under the product support tab. It takes a bit of learning but it will be very useful for any future tinkering with Linux and ARM based systems since this is the standard of how things should be done.

  • edited October 30

    Actually the overlay infrastructure is already done by BayLibre for Libre Computer. We haven't integrated the work yet because we've been pretty busy engineering wise. Look for it soon.

Sign In or Register to comment.