07-14-2018, 04:17 AM (This post was last modified: 07-14-2018, 03:12 PM by Kappuchino.
Edit Reason: Removed some snarky remarks.
)
How can a user enable /dev/spidev0,0 on Rock64?
I've seen this very topic discussed and most of the threads / replies are vague, outdated or not working.
I would appreciate a "put this into this file" or "run this command" pointer. Or an article I have not found(yet) - see the ones that didn't help (me) below.
Current os (uname -a) is Linux rock64 4.4.126-rockchip-ayufan-239 aarch64 GNU/Linux .
Already took different python lib (with RPi.GPIO-PineA64) into account as well as different Pinout.
Current Error is:
File "/root/code-red/python/epdif.py", line 43, in
SPI = spidev.SpiDev(0, 0)
FileNotFoundError: [Errno 2] No such file or directory
This should go away with spidev0,0 present in /dev and then ... I'll fix the next problem.
I think it might be just a command similar to "enable_dtoverlay i2c0 i2c@ff150000 okay" but I have not figured out what the magic words are. Most people point to a few who might know, but ... no dice.
Similar Questions are on GitHub and StackOverflow. Once one of them fruits in an answer, I'll mirror it here.
Thank you for any help in advance.
Note:
If you know a paid service I can ask, I would pay the help out of my own pocket and publish the steps here, since our project LiquidInvestigations is free and open and I'd rather work on testing elastic search, UI things, ... (things that I'm better at) than hanging in the air because of a seemingly trivial (but only known to a few) piece of information. Narf.
This is to make https://liquidinvestigations.github.io/ (which uses the rock64) more usable and safer by having a (cheap) display to show codes for the air-gapped rock64 even when it is turned off (hence the use of ePaper)
I can't switch the Linux Distro/Flavour right now, but if /dev/spidev0,0 only available by changing, then its better than scrapping the use of ePaper displays.
And finally: If someone will tell me "it does not work", then I'll move in the next iteration to another board which can work with existing code.
And even then, I have no idea how it will work. Dammit, is it really so hard to get an 08/15 eInk display run on advanced arm64s except raspberry?
So if you come here with the same question about spidev on rock64 as I did, there is no solution until someone tells you specifically otherwise for rock64.
Don't search further, because I've asked here, on github, reddit, stack overflow, irc, ... and after more than a month no helpful answers, just redirects and complaints about wrong phrasing for the question...
Yes, I know everyone works her for free and for their own purpose. So do I: Spent half a year lobbying to give this platform a chance for a project supposed to help investigative journalists around the globe which otherwise would just run on intel as everything else.
Occam's razor tells me this is a chicken and egg problem: The hardware seems to be missing use cases which causes a lack of knowledge how to use the hardware. If you want to just run eInk displays or anything ales, go the way of the raspberry pi.So I have to wait till raspberry pi finally gets to 2 or 4 gb and usb 3 since that was that is the critical demand for li.
08-17-2018, 06:31 PM (This post was last modified: 08-22-2018, 12:51 AM by mcerveny.)
SPI with user programs (python) for Rock64:
There is only one SPI on rk3328 device with possible 2 chipselects CSN0/CSN1.
Rockchip chose "pin multiplex 2 for SPI" (check pins *_M2 and spi2_* + grf_con_spi_io_sel in TRM) as default. This is wrong choice because only one chipselect (CSN0) is available on pin (GPIO3_B0 (SPI_CSN0_M2)).
Chipselect CSN0 is used in Rock64 to activate embedded SPI-NOR flash (GD25Q128) and therefore unavailable to user (I requested RFE to be optional). Internal BOOTROM can boot only from SPI-NOR/CSN0. SPI is already enabled "okay" in DTS but only with embedded SPI-NOR flash.
Let's enable SPI for user (need set driver "rockchip,spidev") with non-wired CSN1 (dynamically without reboot on ayufan kernel with backported configfs).
pin 21 (GPIO3_A2 (SPI_RXD_M2)) <- device SO (not used in e-paper device)
pin 24 (GPIO3_A0 (SPI_CLK_M2)) -> device CLK (There is bug in v2.0 hardware that swapped pins 23/24!)
any other pin (for example 26) -> device CS
Let's try SPI with python and AT45DB041D SPI-NOR flash . Because CSN1 is unavailable program must simulate CSN1 before any access of SPI transfer functions.
Demo code is attached. Happy hacking and buy me a Beer.
I left this community in Aug 2019 due to PINE64 refusal to produce/deliver ROCK64-1G version 3 after more than one year of changing statuses to "planning", "evaluating", "releasing", "availability", "estimated availability" and finally "no schedule" . ROCK64 is dead platform without any advantage. Buy Raspberry PI 4 !
# uname -a Linux rock64 4.4.132-1075-rockchip-ayufan-ga83beded8524 #1 SMP Thu Jul 26 08:22:22 UTC 2018 aarch64 aarch64 aarch64 GNU/Linux
# cat >spi1.dts <<EOF [...]
[did that, worked]
# dtc spi1.dts -o spi1.dtbo
Warnings:
spi1.dtbo: Warning (unit_address_vs_reg): Node /fragment@0 has a unit name, but no reg property
spi1.dtbo: Warning (pci_device_reg): Failed prerequisite 'reg_format'
spi1.dtbo: Warning (pci_device_bus_num): Failed prerequisite 'reg_format'
spi1.dtbo: Warning (simple_bus_reg): Failed prerequisite 'reg_format'
spi1.dtbo: Warning (avoid_default_addr_size): Relying on default #address-cells value for /fragment@0/__overlay__/spidev@1
spi1.dtbo: Warning (avoid_default_addr_size): Relying on default #size-cells value for /fragment@0/__overlay__/spidev@1 # mkdir /sys/kernel/config/device-tree/overlays/spi1
[okay, did that with sudo, wrong?] # cat spi1.dtbo > /sys/kernel/config/device-tree/overlays/spi1/dtbo
/sys/kernel/config/device-tree/overlays/spi1/dtbo: Permission denied # ls /dev/spidev*
not found
so ...
it does sadly not show /dev/spidev0,0 nor other
If it would work, what would the difference to spidev0,0 vs spidev32766.1 be?
If you read my issue before, what else would I need to modify for the eInk display?
PS: I'm willing to send you/someone one (smaller) eInk display with a driver-board if you need it to understand/make it work. You can keep it then.
# ### retrieve original
# wget https://www.waveshare.com/w/upload/7/73/1.54inch_e-Paper_Module_code.7z
# apt install p7zip
# 7zr x 1.54inch_e-Paper_Module_code.7z raspberrypi/python/*
# ### use attached copy (modified but unable to check it)
# tar xf epaper_demo.tar
# ls *.py *.bmp
epd1in54.py epdif.py main.py monocolor.bmp
# ### compare changes
# for i in raspberrypi/python/*.py; do diff -u $i .; done
I left this community in Aug 2019 due to PINE64 refusal to produce/deliver ROCK64-1G version 3 after more than one year of changing statuses to "planning", "evaluating", "releasing", "availability", "estimated availability" and finally "no schedule" . ROCK64 is dead platform without any advantage. Buy Raspberry PI 4 !
It worked (getting spidev ...) ... but how ... well:
I noticed there are two bionic versions bionic-minimal-rock64-0.7.9-1067-arm64.img and bionic-minimal-rock64-0.7.9-1067-armhf.img.
I just used the other one and got an even stranger error for using dtc.
So I looked up the solution for that (didn't want to flash the sd again ..., curious ...): https://github.com/beagleboard/bb.org-ov...overlay.sh
Ran the script. Worked.
Ran your commands. Worked.
And now ...
# udevadm info --query=all --name=spidev32766.1
P: /devices/platform/ff190000.spi/spi_master/spi32766/spi32766.1/spidev/spidev32766.1
N: spidev32766.1
E: DEVNAME=/dev/spidev32766.1
E: DEVPATH=/devices/platform/ff190000.spi/spi_master/spi32766/spi32766.1/spidev/spidev32766.1
E: MAJOR=153
E: MINOR=0
E: SUBSYSTEM=spidev
YESSS! Thank you. Thank you. Thank you.
Next step: Getting that display to run. Will write detailed setup/how-to when done.
----------------------------------------
Failed building wheel for spidev
Running setup.py clean for spidev
Failed to build spidev
Installing collected packages: spidev
Running setup.py install for spidev ... done
Successfully installed spidev-3.2
(?!?)
When I start main.py, it doesn't complain, but nothing shows on the display ...
(DM me, my offer still stands to send you an gratis ePaper Display + Beer)
(08-22-2018, 12:22 PM)Kappuchino Wrote: # pip install spidev error: invalid command 'bdist_wheel'
When I start main.py, it doesn't complain, but nothing shows on the display ...
What version of "eink display" are you using ?
I will try to check/modify specific version of demo code.
(I am running image "bionic-lxde-rock64-0.7.9-1067-arm64.img")
I left this community in Aug 2019 due to PINE64 refusal to produce/deliver ROCK64-1G version 3 after more than one year of changing statuses to "planning", "evaluating", "releasing", "availability", "estimated availability" and finally "no schedule" . ROCK64 is dead platform without any advantage. Buy Raspberry PI 4 !
09-08-2018, 07:24 AM (This post was last modified: 09-08-2018, 07:30 AM by Kappuchino.)
(Sorry for the wait, took a break from computing and else)
So now everything is smooth until I start the modified script then ... nothing.
Here is the "proof of wireing" - this time with a 4.2'' display, but others didn't work as well.
When I force-quit with ctrl-c, this is the output:
^C You must setup() the GPIO channel (BOARD 26) as an output first
^C You must setup() the GPIO channel (BOARD 15) as an output first
^C Traceback (most recent call last):
File "main.py", line 84, in <module>
main()
File "main.py", line 80, in main
epd.set_frame_memory(time_image.rotate(90), 80, 80)
File "/home/rock64/spidev/epd1in54.py", line 205, in set_frame_memory
self.send_data(byte_to_send)
File "/home/rock64/spidev/epd1in54.py", line 97, in send_data
self.digital_write(self.dc_pin, GPIO.HIGH)
File "/home/rock64/spidev/epd1in54.py", line 82, in digital_write
epdif.epd_digital_write(pin, value)
File "/home/rock64/spidev/epdif.py", line 41, in epd_digital_write
GPIO.output(pin, value)
File "/home/rock64/spidev/R64/_GPIO.py", line 184, in output
for index in range(len(channel)):
KeyboardInterrupt
So ... I will write down line by line what I did, again (see that on github today) but no dice so far.