Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Nov 2016 10:47:16 -0500
From:      peter garshtja <peter.garshtja@ambient-md.com>
To:        ticso@cicely.de
Cc:        "freebsd-arm@freebsd.org" <freebsd-arm@freebsd.org>
Subject:   Re: python: spidev
Message-ID:  <CALFUBVHTwk=%2BqV7cgX-BiL2VwYM5VCaOju95w_Wn_obeO15F8Q@mail.gmail.com>
In-Reply-To: <20161120031219.GM34078@cicely7.cicely.de>
References:  <71a6710e-c7c3-473f-042a-37cb00d309e2@ambient-md.com> <20161120031219.GM34078@cicely7.cicely.de>

next in thread | previous in thread | raw e-mail | index | archive | help
Greetings,


*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.*

Can you explain me "what is" or "how to do" slow bitbang via GPIO ?





*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.*
Sounds interesting, could you please publish the code and also explain how
to write to /dev/matrix device via SPI ?

Thanks in advance,
Peter


On Sat, Nov 19, 2016 at 10:12 PM, Bernd Walter <ticso@cicely7.cicely.de>
wrote:

> 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?CALFUBVHTwk=%2BqV7cgX-BiL2VwYM5VCaOju95w_Wn_obeO15F8Q>