Jump to content

OPZero SPIdev usage


Maeur1

Recommended Posts

Hey there

 

So I was planning on using the OPZero on a robot that I had already made, which took use of SPIdev, and it was doing calls to the spidev driver in C.

 

Now I noticed that the OPZero has 2 SPI channels, one for the NOR flash (Which isnt populated) on the back and another that goes to the GPIO headers on the device.

 

Now I ran my script, and turns out that /dev/spidev0.0 is actually writing SPI commands to the rear SPI channel. This is apparenly SPI0 according to the schematics.

 

Now following the schematics again, I want to access SPI1, which currently does not exist as a spidev file. I tried "modprobe spidev" to bring up the extra interface, but sadly nothing brought up /dev/spidev0.1 (Which I am assuming is the one I want.)

 

Any pointers on how to get the extra SPI bus up and running? 

 

Btw, I have confirmed that it is writing to the rear SPI hooking up my logic analyzer to the rear and running my program. The signals came out perfectly on the back one, which is awesome, but I need the ones on the GPIO headers to work.

 

Thanks for the help!

Link to comment
Share on other sites

Well, you should only need to replace script.bin with a version generated from https://raw.githubusercontent.com/pctj101/armbian-lib/2f3ac6885f75eeca3932a538c50f214bde8c7a06/config/fex/orangepizero.fex

 

I believe the fex2bin version currently provided with most recent OS images is broken so as a possible last resort the fex already converted to script.bin: https://transfer.sh/QRpQI/script.bin

Link to comment
Share on other sites

Well after using your script.bin, it seems to have the other SPI line in it (spidev1.0 and spidev0.0)! But I need to test whether it is working, so I shall try out both the NOR flash SPI and also the GPIO SPI once I get home.

 

Thanks for that help :D

 

EDIT: After getting home, and testing, both SPI lanes are working perfectly now! Thanks a bunch :D

Link to comment
Share on other sites

 

Hi!
I'm new here. First, I apologize for my poor English.
I encountered the same problem with OPI Zero.
I edited script.fex according to your pattern, but when I compile it, I have no SPI device then.
So I wanted to use compiled script.bin, but the url https://transfer.sh/QRpQI/script.binis not already available. Can you help me, please ?
Thanks 

 Hey! You dont need the file that was at that link anymore as the github pull request was merged into the main development line. So if you download the latest version of armbian, it should already work out of the box!

Link to comment
Share on other sites

Thank you for answer. This is interesting information and I'm a little confused.

I recently installed Armbian and I often doing the update / upgrade.

 

So now I downloaded the latest Armbian for OPI Zero and I made a completely new installation from scratch.

However, initially it seemed that the situation has not changed: I had only one SPI device (spidev0.0) and it not worked. After decompile script.bin I found in the file script.fex that this device is mapped to inaccessible GPIO ports (as it was before).

 

Then I edited script.fex, enabled second SPI devices and then compiled new file script.bin.

This time I was successful and finally I have a functioning device spidev1.0 !

Thank you!

Link to comment
Share on other sites

Hello, sorry for my bad english.

On scheme SPI-CE1 is PA10, but turn it on fails. How can I enable spi-ce1?

 

Hey there!

 

I have looked over the schematic, and you are right! it is super weird, cause it says at the top that PA10 is NC, but then in the schematic it says its connected to pin 26 of the GPIO. Is there any reason you need another Cable Enable (CE)? Would it not be possible to control that pin through GPIO control instead?

Link to comment
Share on other sites

Hey there!

 

I have looked over the schematic, and you are right! it is super weird, cause it says at the top that PA10 is NC, but then in the schematic it says its connected to pin 26 of the GPIO. Is there any reason you need another Cable Enable (CE)? Would it not be possible to control that pin through GPIO control instead?

On top of scheme PA13 (SPI1_CS) is NC, but it works like SPI1_CS0. I need SPI1-CS1 to connect touch waveshare 3.5 spi lcd.

Link to comment
Share on other sites

On top of scheme PA13 (SPI1_CS) is NC, but it works like SPI1_CS0. I need SPI1-CS1 to connect touch waveshare 3.5 spi lcd.

Looking at the Waveshare SPI LCD (http://www.waveshare.com/wiki/3.5inch_RPi_LCD_(A)) it looks like it runs off the default SPI bus that the raspberry pi runs off. Are you sure you have plugged it in so that the screen hangs off the side of the orangepi zero? Cause the connect is flipped compared with the raspberry pi, but its pin identical.

Link to comment
Share on other sites

I connected it via a cable, and video works fine. But this display uses two CS. One for the LCD and one for touch.

Aha I see, well I guess it might pay to open a new topic to discuss that then, as my problem for this one was just to get the SPI working in the first place. Sorry I can't help, but there are others in the forum who can!

Link to comment
Share on other sites

Hello everybody

 

I know that mainline kernel isn't supported for OPi zero yet...

 

When enabling both SPI by applying an overlay DT I get an error saying that PA15 is already in use by a LED.

 

Searching the dts files I found that OPi zero dts includes OPi one/light dts. In OPi one/light there is SPI0 on header pins and SPI1 is used as UART3, GPIO and status LED.

 

Is there a way to disable the LED in the overlay DT? Or do I have to patch OPi zero dts?

Link to comment
Share on other sites

When enabling both SPI by applying an overlay DT I get an error saying that PA15 is already in use by a LED.

 

Searching the dts files I found that OPi zero dts includes OPi one/light dts. In OPi one/light there is SPI0 on header pins and SPI1 is used as UART3, GPIO and status LED.

 

Is there a way to disable the LED in the overlay DT? Or do I have to patch OPi zero dts?

First, you should not try to enable SPI0 on Zero, at least without disabling SPI NOR / MTD node before that.

And second, PA15 issue for SPI1 should be solved in the latest nightly.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines