From owner-freebsd-arm@freebsd.org Mon Nov 21 15:47:18 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 4BC7BC4C064 for ; Mon, 21 Nov 2016 15:47:18 +0000 (UTC) (envelope-from peter.garshtja@ambient-md.com) Received: from mail-io0-x22a.google.com (mail-io0-x22a.google.com [IPv6:2607:f8b0:4001:c06::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1E104E4D for ; Mon, 21 Nov 2016 15:47:17 +0000 (UTC) (envelope-from peter.garshtja@ambient-md.com) Received: by mail-io0-x22a.google.com with SMTP id j65so43040608iof.0 for ; Mon, 21 Nov 2016 07:47:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ambient-md-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=3Vn9VlN2K/KjPon+Ro479GbC2+XHvfeg0QbLzZxh+8Q=; b=Z+UjwlIQOcEW6tCuWViN8EwjzY265bHWuK/C8mOLRZpv5CR/Nid3d7OwQyhv8XRBnr 4Vr4xq6hYk2s4jLyYRSwoHtQcZ+qM5cUei5lnzBkpsadrO3pSfJ4//ljdgwZU71TNwbj SHoOXzu7bPa5YBE/w/Tr3IUjHsWUzXAtwnGWXnaAZWH45YkZdimMObQWqDljRiDJhDuv veyX/ZTXS7IWeLJNdmg+jSNSgi1y9DJRzs9j0Ev0lcJiInafD9fdwM5nUMmM7EBd/Ne0 9gmWoSNafEBzg+QpoCDK/N1Q8P/yHyhjckoCBVSGPd+Gl32RVx0F+7tQY10/8/Vgt0S4 tifA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=3Vn9VlN2K/KjPon+Ro479GbC2+XHvfeg0QbLzZxh+8Q=; b=hIj5ZMy+L6rERzKALfQhghWEeB2F8nAuiR+sXrNBpL9wdIEYq4idu9Rhzdxkiga5zE CLrPBQeMG7BCHfy6WHhCNjsEr8qcz+Aqnj5Dzy9ceyNYxvPe+tEUSh6xIc4wQORfccqZ Wi0qSqDPWWNt6YLEfbyYRyKeydqVCSHp2cZLBusu7SxAxCELkS2G9Mj/ngeI5hXnJMXk rNhQ+jflrBWTO3pAo9Vhec/GZek+vCVVFOBJ+YslqsgeSNXdzVRW8twhxIYv4J9RlrFn P6LEVpz4sYIb4rRM/i3RdQHZWO3JjuIk/vfGIz3dww96pKXgNNgSElR9RoDfcz1TaTD3 MKEg== X-Gm-Message-State: AKaTC01Q2H24rT0/M8Scd0UpKwNa9JtSSCPZ6PpcKcyvhXBpwHYc7Vkas+RulgNT0UOQmkIb/uJuvTAy+C4Wxw== X-Received: by 10.107.146.196 with SMTP id u187mr11059029iod.34.1479743237286; Mon, 21 Nov 2016 07:47:17 -0800 (PST) MIME-Version: 1.0 Received: by 10.79.74.134 with HTTP; Mon, 21 Nov 2016 07:47:16 -0800 (PST) X-Originating-IP: [66.158.136.226] In-Reply-To: <20161120031219.GM34078@cicely7.cicely.de> References: <71a6710e-c7c3-473f-042a-37cb00d309e2@ambient-md.com> <20161120031219.GM34078@cicely7.cicely.de> From: peter garshtja Date: Mon, 21 Nov 2016 10:47:16 -0500 Message-ID: Subject: Re: python: spidev To: ticso@cicely.de Cc: "freebsd-arm@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.23 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: Mon, 21 Nov 2016 15:47:18 -0000 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 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 http://www.bwct.de > Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm. >