Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Software SPI DT Overlay Package doesn't create new SPI device file #92

Closed
greenbreakfast opened this issue Apr 19, 2024 · 4 comments
Closed
Labels

Comments

@greenbreakfast
Copy link
Contributor

greenbreakfast commented Apr 19, 2024

What package does this bug affect?

onion-dt-overlay-sw-spi in openwrt-22.03 branch

Describe the bug

After installation of onion-dt-overlay-sw-spi, no new spi device file is created in the Linux OS

To Reproduce

Before installation, only spidev0.1, the hardware SPI CS1 bus is available in the /dev directory

root@Omega-665D:/# ls /dev/
autofs     mtd0       mtd4ro     mtdblock4  shm        ttyS11     ttyS6
bus        mtd0ro     mtd5       mtdblock5  spidev0.1  ttyS12     ttyS7
console    mtd1       mtd5ro     mtdblock6  stderr     ttyS13     ttyS8
full       mtd1ro     mtd6       null       stdin      ttyS14     ttyS9
hwrng      mtd2       mtd6ro     port       stdout     ttyS15     urandom
i2c-0      mtd2ro     mtdblock0  ppp        tty        ttyS2      watchdog
kmsg       mtd3       mtdblock1  ptmx       ttyS0      ttyS3      watchdog0
log        mtd3ro     mtdblock2  pts        ttyS1      ttyS4      zero
mem        mtd4       mtdblock3  random     ttyS10     ttyS5

Steps to reproduce the behavior:

  1. Connect to internet
  2. Install the package
    opkg update
    opkg install onion-dt-overlay-sw-spi
    
  3. reboot device
  4. Check if device tree overlay is applied: cat /sys/kernel/config/device-tree/overlays/sw-spi/status
    root@Omega-665D:/# cat /sys/kernel/config/device-tree/overlays/sw-spi/status
    applied
    
  5. Run ls /dev again:
root@Omega-665D:/# ls /dev/
autofs     mtd0       mtd4ro     mtdblock4  shm        ttyS11     ttyS6
bus        mtd0ro     mtd5       mtdblock5  spidev0.1  ttyS12     ttyS7
console    mtd1       mtd5ro     mtdblock6  stderr     ttyS13     ttyS8
full       mtd1ro     mtd6       null       stdin      ttyS14     ttyS9
hwrng      mtd2       mtd6ro     port       stdout     ttyS15     urandom
i2c-0      mtd2ro     mtdblock0  ppp        tty        ttyS2      watchdog
kmsg       mtd3       mtdblock1  ptmx       ttyS0      ttyS3      watchdog0
log        mtd3ro     mtdblock2  pts        ttyS1      ttyS4      zero
mem        mtd4       mtdblock3  random     ttyS10     ttyS5

No new SPI device

Expected behavior

Expecting to see a new /dev/spidev1.0 device that corresponds to the new software SPI bus

Screenshots or Console output

image

Version Info (please complete the following information):

  • Firmware version: 22.03.5 b20240122
  • Package name onion-dt-overlay-sw-spi
  • Package Version: 1.0-3
  • Repo branch: openwrt-22.03

Additional context

Deliverables

  • Changes as required to the onion-dt-overlay-sw-spi package source
  • Clear instructions/steps needed to enable software spi device on Omega2
  • Screenshots/command line output demonstrating software SPI device enabled on Omega2
@greenbreakfast
Copy link
Contributor Author

Areas to investigate:

@greenbreakfast
Copy link
Contributor Author

greenbreakfast commented May 17, 2024

Confirming /dev/spidev1.0 is created after installing latest version of the onion-dt-overlay-sw-spi package

EDIT: Will make a new release
Fix released in https://github.com/OnionIoT/OpenWRT-Packages/releases/tag/22.03.5-20240517


