From owner-freebsd-arm@freebsd.org Sun Nov 20 03:12:31 2016 Return-Path: Delivered-To: freebsd-arm@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 08A55C47D0E for ; Sun, 20 Nov 2016 03:12:31 +0000 (UTC) (envelope-from ticso@cicely7.cicely.de) Received: from raven.bwct.de (raven.bwct.de [195.149.99.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "raven.bwct.de", Issuer "raven.bwct.de" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 77BA211AF for ; Sun, 20 Nov 2016 03:12:29 +0000 (UTC) (envelope-from ticso@cicely7.cicely.de) Received: from mail.cicely.de ([10.1.1.37]) by raven.bwct.de (8.15.2/8.15.2) with ESMTPS id uAK3CNBp033357 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Sun, 20 Nov 2016 04:12:24 +0100 (CET) (envelope-from ticso@cicely7.cicely.de) Received: from cicely7.cicely.de (cicely7.cicely.de [10.1.1.9]) by mail.cicely.de (8.14.5/8.14.4) with ESMTP id uAK3CL2G036542 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 20 Nov 2016 04:12:21 +0100 (CET) (envelope-from ticso@cicely7.cicely.de) Received: from cicely7.cicely.de (localhost [127.0.0.1]) by cicely7.cicely.de (8.15.2/8.15.2) with ESMTP id uAK3CK6p078508; Sun, 20 Nov 2016 04:12:20 +0100 (CET) (envelope-from ticso@cicely7.cicely.de) Received: (from ticso@localhost) by cicely7.cicely.de (8.15.2/8.15.2/Submit) id uAK3CK00078507; Sun, 20 Nov 2016 04:12:20 +0100 (CET) (envelope-from ticso) Date: Sun, 20 Nov 2016 04:12:20 +0100 From: Bernd Walter To: Peter Garshtja Cc: "freebsd-arm@freebsd.org" Subject: Re: python: spidev Message-ID: <20161120031219.GM34078@cicely7.cicely.de> Reply-To: ticso@cicely.de References: <71a6710e-c7c3-473f-042a-37cb00d309e2@ambient-md.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <71a6710e-c7c3-473f-042a-37cb00d309e2@ambient-md.com> X-Operating-System: FreeBSD cicely7.cicely.de 10.2-RELEASE amd64 User-Agent: Mutt/1.5.11 X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED=-1, BAYES_00=-1.9, RP_MATCHES_RCVD=-1.507 autolearn=ham version=3.3.0 X-Spam-Checker-Version: SpamAssassin 3.3.0 (2010-01-18) on spamd.cicely.de X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Nov 2016 03:12:31 -0000 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 http://www.bwct.de Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm.