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

Getting two chip select pins working with /dev/spi0 on the Coral Dev Board Mini #2

Open
asymingt opened this issue Nov 22, 2022 · 0 comments

Comments

@asymingt
Copy link

asymingt commented Nov 22, 2022

Description

I'm having a crazy hard time getting two SPI devices to work with the spidev driver in mendel on the Google Coral Dev Board Mini. I modified the device tree in the following way to get two adjacent pins (GPIO5 and GPIO8) functioning as chip selects for two devices on the same bus.

diff --git a/arch/arm64/boot/dts/mediatek/mt8167-coral.dts b/arch/arm64/boot/dts/mediatek/mt8167-coral.dts
index c08bb12162fc..2550f2cfb9d7 100644
--- a/arch/arm64/boot/dts/mediatek/mt8167-coral.dts
+++ b/arch/arm64/boot/dts/mediatek/mt8167-coral.dts
@@ -301,8 +301,9 @@
                pins1 {
                        pinmux = <MT8167_PIN_3_EINT3__FUNC_SPI_MI>,
                                 <MT8167_PIN_4_EINT4__FUNC_SPI_MO>,
-                                <MT8167_PIN_5_EINT5__FUNC_SPI_CSB>,
-                                <MT8167_PIN_6_EINT6__FUNC_SPI_CLK>;
+                                <MT8167_PIN_6_EINT6__FUNC_SPI_CLK>,
+                                <MT8167_PIN_5_EINT5__FUNC_GPIO5>,
+                                <MT8167_PIN_8_EINT8__FUNC_GPIO8>;
                        bias-disable;
                };
        };
@@ -647,6 +648,8 @@
        status = "okay";
        pinctrl-names = "default";
        pinctrl-0 = <&spi_pins>;
+       cs-gpios = <&pio 5 GPIO_ACTIVE_HIGH>,
+                  <&pio 8 GPIO_ACTIVE_HIGH>;
        spidev@0 {
                #address-cells = <1>;
                #size-cells = <1>;
@@ -654,6 +657,13 @@
                spi-max-frequency = <2000000>;
                reg = <0>;
        };
+       spidev@1 {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               compatible = "rohm,dh2228fv";
+               spi-max-frequency = <400000>;
+               reg = <1>;
+       };
 };
 
 &pwm {

The system boots and I see /dev/spi0.0 and /dev/spi0.1 enumerated, but communication fails. It's unlikely to be an electrical issue because I'm using a production board (PXFMINI) that has previously worked with a raspberry pi zero. Is there any chance that the SPI chip itself is not respecting the pinmux and using CSB despite my request not to?

Click to expand!

Issue Type

Performance

Operating System

Mendel Linux

Coral Device

Dev Board Mini

Other Devices

No response

Programming Language

Other

Relevant Log Output

No response

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

No branches or pull requests

2 participants