HermannSW
Posts: 328
Joined: Fri Jul 22, 2016 9:09 pm

How to wait for SPI1 being ready during boot?

Fri Oct 13, 2017 8:59 am

In this posting
viewtopic.php?f=63&t=194423&p=1217626#p1217978
I realized that SPI1 interface enabled in /boot/config.txt

Code: Select all

...
dtparam=spi=on
dtoverlay=spi1-3cs
...
is only available in /etc/rc.local for configuring a display on SPI1 after a 1 second delay:

Code: Select all

...
sleep 1
sudo modprobe fbtft_device name=rpi-display gpios=reset:13,dc:26,led:28 rotate=270 cs=2 busnum=1
...
This may be the reason why a dt overlay I tried to generate for display on SPI1 did not work (too early).

Is there something equivalent to "sleep 1" I could place between "dtoverlay=spi1-3cs" and "dtoverlay=rpi-displa1" in /boot/config.txt to delay processing of "dtoverlay=rpi-displa1" until after SPI1 is available?
Or better, a "wait until SPI1 is up"?
(I did change "target = <&spi0>;" to "target = <&spi1>;" in fragment@0 of new "rpi-displa1.dts" without the needed wait effect)
--> Raspberry camera / gstreamer / raspiraw (bookmark list):
https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/6by9/raspiraw      https://github.com/Hermann-SW/raspiraw

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1417
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: How to wait for SPI1 being ready during boot?

Fri Oct 13, 2017 9:05 am

All of the overlays specified in config.txt are applied before the ARM cores execute a single instruction. The kernel uses the information to load and configure devices drivers such as spi-bcm2835, which then enables the interface. A pause in the overlay application will make no difference at all to your problem - the delay you have now is in roughly the right place, although it isn't very elegant.

HermannSW
Posts: 328
Joined: Fri Jul 22, 2016 9:09 pm

Re: How to wait for SPI1 being ready during boot?

Fri Oct 13, 2017 11:30 am

Thanks for that information -- I only asked in this forum because I did not get a response in the other forum's posting.
Good to know that eanbling display on SPI1 is not possible in /boot/config.txt.
Others did use 2 displays on SPI0 only with different chip select lines, perhaps worth a try whether with that config both displays can be enabled by two device tree overlays in /boot/config.txt.
--> Raspberry camera / gstreamer / raspiraw (bookmark list):
https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/6by9/raspiraw      https://github.com/Hermann-SW/raspiraw

Return to “Device Tree”

Who is online

Users browsing this forum: No registered users and 4 guests