Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Jan 2017 17:07:57 -0800
From:      Oleksandr Tymoshenko <gonzo@bluezbox.com>
To:        George Mitchell <george+freebsd@m5p.com>
Cc:        "freebsd-arm@freebsd.org" <freebsd-arm@freebsd.org>
Subject:   Re: Serial Peripheral Interface?
Message-ID:  <20170118010757.GA14547@bluezbox.com>
In-Reply-To: <ef2e151c-2229-161e-16d0-27cd10013298@m5p.com>
References:  <ef2e151c-2229-161e-16d0-27cd10013298@m5p.com>

next in thread | previous in thread | raw e-mail | index | archive | help
George Mitchell (george+freebsd@m5p.com) wrote:
> The Raspberry Pi (among others) has two IIC interfaces on the GPIO
> connector, and there are /dev/iic0 and /dev/iic1 visible to userland.
> It also has two SPI interfaces, but despite the presence of "device
> spibus" and "device bcm2835_spi" in the RPI-B configuration file, I
> have been unable to detect any userland interface to the serial
> peripheral interface lines (except the dev.spibus and dev.spi sysctl
> entries).  Is it possible to use the SPI interfaces somehow from
> userland?

There is somewhat cumbersome spigen interface. It's not available as a
module (yet), only as kernel cimpile-time option. You'll have to add
"device spigen" to kernel config and rebuild the kernel. Also there are
some limitations. You can't specify mode or CS number from userland,
CS 0 and mode 0 is assumed. 

You can find usage example here:
https://github.com/gonzoua/freebsd-embedded-demos/blob/master/libssd1306/ssd1306_spi.c

There are plans to replace spigen with better API but I am not aware
about the actual timeline for this.

-- 
gonzo



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170118010757.GA14547>