Maeur1 Posted November 20, 2016 Posted November 20, 2016 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!
tkaiser Posted November 20, 2016 Posted November 20, 2016 Can you please report back whether https://github.com/igorpecovnik/lib/pull/545#event-865306631 fixed it?
Maeur1 Posted November 20, 2016 Author Posted November 20, 2016 Building today, I shall report back at the end of the day after work. 1
tkaiser Posted November 20, 2016 Posted November 20, 2016 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 1
Maeur1 Posted November 20, 2016 Author Posted November 20, 2016 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 EDIT: After getting home, and testing, both SPI lanes are working perfectly now! Thanks a bunch 2
pako Posted January 13, 2017 Posted January 13, 2017 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.bin is not already available. Can you help me, please ? Thanks
Maeur1 Posted January 13, 2017 Author Posted January 13, 2017 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!
pako Posted January 14, 2017 Posted January 14, 2017 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!
chupy Posted January 17, 2017 Posted January 17, 2017 Hello, sorry for my bad english.On scheme SPI-CE1 is PA10, but turn it on fails. How can I enable spi-ce1?
Maeur1 Posted January 18, 2017 Author Posted January 18, 2017 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?
chupy Posted January 18, 2017 Posted January 18, 2017 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.
Maeur1 Posted January 18, 2017 Author Posted January 18, 2017 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.
chupy Posted January 18, 2017 Posted January 18, 2017 I connected it via a cable, and video works fine. But this display uses two CS. One for the LCD and one for touch.
Maeur1 Posted January 18, 2017 Author Posted January 18, 2017 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!
Hackbeere Posted February 13, 2017 Posted February 13, 2017 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?
zador.blood.stained Posted February 13, 2017 Posted February 13, 2017 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.
Hackbeere Posted February 13, 2017 Posted February 13, 2017 Thank you very much! Yes, applying overlay Dt of SPI1 works now and /dev/spidev1.0 is accessible. Using flashcp I can write u-boot to SPI FLASH. Also applying SPI overlay in u-boot works now.
Recommended Posts