From owner-freebsd-arm@FreeBSD.ORG Tue May 26 18:51:32 2015 Return-Path: Delivered-To: freeBSD-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 214B5962 for ; Tue, 26 May 2015 18:51:32 +0000 (UTC) (envelope-from lists.br@gmail.com) Received: from mail-yh0-x22a.google.com (mail-yh0-x22a.google.com [IPv6:2607:f8b0:4002:c01::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 D41CC3ED for ; Tue, 26 May 2015 18:51:31 +0000 (UTC) (envelope-from lists.br@gmail.com) Received: by yhrr66 with SMTP id r66so33317831yhr.3 for ; Tue, 26 May 2015 11:51:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=SCABvutEu7rTopLq7W8WGEa14qn/AmMtmZIxybEGu2o=; b=ww7Ii6B8ob2HvOVDpu94VUBreEzl9GZ0kZILlSdgaJf3UjqkpE5FbL32y9/rVjJzL5 BIVL/KBBeyIzM9SUAMKHYCGrmoBPMrfl0FhSjrqH4cn57JgRt+isYw/zbKyFmcnIan9S 5IFGpX7tiNr4cgeKxzeMYtks1WWG5wUabPi4mpuCUdASQfVGHIDIcWQWB/gy3B4C7zSu QDIfvbpHrAMAtS6hkJ/Q5ZQnj25DdLO67YPlPVmhzH8L3skUbbgNKnnMnvrDeCh6GY/p jVgmn+BbbDUzMLre+jqlMefP+TOSviQO7cXMM1IPRh5KcTV2wX7nHKC8lSxOF7fsc9c2 wWkg== MIME-Version: 1.0 X-Received: by 10.170.36.14 with SMTP id 14mr28540676yke.114.1432666290929; Tue, 26 May 2015 11:51:30 -0700 (PDT) Received: by 10.13.202.197 with HTTP; Tue, 26 May 2015 11:51:30 -0700 (PDT) In-Reply-To: References: <1FD1336E-D99F-4114-AD33-FBA1DF844E93@cs.huji.ac.il> Date: Tue, 26 May 2015 15:51:30 -0300 Message-ID: Subject: Re: pwm for raspberry pi? From: Luiz Otavio O Souza To: Daniel Braniss Cc: freebsd-arm Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2015 18:51:32 -0000 On 26 May 2015 at 03:13, Daniel Braniss wrote: > >> On May 26, 2015, at 1:14 AM, Luiz Otavio O Souza wrote: >> >> On 25 May 2015 at 07:52, Daniel Braniss wrote: >>> Hi, >>> Now that I=E2=80=99m rapping up my spi/rfid driver (available on demand= :-), >>> I would like to use the pwm interface to power on/off a lock, but >>> have no idea how to go around it, so any clues would be mostly welcomed= . >>> >>> cheers, >>> danny >> >> The PWM module is quite simple and has only two outputs, they can be >> used only with recent 40 GPIO pins header (RPi-B+ or RPi2), in the >> older models only one output was wired. >> > I do have a B+ > >> The bcm2835 peripherals datasheet describes the PWM module registers > > I=E2=80=99ve read it, hence I know it=E2=80=99s possible, what I=E2=80=99= missing is how to access it via > FreeBSD. There is a some mention for the BeagleBoneBlack, but it seems > broken, the FDT mentions the pins. Too many leads but not enough info > on how to tie them up :-) > > cheers, > danny There is no defined API to access PWM settings ATM, on beaglebone this is done with sysctls: dev.am335x_pwm.2.dutyB: 0 dev.am335x_pwm.2.dutyA: 0 dev.am335x_pwm.2.period: 1000 dev.am335x_pwm.2.freq: 100000 dev.am335x_pwm.2.clkdiv: 1 dev.am335x_pwm.2.%parent: simplebus0 dev.am335x_pwm.2.%pnpinfo: name=3Dpwm@48304000 compat=3Dti,am335x-pwm dev.am335x_pwm.2.%location: dev.am335x_pwm.2.%driver: am335x_pwm dev.am335x_pwm.2.%desc: AM335x PWM There are 3 PWM modules, each one with two outputs controlled by dutyA and dutyB. Here is the PWM code for beaglebone: https://svnweb.freebsd.org/base/head/sys/arm/ti/am335x/am335x_ehrpwm.c?view= =3Dmarkup At some point I think I will expose PWM settings via gpioctl (and possibly add a gpiopwm for a software based pwm). Regards, Luiz