Re: I2C on Raspberry Pi 4B has wrong clock rate?

Daniel O'Connor <[email protected]>
Newsgroups gmane.os.freebsd.devel.arm
Message-ID <[email protected]>

> On 13 Nov 2024, at 14:27, Daniel O'Connor <[email protected]> wrote:
> I tried setting the frequency but it does not 'stick':
> [rpi13 3:56] ~ >sudo sysctl dev.iichb.0.frequency=10000
> dev.iichb.0.frequency: 100000 -> 100000

I tried lowering the clock frequency to 600MHz (from 1.5GHz) and it seems 100% reliable now..

I then tried increasing the clock divisor programmed in bcm_bsc_iicbus_reset by 3x and it works fine at 1.5GHz (and 600MHz).

I suppose in practise most users have devices which can run at 400kHz so running at 250kHz is no problem but the pijuice I2C is handled by a microcontroller so it is pickier.

Obviously fixing the code so it properly handles clock speeds changes would be good but I am not sure where to start with that.

The code uses IICBUS_GET_FREQUENCY() to find which rate to use for I2C - is there some tunable or hint that can set this? Or DTS?

Thanks.

--
Daniel O'Connor
"The nice thing about standards is that there
are so many of them to choose from."
-- Andrew Tanenbaum
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.