From owner-freebsd-arm@freebsd.org Mon Feb 4 11:21:52 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 2D32D14C7C63 for ; Mon, 4 Feb 2019 11:21:52 +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 C083C81900 for ; Mon, 4 Feb 2019 11:21:50 +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 x14BLl1K075738 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Mon, 4 Feb 2019 12:21:48 +0100 (CET) (envelope-from ticso@cicely7.cicely.de) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cicely.de; s=default; t=1549279308; bh=F/btGv6x0DJXnrQbgb6vPrjyykHHFN+Kbsx1qjFv5iA=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To; b=ldhfU5QYZBHyAWZ20XDwypRiFCAxkC2AnqORKv6gPyr7OMGiS6j58o/94+eV85S8v qo8jB4qwq8L1l75c3qlqnH54thHBOomt82u7IC+P5cowJzSEsGsyqgJ59Xvr3FZCbk FEbI1HUwy3OsNp0QHeZ06HUSDFtN523x9FuVGdQo= 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 x14BLi3Q005713 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 4 Feb 2019 12:21:44 +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 x14BLiRe043244; Mon, 4 Feb 2019 12:21:44 +0100 (CET) (envelope-from ticso@cicely7.cicely.de) Received: (from ticso@localhost) by cicely7.cicely.de (8.15.2/8.15.2/Submit) id x14BLilV043243; Mon, 4 Feb 2019 12:21:44 +0100 (CET) (envelope-from ticso) Date: Mon, 4 Feb 2019 12:21:44 +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: <20190204112144.GE41812@cicely7.cicely.de> Reply-To: ticso@cicely.de References: <20190204090854.GA41812@cicely7.cicely.de> <20190204104434.559c5ade316cc37a918520be@bidouilliste.com> <20190204102825.GB41812@cicely7.cicely.de> <20190204103813.GC41812@cicely7.cicely.de> <20190204110220.GD41812@cicely7.cicely.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190204110220.GD41812@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: C083C81900 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=cicely.de header.s=default header.b=ldhfU5QY X-Spamd-Result: default: False [-2.38 / 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.64)[-0.644,0]; NEURAL_HAM_MEDIUM(-0.93)[-0.933,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 11:21:52 -0000 On Mon, Feb 04, 2019 at 12:02:20PM +0100, Bernd Walter wrote: > On Mon, Feb 04, 2019 at 11:38:13AM +0100, Bernd Walter wrote: > > 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. > > Wow - this is unbelieveable and unexpected. > They use 1N4148 diodes to drive the IC (RTC_VDD) from either the battery > or the main supply. > However, they use the supply rail to drive 1k IIC pull ups, so the battery > gets drained into the Raspberry via the resistors. > At 3V this would be 6mA current. > That poor little CR1220 drops below 1V. > Even if the volatge would stay high enough, the battery has 40mAh and would > be empty in less then a day. > The DVK512 board has the same issue. Removing the resisors completely helped. Obviously the Raspberry itself is sufficient the get the lines high. Will have to talk to the vendor once they are back in office after spring festival. -- B.Walter http://www.bwct.de Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm.