From owner-freebsd-arm@freebsd.org Wed Aug 3 03:32:29 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 C2045BACCD8 for ; Wed, 3 Aug 2016 03:32:29 +0000 (UTC) (envelope-from ticso@cicely7.cicely.de) Received: from raven.bwct.de (raven.bwct.de [85.159.14.73]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "raven.bwct.de", Issuer "BWCT" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 61A3C118E for ; Wed, 3 Aug 2016 03:32:25 +0000 (UTC) (envelope-from ticso@cicely7.cicely.de) Received: from mail.cicely.de ([10.1.1.37]) by raven.bwct.de (8.13.4/8.13.4) with ESMTP id u733Sd28039355 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Wed, 3 Aug 2016 05:28:45 +0200 (CEST) (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 u733SVd9010981 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 3 Aug 2016 05:28:32 +0200 (CEST) (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 u733SVFM021402; Wed, 3 Aug 2016 05:28:31 +0200 (CEST) (envelope-from ticso@cicely7.cicely.de) Received: (from ticso@localhost) by cicely7.cicely.de (8.15.2/8.15.2/Submit) id u733SUGP021401; Wed, 3 Aug 2016 05:28:30 +0200 (CEST) (envelope-from ticso) Date: Wed, 3 Aug 2016 05:28:30 +0200 From: Bernd Walter To: FreeBSD-arm@freebsd.org Cc: Bernd Walter Subject: SPI on Raspberry B+ Message-ID: <20160803032830.GB18406@cicely7.cicely.de> Reply-To: ticso@cicely.de Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Operating-System: FreeBSD cicely7.cicely.de 10.2-RELEASE amd64 User-Agent: Mutt/1.5.11 X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED=-1, BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 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.22 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2016 03:32:29 -0000 I'm currently writing a kernel driver for APA102 LEDs on 11-BETA3. With some help of older threads on this list I've managed to get my driver attached and sending data. However, what I didn't manged yet is setting the SPI parameters. The SPI mode seems to match fine. The byte order is unfortunately wrong. I need MSB first and the driver is sending LSB first. Of course I could rotate all the bits, but would like to avoid it for performance reasons. The clock is only 500kHz according to scope. I've heared that there is no device specific speed support, but since I'm not using any other SPI device setting the global speed would be fine. I'm calling SPIBUS_TRANSFER with multiple bytes. There is a gap of 2 microseconds between the bytes. Don't know if it just skipping a full clock cycle and the gap will be shorter with a higher clockrate, or if the driver really needs 2 full microseconds between each bytes. I somehow believe (and hope) it is just a full cycle in the controller. -- B.Walter http://www.bwct.de Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm.