From owner-freebsd-arm@freebsd.org Mon Feb 4 10:38:22 2019 Return-Path: Delivered-To: freebsd-arm@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D91714C6A18 for ; Mon, 4 Feb 2019 10:38:22 +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 12BE980113 for ; Mon, 4 Feb 2019 10:38:20 +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 x14AcHkT074994 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Mon, 4 Feb 2019 11:38:18 +0100 (CET) (envelope-from ticso@cicely7.cicely.de) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cicely.de; s=default; t=1549276698; bh=A/FcHgkjhQgbMdIWVWhM1S16jhruzNDCsKhshVTRo4s=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To; b=enZC9jczRQwdJRJ08SoOwA/DjBN8YYokiFuKjmcpBs1UG1XvP3B5eneUla1qNpDlv 4OGvzNbf6AKGbEn+Jy+BbHgvdqm7A9rDUxzcM6J9y8Nz5fyo2/qPCserGB+bOhmz9V Lmyy8xjN9aV+CkuR0aU5C1gteanY44Yk1IRFpR1g= 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 x14AcDQD004657 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 4 Feb 2019 11:38:13 +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 x14AcDWQ043069; Mon, 4 Feb 2019 11:38:13 +0100 (CET) (envelope-from ticso@cicely7.cicely.de) Received: (from ticso@localhost) by cicely7.cicely.de (8.15.2/8.15.2/Submit) id x14AcDUi043068; Mon, 4 Feb 2019 11:38:13 +0100 (CET) (envelope-from ticso) Date: Mon, 4 Feb 2019 11:38:13 +0100 From: Bernd Walter To: Emmanuel Vadot Cc: ticso@cicely.de, Bernd Walter , freebsd-arm@freebsd.org Subject: Re: Problem with PCF8563 RTC on Raspberry Message-ID: <20190204103813.GC41812@cicely7.cicely.de> Reply-To: ticso@cicely.de References: <20190204090854.GA41812@cicely7.cicely.de> <20190204104434.559c5ade316cc37a918520be@bidouilliste.com> <20190204102825.GB41812@cicely7.cicely.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190204102825.GB41812@cicely7.cicely.de> X-Operating-System: FreeBSD cicely7.cicely.de 12.0-STABLE amd64 User-Agent: Mutt/1.5.11 X-Spam-Status: No, score=-2.9 required=4.0 tests=ALL_TRUSTED=-1, BAYES_00=-1.9 autolearn=ham version=3.3.0 X-Spam-Checker-Version: SpamAssassin 3.3.0 (2010-01-18) on spamd.cicely.de X-Rspamd-Queue-Id: 12BE980113 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=cicely.de header.s=default header.b=enZC9jcz X-Spamd-Result: default: False [-2.60 / 15.00]; ARC_NA(0.00)[]; HAS_REPLYTO(0.00)[ticso@cicely.de]; R_DKIM_ALLOW(-0.20)[cicely.de:s=default]; RCVD_COUNT_FIVE(0.00)[5]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; MV_CASE(0.50)[]; NEURAL_HAM_LONG(-0.99)[-0.994,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[cicely.de]; REPLYTO_DOM_NEQ_FROM_DOM(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[cicely.de:+]; MX_GOOD(-0.01)[cached: mx1.bwct.de]; RCVD_IN_DNSWL_NONE(0.00)[3.99.149.195.list.dnswl.org : 127.0.20.0]; NEURAL_HAM_SHORT(-0.86)[-0.863,0]; NEURAL_HAM_MEDIUM(-0.93)[-0.932,0]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:21461, ipnet:195.149.99.0/24, country:DE]; MID_RHS_MATCH_FROM(0.00)[]; IP_SCORE(-0.00)[country: DE(-0.01)] X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Feb 2019 10:38:22 -0000 On Mon, Feb 04, 2019 at 11:28:25AM +0100, Bernd Walter wrote: > On Mon, Feb 04, 2019 at 10:44:34AM +0100, Emmanuel Vadot wrote: > > On Mon, 4 Feb 2019 10:08:54 +0100 > > Bernd Walter wrote: > > > > > I'm trying to get the RTC on a Waveshare ARPI600 module running on a > > > Raspberry Pi B. > > > This is the Overlay I'm using: > > > /dts-v1/; > > > /plugin/; > > > > > > &i2c0 { > > > status = "okay"; > > > > > > rtc: rtc@51 { > > > compatible = "nxp,pcf8563"; > > > reg = <0x51>; > > > }; > > > }; > > > > > > IICbus gets probed during boot: > > > iicbus0: on iichb0 > > > iic0: on iicbus0 > > > iicbus0: at addr 0xa2 > > > > > > When I load the nxprtc moduele I get the following error: > > > nxprtc0: at addr 0xa2 on iicbus0 > > > nxprtc0: cannot set up timer > > > > > > I wonder if I miss something, e.g. setting GPIO. > > > However, for spi0 no GPIO setup was required and the overlay looks > > > quite similar. > > > > Looking at the code it means that the driver didn't managed to talked > > to the chip via i2c, the start_timer function is the first time that > > i2c transfer is happening. > > That's my understanding of the situation as well. > > > Could be either pinmux problems or frequency (default is 100khz so it > > should work ok). > > What pin are you using to connect to the module ? > > Good point. > It is connected to Pin3/5. > Signals scoped turn out that they stay high. > Pinout diagram show that the Pins are named SDA1/SCL1, so probably I'm > just using the wrong controller. > Will give it a test on i2c1 instead. Yes, that was exactly the problem: nxprtc0: at addr 0xa2 on iicbus0 nxprtc0: WARNING: RTC battery failed; time is invalid nxprtc0: registered as a time-of-day clock, resolution 0.015625s And, after putting it into loader.conf to be active on kernel start: Setting date via ntp. 4 Feb 11:34:31 ntpdate[727]: step time server 94.130.184.193 offset -0.120565 sec Excellent, it kept time during reboot. But not after power loss. Mmmm. Have to check if the battery is good. > > Also it seems that the overlay i2c-rtc.dtbo from the Rpi fundation > > list this module but I'm unsure how to use this overlay. It is > > installed via the rpi-firmware package. -- B.Walter http://www.bwct.de Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm.