Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Nov 2014 13:47:45 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-arm@FreeBSD.org
Subject:   [Bug 195009] [patch]: [arm] Use 400 kHz as the default OMAP4 I2C bus speed
Message-ID:  <bug-195009-7-xK6F4AKLpo@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-195009-7@https.bugs.freebsd.org/bugzilla/>
References:  <bug-195009-7@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=195009

Luiz Otavio O Souza,+55 (14) 99772-1255 <loos@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |loos@FreeBSD.org

--- Comment #2 from Luiz Otavio O Souza,+55 (14) 99772-1255 <loos@FreeBSD.org> ---
(In reply to Scott Ellis from comment #0)
> The I2C bus speed for OMAP4 boards defaults to 842 kHz.
> 
> The formula for calculating this comes from the TRM table 23-8
> 
>     scl = i2c_fclk / ( ( psc + 1) * ( (scll + 7) + (sclh + 5) ) )
> 
> The code says it's attempting 1 MHz, but it's using the wrong values.

Yes, that is right.

These values comes from TRM table 23-9 in "Fast Mode+".

The TRM doesn't take into account the '+ 1' for the prescaler value (psc), but
only for Fast Mode+, all the other values seems correct.

For a internal clock frequency of 19.2 MHz we need to set the prescaler to 4:

96 MHz / (4 + 1) = 19.2 MHz

And then the bus frequency is:

19.2 MHz / (3 + 7) + (4 + 5) = 1.010 MHz

Good catch! Thanks!

-- 
You are receiving this mail because:
You are the assignee for the bug.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-195009-7-xK6F4AKLpo>