root@Omega-665D:/tmp# opkg update
...
root@Omega-665D:/tmp# wget http://repo.onioniot.com.s3.amazonaws.com/omega2-dev/
packages/openwrt-22.03.5/onion/onion-dt-overlay-sw-spi_1.0-5_mipsel_24kc.ipk
Downloading 'http://repo.onioniot.com.s3.amazonaws.com/omega2-dev/packages/openwrt-22.03.5/onion/oni'
Connecting to 3.5.29.229:80
Writing to 'onion-dt-overlay-sw-spi_1.0-5_mipsel_24kc.ipk'
onion-dt-overlay-sw- 100% |*******************************|  1480   0:00:00 ETA
Download completed (1480 bytes)

root@Omega-665D:/tmp# opkg install onion-dt-overlay-sw-spi_1.0-5_mipsel_24kc.ipk

Upgrading onion-dt-overlay-sw-spi on root from 1.0-3 to 1.0-5...
Installing kmod-lib-crc-itu-t (5.10.176-1) to root...
Downloading http://downloads.onioniot.com/releases/22.03.5/targets/ramips/mt76x8/packages/kmod-lib-ck
Installing kmod-lib-crc7 (5.10.176-1) to root...
Downloading http://downloads.onioniot.com/releases/22.03.5/targets/ramips/mt76x8/packages/kmod-lib-ck
Installing kmod-mmc-spi (5.10.176-1) to root...
Downloading http://downloads.onioniot.com/releases/22.03.5/targets/ramips/mt76x8/packages/kmod-mmc-sk
Installing kmod-spi-bitbang (5.10.176-1) to root...
Downloading http://downloads.onioniot.com/releases/22.03.5/targets/ramips/mt76x8/packages/kmod-spi-bk
Installing kmod-spi-gpio (5.10.176-1) to root...
Downloading http://downloads.onioniot.com/releases/22.03.5/targets/ramips/mt76x8/packages/kmod-spi-gk
Configuring kmod-spi-bitbang.
Configuring kmod-spi-gpio.
[  308.244755] kmodloader: loading kernel modules from /etc/modules.d/*
[  308.290927] spidev@0 enforce active low on chipselect handle
[  308.318023] kmodloader: done loading kernel modules from /etc/modules.d/*
Configuring kmod-lib-crc7.
[  308.454281] kmodloader: loading kernel modules from /etc/modules.d/*
[  308.486379] kmodloader: done loading kernel modules from /etc/modules.d/*
Configuring kmod-lib-crc-itu-t.
[  308.624791] kmodloader: loading kernel modules from /etc/modules.d/*
[  308.656039] kmodloader: done loading kernel modules from /etc/modules.d/*
Configuring kmod-mmc-spi.
[  308.793352] kmodloader: loading kernel modules from /etc/modules.d/*
[  308.826469] kmodloader: done loading kernel modules from /etc/modules.d/*
Configuring onion-dt-overlay-sw-spi.
root@Omega-665D:/tmp# ls /dev/
autofs     mtd0       mtd4ro     mtdblock4  shm        ttyS10     ttyS5
bus        mtd0ro     mtd5       mtdblock5  spidev0.1  ttyS11     ttyS6
console    mtd1       mtd5ro     mtdblock6  spidev1.0  ttyS12     ttyS7
full       mtd1ro     mtd6       null       stderr     ttyS13     ttyS8
hwrng      mtd2       mtd6ro     port       stdin      ttyS14     ttyS9
i2c-0      mtd2ro     mtdblock0  ppp        stdout     ttyS15     urandom
kmsg       mtd3       mtdblock1  ptmx       tty        ttyS2      watchdog
log        mtd3ro     mtdblock2  pts        ttyS0      ttyS3      watchdog0
mem        mtd4       mtdblock3  random     ttyS1      ttyS4      zero
root@Omega-665D:/tmp# ls /dev/spidev1.0
/dev/spidev1.0

@greenbreakfast
Copy link
Contributor Author

@amsiotdeveloper now that this is fixed, can you please make a new documentation ticket to update the software spi article.

The GPIOs used are now:

SPI Signal New GPIO
SCK 14
MOSI 16
MISO 15
CS 17

And a reboot is no longer required after installing the package for the new SPI device to be available

@amsiotdeveloper
Copy link
Collaborator

@greenbreakfast ticket 91 on Documentation board has been created and assigned to Tomas
OnionIoT/documentation#91

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants