From owner-freebsd-arm@freebsd.org Tue Mar 28 23:55:03 2017 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 15187D23374 for ; Tue, 28 Mar 2017 23:55:03 +0000 (UTC) (envelope-from rj@obsigna.com) Received: from mo6-p00-ob.smtp.rzone.de (mo6-p00-ob.smtp.rzone.de [IPv6:2a01:238:20a:202:5300::4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.smtp.rzone.de", Issuer "TeleSec ServerPass DE-2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A5CBB1B1E for ; Tue, 28 Mar 2017 23:55:02 +0000 (UTC) (envelope-from rj@obsigna.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1490745298; l=3450; s=domk; d=obsigna.com; h=To:References:Content-Transfer-Encoding:Date:In-Reply-To:From: Subject:Mime-Version:Content-Type; bh=R7gU8SME0AaCmd6cSoGqm4ov0Y5AtVrmiquAnARPj50=; b=QP4Bl5Ml6iMtdpZ6lx//OiGtGuG3CQHKSrwjAeufHwUdQ8T3S2vjgD3uSs2al6zEjM 4nQykDJrMwkIvd+hmzvq3xVrTIADzc0r8Xn5JVwoyWYtVRD2Wrj4fkAy/2XiD5oNLP5n Pn5UBiQQbm2Q1s57up0F8YZMstKC46sl9zMiw= X-RZG-AUTH: :O2kGeEG7b/pS1EK7WHa0hxqKZr4lnx6UhT0M0o35iAdWtoM07Gt3wQHFGhIi99LnOZs= X-RZG-CLASS-ID: mo00 Received: from mail.obsigna.com (bb02abf9.virtua.com.br [187.2.171.249]) by smtp.strato.de (RZmta 40.4 DYNA|AUTH) with ESMTPSA id 605bc6t2SNsv30I (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate) for ; Wed, 29 Mar 2017 01:54:57 +0200 (CEST) Received: from rolf.projectworld.net (rolf.projectworld.net [192.168.222.15]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.obsigna.com (Postfix) with ESMTPSA id 576EA7506DAD for ; Tue, 28 Mar 2017 20:54:54 -0300 (BRT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: Enabling ADC on a Beaglebone Black running FreeBSD 12.0-CURRENT (BEAGLEBONE) From: "Dr. Rolf Jansen" In-Reply-To: <271AFD8F-BD2C-445C-AB95-D7D07593E487@obsigna.com> Date: Tue, 28 Mar 2017 20:54:52 -0300 Content-Transfer-Encoding: quoted-printable Message-Id: <5D2FEB0D-64F3-488C-8458-85E7DF10EFB7@obsigna.com> References: <0C4DCBB9-2642-4B0F-B15B-4139D5D8B249@obsigna.com> <271AFD8F-BD2C-445C-AB95-D7D07593E487@obsigna.com> To: freebsd-arm@FreeBSD.org X-Mailer: Apple Mail (2.1878.6) 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: Tue, 28 Mar 2017 23:55:03 -0000 Today I updated once again my Beaglebone Black by merging-in the latest = FreeBSD 12.0-CURRENT (BEAGLEBONE) snapshot, and once again I enabled the = ADCs on the Beaglebone in the device tree blob am335x-boneblack.dtb, and = the ADC is still working fine. Even if it is not that a big hassle to modify the device tree blob, I am = curious on why the ADC has been disabled in the blob in the first place, = end even more, given the fact that the device ti_adc driver is built-in = to kernel and once enabled, the ADC is functional. Didn't it work at some time in the past? Now it is. What is missing to activate the ADC in the device tree blob by default? Best regards Rolf Am 12.03.2017 um 18:38 schrieb Dr. Rolf Jansen : > The ADC is disabled in the respective device tree file = am335x-boneblack.dtb. In order to enable the it, I did: >=20 > 1. decompile the device tree blob (.dtb) into a device tree source = file (.dts): >=20 > cd /boot/dtb > dtc -I dtb -O dts am335x-boneblack.dtb > am335x-boneblack.dts >=20 >=20 > 2. edit the .dts file, and change the entry for tscadc to the = following: >=20 > tscadc@44e0d000 { > compatible =3D "ti,am3359-tscadc"; > reg =3D <0x44e0d000 0x1000>; > interrupt-parent =3D <0x1>; > interrupts =3D <0x10>; > ti,hwmods =3D "adc_tsc"; > status =3D "okay"; > dmas =3D <0x29 0x35 0x0 0x29 0x39 0x0>; > dma-names =3D "fifo0", "fifo1"; >=20 > tsc { > compatible =3D "ti,am3359-tsc"; > }; >=20 > adc { > #io-channel-cells =3D <0x1>; > compatible =3D "ti,am3359-adc"; > ti,adc-channels =3D <0 1 2 3 4 5 6>; > }; > }; >=20 > ActualLy I changed the status from "disabled" to "okay" and I added = the ti,adc-channels descriptor to the adc section. >=20 > 3. save the original DTB and compile the DTS: >=20 > mv am335x-boneblack.dtb am335x-boneblack.dtb.orig > dtc -O dtb -o am335x-boneblack.dtb -b 0 am335x-boneblack.dts >=20 > 4. restart >=20 > 5. check it: >=20 > sysctl dev.ti_adc > .... > dev.ti_adc.0.ain.6.input: 0 > dev.ti_adc.0.ain.6.samples_avg: 0 > dev.ti_adc.0.ain.6.open_delay: 0 > dev.ti_adc.0.ain.6.enable: 0 > dev.ti_adc.0.ain.5.input: 0 > dev.ti_adc.0.ain.5.samples_avg: 0 > dev.ti_adc.0.ain.5.open_delay: 0 > dev.ti_adc.0.ain.5.enable: 0 > dev.ti_adc.0.ain.4.input: 0 > dev.ti_adc.0.ain.4.samples_avg: 0 > dev.ti_adc.0.ain.4.open_delay: 0 > dev.ti_adc.0.ain.4.enable: 0 > dev.ti_adc.0.ain.3.input: 0 > dev.ti_adc.0.ain.3.samples_avg: 0 > dev.ti_adc.0.ain.3.open_delay: 0 > dev.ti_adc.0.ain.3.enable: 0 > dev.ti_adc.0.ain.2.input: 0 > dev.ti_adc.0.ain.2.samples_avg: 0 > dev.ti_adc.0.ain.2.open_delay: 0 > dev.ti_adc.0.ain.2.enable: 0 > dev.ti_adc.0.ain.1.input: 0 > dev.ti_adc.0.ain.1.samples_avg: 0 > dev.ti_adc.0.ain.1.open_delay: 0 > dev.ti_adc.0.ain.1.enable: 0 > dev.ti_adc.0.ain.0.input: 3071 > dev.ti_adc.0.ain.0.samples_avg: 0 > dev.ti_adc.0.ain.0.open_delay: 0 > dev.ti_adc.0.ain.0.enable: 1 > dev.ti_adc.0.clockdiv: 2400 > dev.ti_adc.0.%parent: simplebus0 > dev.ti_adc.0.%pnpinfo: name=3Dtscadc@44e0d000 = compat=3Dti,am3359-tscadc > dev.ti_adc.0.%location:=20 > dev.ti_adc.0.%driver: ti_adc > dev.ti_adc.0.%desc: TI ADC controller > dev.ti_adc.%parent:=20 >=20 > I can enable the ADC channels, and when connecting a 1002 mV DC source = to AIN0 the reading was 2279, which is perfectly in line with = 1002*4095/1800 =3D 2279.55. >=20 > Best regards >=20 > Rolf