VIM3 - A311D - I2C AO Clock Questions

Lucas Tanure tanure at linux.com
Wed Mar 9 01:39:02 PST 2022


On Tue, Mar 8, 2022 at 6:49 AM Lucas Tanure <tanure at linux.com> wrote:
>
> On Mon, Mar 7, 2022 at 8:29 AM Neil Armstrong <narmstrong at baylibre.com> wrote:
> >
> > Hi,
> >
> > On 06/03/2022 11:23, Lucas Tanure wrote:
> > > Hi,
> > >
> > > I am trying to integrate an I2C device into VIM3 using the I2C_AO bus.
> > > My device uses a 100000Hz clock, but after changing
> > > meson-g12b-a311d-khadas-vim3.dts to add my I2C node the driver could
> > > not properly read its registers.
> > >
> > > It reads 0x9100, but the correct data should be 0xcb58.
> > > The first thing I saw on the bus was that the frequency I requested by
> > > the device tree was being set after the probe of my driver already
> > > failed.
> > > For that, I sent "i2c: meson: Fix wrong speed use from probe" which
> > > fixes that issue.
> > >
> > > But I still get the wrong data, so my next guess is that the clock
> > > duty cycle is 30%, and I think should be 50%.
> > > Here is an image of the signals of the bus:
> > > https://pasteboard.co/TEoxQucsXUUD.png
> > >
> > > I have tested other frequencies and all of them uses a 30% duty cycle,
> > > where SCL is up 30% and low for 70% of the period.
> >
> > Indeed it seems by default the duty cycle is for Fast Mode, but standard mode should
> > be around 50%. Did you try 400khz ?
>
> Yes, 400Khz has the same issue of 30% duty cycle.
>
> >
> > Amlogic did some changes on their off-tree linux fork, please look around:
> > https://github.com/khadas/linux/blob/khadas-vims-5.4.y-fc/drivers/i2c/busses/i2c-meson.c#L143
>
> Thanks! I am investigating that code, but so far doesn't work.
>
> >
> > I'm unsure when REG_SLAVE_ADDR BIT(28) appeared, but if you try to port this upstream,
> > we'll be happy to review it for inclusion.
>
> I will try to get this working and push a patch.
> Thanks
> Lucas
>
> >
> > Neil
> >
> > >
> > > Is possible to configure the clock to be 100000Hz, but with a 50% duty
> > > cycle for this I2C bus on A3111D?
> > >
> > > Thanks
> > > Lucas Tanure
> > >
> > > _______________________________________________
> > > linux-amlogic mailing list
> > > linux-amlogic at lists.infradead.org
> > > http://lists.infradead.org/mailman/listinfo/linux-amlogic

After some debugging, I got the 50% duty cycle working, but that was
not the issue.
The issue was that my device address is 0x22, the same as FUSB302B.

But FUSB302B is not on the device tree, so I didn't there was an
address collision.
I will push some patches for the duty cycle later this week.

Thanks
Lucas Tanure



More information about the linux-amlogic mailing list