We have upgraded the community system as part of the upgrade a password reset is required for all users before login in.

How to use soft spi on Omega2+?



  • Hello.

    I need to install and use spi-gpio-driver from https://github.com/OnionIoT/spi-gpio-driver/. But when I trying to compile it I got error:

    root@Omega-3079:~# cd spi-gpio-driver-master/
    root@Omega-3079:~/spi-gpio-driver-master# make
    CC: gcc
    CCFLAGS:
    LDFLAGS:
    LIB:
    INC: -I include
    SOURCES: src/onion-spi.c
    OBJECTS: build/onion-spi.o
     gcc -g  -I include  -c -o build/onion-spi.o src/onion-spi.c
    In file included from src/onion-spi.c:1:0:
    include/onion-spi.h:21:25: fatal error: onion-debug.h: No such file or directory
    compilation terminated.
    make: *** [makefile:71: build/onion-spi.o] Error 1
    root@Omega-3079:~/spi-gpio-driver-master#
    

    I also tried to install spi-gpio kernel module, but it is not installed:

    root@Omega-3079:/# opkg install kmod-spi-gpio
    Installing kmod-spi-gpio (4.14.81-1) to root...
    Downloading http://repo.onioniot.com/omega2/packages/core/kmod-spi-gpio_4.14.81-1_mipsel_24kc.ipk
    Collected errors:
     * satisfy_dependencies_for: Cannot satisfy the following dependencies for kmod-spi-gpio:
     *      kernel (= 4.14.81-1-4d99ecc9745adb4d8a275d8e3a38961b) *         kernel (= 4.14.81-1-4d99ecc9745adb4d8a275d8e3a38961b) *
     * opkg_install_cmd: Cannot install package kmod-spi-gpio.
    root@Omega-3079:~/spi-gpio-driver-master# opkg list-installed | grep kernel
    kernel - 4.14.81-1-10b6683764d58480e54ef73aa783b9bb
    

    What package provide these include files?
    How to use soft spi on Omega2+ in python3? I need to use this driver from C program too.

    My firmware is:

    root@Omega-3079:~/spi-gpio-driver-master# oupgrade -v
    > Device Firmware Version: 0.3.2 b233
    

    Thanks.



  • I am fully recompiled all Omega firmware, now my kernel have all spi drivers:

    root@Omega-3079:/# lsmod | grep spi
    regmap_spi              1274  0
    spi_bitbang             2661  1 spi_gpio
    spi_gpio                5424  0
    spidev                  6336  0
    

    I also successfully compiled driver spi-gpio-driver-master using some additional required files from firmware sources. For example, onion-debug.h was found in i2c-exp-driver, etc.
    After spi-gpio-driver-master compile I have spi-tool utility, libonionspi.so and python onionSpi.so module.

    But I don't see soft-spi device in /dev:

    root@Omega-3079:~# ls -l /dev/spi*
    crw-------    1 root     root      153,   0 Dec  6 16:29 /dev/spidev0.1
    

    /dev/spidev0.1 -- hardware SPI, used python3-spidev driver.
    But spi-tool utility, libonionspi.so and python onionSpi.so used /dev/spidev%d.%d device too.

    As I think spi_gpio driver should create some other device in /dev. May be I should run some "activate procedure" for spi_gpio kernel driver?
    Or https://github.com/OnionIoT/spi-gpio-driver too old and it cannot work with some latest Omega's Linux kernels?

    dmesg outputs only hardware /dev/spidev0.1:

    root@Omega-3079:/# dmesg | grep spi
    [    0.371163] spi-mt7621 10000b00.spi: sys_freq: 193333333
    [    0.382341] m25p80 spi0.0: mx25l25635e (32768 Kbytes)
    [    0.387589] 5 fixed-partitions partitions found on MTD device spi0.0
    [    0.394049] Creating 5 MTD partitions on "spi0.0":
    root@Omega-3079:/#
    

    any other spi device does not create.


Log in to reply
 

Looks like your connection to Community was lost, please wait while we try to reconnect.