Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Nov 2016 04:12:20 +0100
From:      Bernd Walter <ticso@cicely7.cicely.de>
To:        Peter Garshtja <peter.garshtja@ambient-md.com>
Cc:        "freebsd-arm@freebsd.org" <freebsd-arm@freebsd.org>
Subject:   Re: python: spidev
Message-ID:  <20161120031219.GM34078@cicely7.cicely.de>
In-Reply-To: <71a6710e-c7c3-473f-042a-37cb00d309e2@ambient-md.com>
References:  <71a6710e-c7c3-473f-042a-37cb00d309e2@ambient-md.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Nov 19, 2016 at 03:02:29PM -0500, Peter Garshtja wrote:
> Greetings,
> 
>     Has anybody experience with python spidev library on RPI2 FreeBSD 11 ?
> 
> I have a led matrix max7219 trying to connect it with gpio, and 
> apparently python spidev library is only for linux, i just wonder if 
> there any chances to run this library on freebsd ?

FreeBSD has a driver for the hardware SPI on the supported rasperry
boards, but unfortunately no support to access it from userland.
The only way to use SPI from userland is to either do a slow bitbang
via GPIO from userland, or by writing a kernel driver.

With such a small matrix doing bitbang via GPIO from usrland should be
fast enough and it isn't very difficult.

A few weeks ago I did a bigger matrix of 800 APA102 LEDs, which are
also SPI and in that case I really needed high speed.
I did wrote a kernel driver for that case.
It basicly does nothing more than creating a /dev/apa102 device and
all data you write into it will be pushed out via SPI.
The FreeBSD raspberry SPI driver only supports a common SPI frequency
and mode via sysctl interface, which may be a problem if you want to
access different devices.

If you want to experiment with that driver I can publish the code.
It had been used on a raspberry 1 B+, but should work on any board
with a supported SPI controller.

> here is the tutorial that i tried to follow in order to make this led 
> matrix working on rpi2 under freebsd.
> 
> https://github.com/rm-hull/max7219
> 

-- 
B.Walter <bernd@bwct.de> http://www.bwct.de
Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm.



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