Odyssey J4105 SPI device problem

Hello everybody,

I have a problem with the SPI device /dev/spidev1.0 or /dev/spidev1.1 under Ubuntu 20.04.3 LTS (Linux eofmc 5.11.0-40-generic #44~20.04.2-Ubuntu SMP Tue Oct 26 18:07:44 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux).

I have two IOT boards from PI-Plates (https://pi-plates.com/) currently connected to the 40pin header. This is the PI-Plates DAQC2 and RELAY board. My program accessing the SPI device from Linux user space and also using the GPIO provided by /sys/class/gpio. The boards requires a listening trigger at BCM25 (header pin 22). The GPIO works, but the SPI device does not response correct values. The WIKI of the Odyssey SBC shows SPI-0 but the Linux system show spidev1.0 and spidev1.1. I’m a bit confused which is right now?.
A simple test should response the same value that sent to the PI-Plates board. I made some combination but nothing works. BTW: The same program works fine with Raspberry PI 3+.

Here my log of the test application:

GPIOFS: Opened: BCM25 (PI-Plates DigOut - Frame control) pin 22 bcm 25 sys 390
GPIOFS: Set pin 22 direction “out”
GPIOFS: Write pin 22 active_low 0
GPIOFS: Opened: BCM22 (PI-Plates DigIn - Interrupt signal) pin 15 bcm 22 sys 413
GPIOFS: Set pin 15 direction “in”
GPIOFS: Set pin 15 edge “raising”
GPIOFS: Write pin 15 active_low 0
SPIDEV: Open SPI device: “/dev/spidev1.1”
SPIDEV: SPI OP mode…: 4
SPIDEV: Bits per word.: 8
SPIDEV: Read delay…: 20
SPIDEV: Write delay…: 60
SPIDEV: CS change…: 1
SPIDEV: Xfer speed.kHz: 500
SPIDEV: Max speed…kHz: 1000
SPIDEV: Connected to device: “/dev/spidev1.1”
GPIOFS: Write pin 22 value 1
GPIOFS: Read pin 22 value “1”
SPI-TX | 19 00 00 00 __ __ __ __ __ __ __ __ __ __ __ __ | …
SPI-RX | ff __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | ff __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | ff __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | ff __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | ff __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | ff __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | ff __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | ff __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
GPIOFS: Write pin 22 value 0
GPIOFS: Read pin 22 value “0”
PP-DEV: Hardware “RELAY” at address “0x19” not found.

Has anyone some ideas what’s wrong?

Best regards

PS: Raspberry PI output:
GPIOFS: Opened: BCM25 (PI-Plates DigOut - Frame control) pin 22 bcm 25 sys 25
GPIOFS: Set pin 22 direction “out”
GPIOFS: Write pin 22 active_low 0
GPIOFS: Opened: BCM22 (PI-Plates DigIn - Signal to interrupt) pin 15 bcm 22 sys 22
GPIOFS: Set pin 15 direction “in”
GPIOFS: Set pin 15 edge “raising”
GPIOFS: Write pin 15 active_low 0
SPIDEV: Open SPI device: “/dev/spidev0.1”
SPIDEV: SPI OP mode…: 4
SPIDEV: Bits per word.: 8
SPIDEV: Read delay…: 20
SPIDEV: Write delay…: 60
SPIDEV: CS change…: 1
SPIDEV: Xfer speed.kHz: 500
SPIDEV: Max speed…kHz: 125000
SPIDEV: Connected to device: “/dev/spidev0.1”
GPIOFS: Write pin 22 value 1
GPIOFS: Read pin 22 value “1”
SPI-TX | 19 00 00 00 __ __ __ __ __ __ __ __ __ __ __ __ | …
SPI-RX | 19 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
GPIOFS: Write pin 22 value 0
GPIOFS: Read pin 22 value “0”
PP-DEV: [GPIO config] -----------------------------------
PP-DEV: Interrupt pin…: 15
PP-DEV: Frame control pin.: 22
PP-DEV: Acknowledge pin…: 0
PP-DEV: [PI-Plate config] -------------------------------
PP-DEV: Plate base address: 0x18
PP-DEV: SPI address…: 0x19
PP-DEV: SPI device…: /dev/spidev0.1
PP-DEV: [Board specific] --------------------------------
PP-DEV: Address…: 0x01
GPIOFS: Write pin 22 value 1
GPIOFS: Read pin 22 value “1”
SPI-TX | 19 01 00 00 __ __ __ __ __ __ __ __ __ __ __ __ | …
SPI-RX | 50 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | P
SPI-RX | 69 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | i
SPI-RX | 2d __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | -
SPI-RX | 50 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | P
SPI-RX | 6c __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | l
SPI-RX | 61 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | a
SPI-RX | 74 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | t
SPI-RX | 65 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | e
SPI-RX | 20 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 52 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | R
SPI-RX | 45 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | E
SPI-RX | 4c __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | L
SPI-RX | 41 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | A
SPI-RX | 59 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | Y
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
GPIOFS: Write pin 22 value 0
GPIOFS: Read pin 22 value “0”
PP-DEV: Board ID…: “Pi-Plate RELAY”
PP-DEV: Board Name…: “RELAY”

Hello… After updating the BIOS with firmware version SD-BS-CJ41G-300-101-F, the SPI device responds from the PI-Plate board. Unfortunately, the bit width for one byte is 40 bits. I configure the SPI with 8 bits per word with SPI_IOC_WR_BITS_PER_WORD/SPI_IOC_RD_BITS_PER_WORD. The data seems to be sent correctly to the SPI slave because sometimes the correct response is sent back correctly. Here is the protocol of my application: as you can see, the first answer should be 19 00 00 00 and the second PI-Plates RELAY.

GPIOFS: Opened: BCM25 (PI-Plates DigOut - Frame control) pin 22 bcm 25 sys 390
GPIOFS: Set pin 22 direction “out”
GPIOFS: Write pin 22 active_low 0
GPIOFS: Opened: BCM22 (PI-Plates DigIn - Interrupt signal) pin 15 bcm 22 sys 413
GPIOFS: Set pin 15 direction “in”
GPIOFS: Set pin 15 edge “raising”
GPIOFS: Write pin 15 active_low 0
SPIDEV: Open SPI device: “/dev/spidev1.1”
SPIDEV: SPI OP mode…: 4
SPIDEV: SPI OP mode.32…: 0
SPIDEV: Bits per word…: 8
SPIDEV: Bit justification: 0
SPIDEV: Read delay…: 20
SPIDEV: Write delay…: 60
SPIDEV: CS change…: 1
SPIDEV: Xfer speed.(kHz).: 500
SPIDEV: Connected to device: “/dev/spidev1.1”
GPIOFS: Write pin 22 value 1
GPIOFS: Read pin 22 value “1”
SPI-TX | 19 00 00 00 __ __ __ __ __ __ __ __ __ __ __ __ | …
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 19 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
GPIOFS: Write pin 22 value 0
GPIOFS: Read pin 22 value “0”
PP-DEV: [GPIO config] -----------------------------------
PP-DEV: Interrupt pin…: 15
PP-DEV: Frame control pin.: 22
PP-DEV: Acknowledge pin…: 0
PP-DEV: [PI-Plate config] -------------------------------
PP-DEV: Plate base address: 0x18
PP-DEV: SPI address…: 0x19
PP-DEV: SPI device…: /dev/spidev1.1
PP-DEV: [Board specific] --------------------------------
PP-DEV: Address…: 0x01
GPIOFS: Write pin 22 value 1
GPIOFS: Read pin 22 value “1”
SPI-TX | 19 01 00 00 __ __ __ __ __ __ __ __ __ __ __ __ | …
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 50 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | P
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 69 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | i
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 2d __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | -
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 50 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | P
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 6c __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | l
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 61 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | a
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 74 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | t
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 65 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | e
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 20 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 52 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | R
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 45 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | E
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 4c __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | L
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 41 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | A
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 59 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | Y
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | ff __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | ff __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .
SPI-RX | ff __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | .