tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Can't get SPI to work



A few days ago I described my problem here: kernel was not calling
my driver's _match() and _attach(). The workaround was actually
pretty simple. Slightly modifying .dtb file made bcmspi bus appear.

Now I just can't get RPI model B rev 2 to send anything through SPI bus:
* dmesg(8) shows bcmspi, spi(4) and mydev connected and configured:
	$ dmesg | grep spi
	[     1.000000] bcmspi0 at simplebus1: SPI
	[     1.000000] bcmspi0: interrupting on icu irq 54
	[     1.000000] spi0 at bcmspi0: SPI bus
	[     1.000000] mydev0 at spi0 slave 0

* spi_send() and spi_configure() both return 0
* I'm sure all my connections are fine because I've tested my setup
with another SPI master

Seems like it silently tells everything is okay, while in fact it
isn't.

I also looked through Raspberry Pi documentation, to be more precise
through overlays and dtb's section. It seems that NetBSD 10.0 for
evbarm/RPI doesn't have any overlays. So I manually downloaded spi1-1cs.dtbo
from RPI's firmware repo:
https://github.com/raspberrypi/firmware/blob/master/boot/overlays/spi1-1cs.dtbo
and placed it in /boot/overlays. Also I modified config.txt to make
bootloader search for this overlay.
	# mkdir /boot/overlays
	# cp spi1-1sc.dtbo /boot/overlays/
	# tail /boot/config.txt

	...
	dtoverlay=spi1-1cs,cs0_spidev=off

From RPI's README.txt:
> Name:   spi1-1cs Info:
> Enables spi1 with a single chip select (CS) line and associated
	  spidev dev node.

I guess that should configure pins for SPI use, but still, no
progress in my case.

Later I hooked Arduino and wrote simple scetch that digitalRead()'s
in loop too see if CLK and MOSI change somehow. They are always low
for whatever reason.

How am I supposed to make my single SPI interface work?
A lot of documentation regarding FDT, overlays and so on
describes stuff in context of Raspbian, but not NetBSD.

I'll be grateful for any resources/information you provide regarding
this

-Nikita


Home | Main Index | Thread Index | Old Index