Hi Dave,

Thank you for your answer. Sorry for the very late reply. I couldn't find a
patch for the mimxrt I2C that seemed to solve a similar issue. Moreover, I
think that the lpc54_i2c driver is based on the lpc43 driver.

However, a weird thing happens. If I change the code inside the wm8904
driver to write a reg by doing two transfers: the register address and then
the value, everything works. I first noticed it when I manually wrote all
the register values using the i2c set command and to my surprise it worked.
I then noticed that the i2c set command writes using two messages. Do you
have any ideas of what could be the issue?

Best regards,
Andrei


În dum., 23 feb. 2020 la 16:32, Dave Marples <d...@marples.net> a scris:

> Andrei,
>
> Might be a red herring but take a look at the i2c module for
> mimxrt....there were changes applied there recently for similar issues. It
> could well be that the modules have common heritage and so have the same
> bugs...not at my desk otherwise I'd have a look myself.
>
> Regards
>
> Dave
>
> On Sun, 23 Feb 2020, 12:57 Andrei Stefanescu, <andr3i.stefane...@gmail.com
> >
> wrote:
>
> > Hi,
> >
> > I am planning to use the wm8904 codec(found on the lpcxpresso54628 board)
> > with Nuttx.
> >
> > I have the following problem: during the initial I2C setup of the wm8904,
> > when trying to write to the 0x21 register, there is an indefinite stretch
> > for the slave ACK. I attached the screenshots from the oscilloscope. The
> > first one is with the start sequence which seems ok and the second one
> > shows the failure. The 9th bit, the one for the slave ACK, stretches
> > indefinitely. The SDA line seems to go up a bit, so I'm guessing that
> > WM8904 does something. I don't understand why SCL doesn't go low. The I2C
> > module reports a Start/Stop error and then goes to the idle state.
> >
> > I also tried the FreeRTOS example and it seems to work. I modified that
> > example so that it would perform the same I2C writes and it still works.
> I
> > checked to see if there are any differences between the I2C module init
> and
> > I2C transfer function but I couldn't identify anything important.
> >
> > I also set up the MCLK and checked it with the oscilloscope and it is ok.
> > Note that I mainly tested with I2C_POLLED but the problem seems to also
> > appear on interrupt based transfers.
> >
> > Also, something that is bothering is that the behavior is a bit flaky. At
> > first time it will fail to write reg 0x21, after a reset(SW1 button) it
> > will fail to read the wm8904 id and after another reset it will again
> fail
> > to write 0x21 and so on.
> >
> > Do you have any ideas or suggestions? Have you seen this behavior before?
> >
> > I also attached a patch for I2C, the I2C stop command wouldn't be sent
> for
> > a write message.
> >
> > Best regards,
> > Andrei Stefanescu
> >
>

Reply via email to