gchirico
Posts: 4
Joined: Thu Apr 28, 2016 4:07 pm

RB Pi 3 fail to load SPI1

Thu Apr 28, 2016 4:29 pm

Hi All,
I have a Raspberry Pi 3 with Kernel 4.4.8-v7+ installed via rpi-update.
I'm tryng to enable SPI1 with this line in the /boot/config.txt

dtoverlay=spi1-3cs,cs0_spidev=disabled,cs1_spidev=disabled,cs2_spidev=disabled

When I enable this line the Raspberry Pi 3 stops and starts very slowly (unusable).

On a Raspberry Pi 2 everything works fine when I enable the line in the /boot/config.txt and SPI1 works very well.
Which is the solution to enable SPI1 on Raspberry Pi 3?

Thanks in advance,
Giovanni

fsr
Posts: 88
Joined: Wed Jan 13, 2016 2:29 am

Re: RB Pi 3 fail to load SPI1

Mon May 16, 2016 2:35 pm

gchirico wrote:When I enable this line the Raspberry Pi 3 stops and starts very slowly (unusable).
Hi gchirico,

I don't have a PI3 so I can't test this myself but if you have the time perhaps we can work though it.

SPI1 (and 2) are part of the 3 auxillary devices on the SoC, and enabling it in linux added two new kernel modules.
the Aux Clocks - https://github.com/raspberrypi/linux/bl ... 2835-aux.c
the spi aux devices (aka SPI1/2) https://github.com/raspberrypi/linux/bl ... m2835aux.c

The PI3 added bluetooth and WiFi modules on the board and consequently added new drivers and device tree configurations too. The Bluetooth module is connected to uart0 and the console is now connected to uart1

uart1 - the third auxiliary device on the SoC - is therefore a possible cause of conflict

First thing to try then is to disable the bluetooth module (which also reconfigures the uarts back to how they are on other PIs - uart0 for the console and uart1 disabled)

Code: Select all

dtoverlay=pi3-disable-bt
and then enable spi1 and see what happens.

also could you capture the output of this command before you make any changes

Code: Select all

dtc -Ifs /proc/device-tree
and message it to me? (its long and verbose)

lastly is there anything logged in dmesg that sheds any light?

gchirico
Posts: 4
Joined: Thu Apr 28, 2016 4:07 pm

Re: RB Pi 3 fail to load SPI1

Tue May 17, 2016 2:19 pm

Great, thanks!

Disabling the BT solved the problem.

I just used:

Code: Select all

dtoverlay=pi3-disable-bt
sudo systemctl disable hciuart
Now the SPI1 channel works as expected, so it really seems that the BT and the SPI1 share something on the SOC.
Thank you very much for your help.

fsr
Posts: 88
Joined: Wed Jan 13, 2016 2:29 am

Re: RB Pi 3 fail to load SPI1

Wed May 18, 2016 2:31 am

gchirico wrote:Disabling the BT solved the problem.

I just used:

Code: Select all

dtoverlay=pi3-disable-bt
sudo systemctl disable hciuart
Thats good news.
gchirico wrote:the BT and the SPI1 share something on the SOC
I suspect its a side affect of the BT. The BT module is connected to UART0 so the console is now UART1 (Aux UART) which shares resources with SPI1 (Aux SPI). I need to investigate further however I'm suspect of the way the aux clock is being initialised (possibly being done twice).

fsr
Posts: 88
Joined: Wed Jan 13, 2016 2:29 am

Re: RB Pi 3 fail to load SPI1

Thu May 19, 2016 9:20 am

A bit more info,

The issue arises when two things are configured
* the console is on uart1 (/dev/ttyS0)
* SPI1 is enabled.

I've found another workaround too:

1) if you don't want bluetooth
add 'dtoverlay=pi3-disable-bt' directive to the /boot/config.txt
(as per above. disables bluetooth, configures uart0 to be the console, disables uart1)

2) if you do want bluetooth
remove the 'console=serial0,115200' parameter from /boot/cmdline.txt
(no serial device is configured as a console)


I'm able to reproduce the fault on a PI2 by setting up uart1 as a console and activating SPI1, so its not a PI3 specific problem. To reproduce; add to /boot/config.txt
'dtparam=uart0=off
dtoverlay=uart1
dtoverlay=spi1-1cs'

then add to /boot/cmdline.txt 'console=ttyS0,115200'

and your pi will lockup on next reboot.

Strontium
Posts: 7
Joined: Thu Jul 28, 2016 3:37 am

Re: RB Pi 3 fail to load SPI1

Thu Jul 28, 2016 3:42 am

Can anyone confirm this is still a problem on 4.4.13-v7+?? I can not replicate it with raspbian lite upgraded to latest kernel.

profeciak
Posts: 16
Joined: Tue Aug 02, 2016 1:55 pm

Re: RB Pi 3 fail to load SPI1

Mon Aug 08, 2016 8:30 am

Hi all,

I've been doing just as you say, but still I don't have SPI1 enabled on my device

mjubes
Posts: 33
Joined: Thu Oct 01, 2015 8:17 am

Re: RB Pi 3 fail to load SPI1

Sun Sep 25, 2016 8:31 pm

Reposting here from a different thread:

I have an SPI program using ioctl calls on "/dev/spidev0.0" and "/dev/spidev0.1" i.e. using both ce0 and ce1 on SPI0.

The program has worked perfectly well on a RPI2 without any problems, but when moved to an RPI3, calls using ce0 (i.e. /dev/spidev0.0) still work OK, but calls using ce1 return gibberish memory data. i.e. the ioctl() call returns no errors but the rx data array contains what looks like random data.

Scope signals on all the pins are OK, e.g. the ce0 and ce1 levels are correctly generated, the clock and the mosi and miso pins show all the right data transitions (for this test I am echoing mosi back to miso)

Has anybody here seen similar problems?

The kernel here is 4.4.21-v7+. and the driver is spi_bcm2835.

PS, I have tried all the various mods to "/boot/config.txt" as mentioned here with no success.

Return to “Advanced users”

Who is online

Users browsing this forum: No registered users and 6 guests