Jump to content

Orange pi zero 3 SPI cs pin


Go to solution Solved by mantouboji,

Recommended Posts

Posted

I'm trying to configure the CS (Chip Select) pin on my Orange Pi Zero 3. I added overlays=spi-spidev to the /boot/armbianEnv.txt file, created my own dtbo file, and tried all possible methods suggested by ChatGPT. I've been struggling for two weeks with no success. I haven't been able to switch the CE1 pin to alt4 state; it only stays off, nothing else. Is it even possible to work with SPI on this board?

Posted

CLK, MOSI, MISO is work, but CS not work.  In gpio readall : CLK1 - ALT4, MOSI1 - ALT4, MISO1-ALT4, but CE1 - OFF. How change mode CE1 to ALT4?  

Posted

But maybe I found the mistake: 

 

In DT overlay of H616, some developer set spidev devices to compate with "rohm,dh2228fv", maybe he attached a DH2228FV DAC chip?  

 

change all of sun50i-h616-spi*  dts files to 

 

`compatible = "armbian,spi-dev"; `

Posted

i'm change all of sun50i-h616-spi*  dts files to`compatible = "armbian,spi-dev" but nothing. CS is OFF! Maybe the reason is that it's called CE. In gpio readall CS is name CE.

Posted (edited)

It's working! Thank you so much, you've been a huge help. These challenges have really helped me understand device trees and hardware configuration. This forum is amazing!

Screenshot 2024-12-24 122931.png

 

IMG_20241224_123632.jpg

Edited by adif
Posted

👍🏽

 

This is a problem with a specific dts meant for the spidev driver, because I am using the spi1 bus with 2 chip selects everyday with my LCD, which doesn’t use the spidev driver (uses dedicated LCD-spi driver).


Do you have an older orange pi zero 3 Armbian image, and see if it works normally?

 

can you rebuild Armbian with ./compile.sh, choose Linux edge (latest) and see if it works normally?

Posted

I am trying to get the SPI working on my orange-pi-zero3 (h618) to enable input shaping for my 3d printer. Hope I can get some pointers to get the SPI to work.

 

Installed the following:

Minimal/IOT images with Armbian Linux v6.6

Build Date: Jan 16, 2025

 

kernel:

Linux 3dprinter 6.6.72-current-sunxi64 #1 SMP Fri Jan 17 12:36:27 UTC 2025 aarch64 GNU/Linux

 

I tried to copy the .dtbo files ( from above) to the following location:

-/boot/dtb-6.6.72-current-sunxi64/allwinner/overlay

-/usr/lib/linux-image-6.6.72-current-sunxi64/allwinner/overlay

-reboot

 

ran armbian-config and enabled system->kernel->Manage device tree overlays->enabled sun50i-h616-spidev1_1 (nothing else)

 

But I was unable to see a working spi port.

This is the output of:

 

:~$ dmesg | grep spi
[    1.367197] sun50i-h616-pinctrl 300b000.pinctrl: pin-64 (5010000.spi) status -517
[    1.367215] sun6i-spi 5010000.spi: Error applying setting, reverse things back
[    1.377494] spi-nor spi0.0: supply vdd not found, using dummy regulator
[    1.392512] spi-nor spi0.0: spi-nor-generic (2048 Kbytes)

 

lsmod | grep spi
<nothing>

 

Posted

I don't know why you copied a dtbo to /usr/lib/linux-image...

 

I think you only need spidev turned on in armbian-config

 

What shows up in ls /dev/spi* ?

 

Please show your success, if you make it work :)

Posted (edited)

>I think you only need spidev turned on in armbian-config

This is what I did first, but could not find any ( in the /dev ) spi device.  This triggered my to start searching for a solution and as far as I understand from this thread, there is a misconfiguration in the standard image. This is from the armbian website of the orange pi zero 3:

Quote

We have added overlays for i2c and uart. The spidev1_0 and spidev1_1 needs some editing and will be fixed in the future.

 

Do you expect that in an image with an build Date of  Jan 16, 2025 these fixes to get SPI to work are included?

 

>I don't know why you copied a dtbo to /usr/lib/linux-image...

Because I have very very basic understanding of the device tree. My thinking was, I do a

sudo find -name *.dtbo -printf "%c %p\n"

And see where the original files are ( that need to be changed). As I did not know what file are used during boot, I changed them both of them. I am still not really sure if you can replace these files on the sdcard and expect that they are used during boot. Is my expectation correct that I can just replace them on the sdcard and reboot, or do I need to rebuild and kernel/image ?

 

What shows up in ls /dev/spi* ?

 

/$ sudo ls /dev/spi*
ls: cannot access '/dev/spi*': No such file or directory

 

adif did get it to work and you can see that pin 24 if configured different.

$ gpio readall
 +------+-----+----------+--------+---+   H616   +---+--------+----------+-----+------+
 | GPIO | wPi |   Name   |  Mode  | V | Physical | V |  Mode  | Name     | wPi | GPIO |
 +------+-----+----------+--------+---+----++----+---+--------+----------+-----+------+
 |      |     |     3.3V |        |   |  1 || 2  |   |        | 5V       |     |      |
 |  229 |   0 |    SDA.3 |    OFF | 0 |  3 || 4  |   |        | 5V       |     |      |
 |  228 |   1 |    SCL.3 |    OFF | 0 |  5 || 6  |   |        | GND      |     |      |
 |   73 |   2 |      PC9 |   ALT6 | 1 |  7 || 8  | 0 | OFF    | TXD.5    | 3   | 226  |
 |      |     |      GND |        |   |  9 || 10 | 0 | OFF    | RXD.5    | 4   | 227  |
 |   70 |   5 |      PC6 |   ALT5 | 0 | 11 || 12 | 0 | OFF    | PC11     | 6   | 75   |
 |   69 |   7 |      PC5 |   ALT5 | 0 | 13 || 14 |   |        | GND      |     |      |
 |   72 |   8 |      PC8 |    OFF | 0 | 15 || 16 | 0 | OFF    | PC15     | 9   | 79   |
 |      |     |     3.3V |        |   | 17 || 18 | 0 | OFF    | PC14     | 10  | 78   |
 |  231 |  11 |   MOSI.1 |    OFF | 0 | 19 || 20 |   |        | GND      |     |      |
 |  232 |  12 |   MISO.1 |    OFF | 0 | 21 || 22 | 0 | OFF    | PC7      | 13  | 71   |
 |  230 |  14 |   SCLK.1 |    OFF | 0 | 23 || 24 | 0 | OFF    | CE.1     | 15  | 233  |
 |      |     |      GND |        |   | 25 || 26 | 0 | OFF    | PC10     | 16  | 74   |
 |   65 |  17 |      PC1 |    OFF | 0 | 27 || 28 | 0 | ALT2   | PWM3     | 21  | 224  |
 |  272 |  18 |     PI16 |   ALT2 | 0 | 29 || 30 | 0 | ALT2   | PWM4     | 22  | 225  |
 |  262 |  19 |      PI6 |    OFF | 0 | 31 || 32 |   |        |          |     |      |
 |  234 |  20 |     PH10 |    OFF | 0 | 33 || 34 |   |        |          |     |      |
 +------+-----+----------+--------+---+----++----+---+--------+----------+-----+------+
 | GPIO | wPi |   Name   |  Mode  | V | Physical | V |  Mode  | Name     | wPi | GPIO |
 +------+-----+----------+--------+---+   H616   +---+--------+----------+-----+------+

 

Any tips that I can try ?

Edited by swman

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines