From owner-freebsd-hackers@freebsd.org Mon Aug 20 17:55:47 2018 Return-Path: Delivered-To: freebsd-hackers@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 958DB1077780; Mon, 20 Aug 2018 17:55:47 +0000 (UTC) (envelope-from rajfbsd@gmail.com) Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E916179C90; Mon, 20 Aug 2018 17:55:46 +0000 (UTC) (envelope-from rajfbsd@gmail.com) Received: by mail-wr1-x429.google.com with SMTP id g1-v6so13707153wru.2; Mon, 20 Aug 2018 10:55:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=wwOZv/9aHCETh455mFE3Lwr8S/NgRDPtK1ctk83xZkA=; b=RKU1d00zOIz2kVOKdWYy//8BIhYYWbn+Qh1JKzkTeqQVf17j4q7jkc5PgkNnjmUiHG 3JPODSKGlWwcMD+nrnSl7o9oWL8W6/4cVoGwDrfCDKFr9EGsHalr3nOX1kZrnQ7mI+Tm uLak9QQJk1sRjn59BshOpMaJKNGiFIxvShgKSFmE4LIXzMksvLQIdHv27fOTGHFgJM4t 2lkhZ3lq001nJbAVYT8Y9DVlTANsgHhFF/C+X17fTumzjgJCogh4sUiq22wMHokH86A8 pvlbHIJ+u+dPr7N6d9WLdE6c1pXirUAvWlykjvmh5CkfgCMQesPGCgPb/ZnJct9z7B1P 5liQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=wwOZv/9aHCETh455mFE3Lwr8S/NgRDPtK1ctk83xZkA=; b=MqFi8po3Jdl6zHhVLcoBEbbIcn+1q8qINduQuiffJZZ9WpLiJ5TqVXP1NlTPmWPbZ0 0LaZ3puLZXggQ0PShkE47n4iEDCndEAYn7whH7QHSeT+X6ovpA7jYSKa/uswK4/OQP5B JR3v3RLcuJQRw0Dk063kcszlisULu523u2ofDqYjo0+ZiYYKJKbQJCifDyDuO0yDIW24 Bb12TB8dcmdWpvJfmfW2jdLWDRHcXDjNR/fdxGubp/yzOqENPT9jx7BSESNJOwTTS5dV lmLxL6iVNc5h99OdA9qutaXzNy8hvVXTS4Vot0xKtPWE/ZNL+GuyyPhMl5xXIjWh36Bc zAeA== X-Gm-Message-State: APzg51A8g5H7oaoL0hJ74T8AB8FOQp+GMXi7GRTiR9Tqp4W353d47G/2 Vr0+wb7bbzX06Uh45lBYgowIjy+88UBeuuv0FhA= X-Google-Smtp-Source: ANB0Vda51o0Gqizdmb5km/8PzXw6gWpRxDQCWrfnJHizNqAjRurhH3iYCzcClMYJUBuvi5lhSzPa79Cj8Ihh7Y46IXg= X-Received: by 2002:a5d:4152:: with SMTP id c18-v6mr5119203wrq.61.1534787745172; Mon, 20 Aug 2018 10:55:45 -0700 (PDT) MIME-Version: 1.0 References: <1534523216.27158.17.camel@freebsd.org> <1534702861.27158.36.camel@freebsd.org> <1534771095.27158.46.camel@freebsd.org> <35F2C250-B4CB-4C53-BF8F-43C338022E34@yahoo.com> <20180820181322.71607854@ernst.home> In-Reply-To: <20180820181322.71607854@ernst.home> From: Rajesh Kumar Date: Mon, 20 Aug 2018 23:25:33 +0530 Message-ID: Subject: Re: Need a clarification regarding I2C bus frequency in FreeBSD To: gljennjohn@gmail.com Cc: freebsd-hackers@freebsd.org, marklmi26-fbsd@yahoo.com, danny@cs.huji.ac.il, freebsd-drivers@freebsd.org, ian@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.27 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Aug 2018 17:55:47 -0000 Hi, Re-posting the questions, just in case if its missed in other conversation. By "i2c clock frequency", I mean the internal base frequency only, which drives the chip. I thought data will be transferred on bus based on the base frequency. So, thought both bus and base frequency are same. But from what you said, seems both are different. So, based on the setting in *_HCNT/LCNT register, the bus frequency (which is the rate at which data is transferred) will change for a particular base frequency. Is that right? So, few questions here 1) As you said, we need to have a base frequency of 150 Mhz in our case. So, do we need to program that IG4_REG_CLK_PARMS to 150 Mhz (0x8F0D180)? And can this be done at the same time when programming the HCNT/LNCT registers? 2) Not sure how that 111Hz value is arrived. Can you please explain this calculation. So, that I can derive the appropriate values for HCNT/LCNT for different speeds at 150Mhz base clock. 3) "Default HCNT/LCNT register values would be consistent with an internal base clock speed of 1GHz", Does it mean with those values, all speeds can be achieved until 1GHz clock? On Mon, Aug 20, 2018 at 9:43 PM Gary Jennejohn wrote: > On Mon, 20 Aug 2018 07:16:15 -0700 > Mark Millard via freebsd-hackers wrote: > > > On 2018-Aug-20, at 6:18 AM, Ian Lepore wrote: > > > > > On Mon, 2018-08-20 at 11:13 +0300, Daniel Braniss wrote: > > >> > > >>> > > >>> On 20 Aug 2018, at 09:49, Daniel Braniss > wrote: > > >>> > > >>>> . . . > > >>> > > >>> hi, > > >>> I have similar issues with the allwinner/twsi but I do have a Saleae > Logic and here is a nice picture: > > >> ah, maybe this is better: > > >> > https://cs.huji.ac.il/~danny/Screen%20Shot%202018-08-20%20at%2011.06.43.png > > > > . . . > > > This has nothing to do with the twsi driver, this is about the ig4 > > > driver (found in sys/dev/ichiic). > > > > > > That screenshot seems to show a bus running at 100KHz like it should > > > (although the 62:38 duty cycle is a bit suspicious). > > > > Being a logic analyzer display, it my just be that the threshold > > was off from the optimal value. The waveform shape is not really > > visible. > > > > The logic analyzer output also shows a thick "rising" edge without the > > uparrow symbol. My guess would be that is a rising/falling/rising > > sequence that on the scale in use does not show space between edges. In > > other words: a glitch on the leading edge side of the intended pulse. > > This too might be tied to the threshold used vs . the actual signal > > properties: no way to tell from what is shown. > > > > I have two of these logic analyzers and they definitely do a > major clean up of the signals displayed. > > Things like overshoot and ringing, which can be seen on an > oscilloscope, do not appear on what the logic analyzer displays. > > I suspect the purpose of the trace was simply to show the 100KHz > SCL. > > -- > Gary Jennejohn >