0

I have a simple device with a MKW41Z MCU which uses one of its I2C buses to communicate with an ADXL343 accelerometer and MAX17263 fuel gauge. Approximately once every 20-30 power-ups, the bus with the two devices simply doesn't respond. If I set the pin function to be GPIO I can control it, so that rules out a problem with the MCU's pin drivers.

I have attached screenshots from the schematic. My main suspect is the ADXL343, as it's a new addition to the design, the previous accelerometer, MMA8451, having been affected by the chip shortage.

enter image description here enter image description here

Alex
  • 101
  • 5
  • 1
    Have you put a logic analyzer on it? Maybe use a spare GPIO pin from the MCU to trigger a capture when the device fails to respond? – Solomon Slow Aug 04 '21 at 14:41
  • 1
    I did. The bus simply doesn't do anything, it looks like one of the devices is not allowing the line to change. It also only happens on a power-up, never while in operation – Alex Aug 04 '21 at 14:48
  • 1
    It is a bit unclear what you mean though "*it happens only on power-up, never while in operation*" This is implying your code tries to talk with them almost immediately on power up and that first communication doesn't work, but subsequent communications do. Are you waiting long enough before initating communications? Maybe one of the ICs takes longer to start up than you code does. – DKNguyen Aug 04 '21 at 15:10
  • 1
    Which line is stuck - SDA or SCL? if it's SDA that's stuck, what happens if you perform an "I2C recovery procedure" by toggling SCL a lot of times and finally attempting an I2C STOP condition? – brhans Aug 04 '21 at 16:24
  • @Alex - Hi, "*I did [put a logic analyzer on it]. The bus simply doesn't do anything,*" (a) Does that mean that both signals are recorded as staying "high" or only one, or ...? (b) Some types of problems will not be visible on a logic analyzer output. Have you got an oscilloscope which you can use to capture both SDA & SCL at the relevant time? Since we don't know what is happening on those signals (other than the logic analyzer apparently not recording any valid *logic level* changes), I can suggest how I would gather that trace, if needed. (c) Schematic shows no decoupling C for the ADXL343. – SamGibson Aug 04 '21 at 16:27
  • The MCU I2C peripheral has a status register, what does it tell you why it does initialize properly or why does it not start transmissions normally? Sometimes, if the MCU peripheral sees an invalid transaction on the bus, due to powerup or glitch, it will think someone else is master on the bus and it won't start communicating if it looks like there is another device still communicating. That's a pretty typical errata on MCUs I use - deinitialize, reset, and reinitialize I2C peripheral. – Justme Aug 04 '21 at 18:05
  • Unfortunately because this happens really rarely, I'll need to wait until the next time that it happens to gather more data. @SamGibson: There is a decoupling capacitor, but the HW designer places all decoupling caps in one section of the schematic. – Alex Aug 05 '21 at 07:12
  • @Alex - Hi, "*There is a decoupling capacitor, but the HW designer places all decoupling caps in one section of the schematic.*" Thanks. Please understand that we cannot know that info, if it isn't shown on the partial schematic provided. For readers, that now raises the question - what *else* that we need to know about, isn't shown in the partial schematic provided? :-( (d) Can you supply full schematic & photos of the PCB? (e) If you have found any change which makes triggering the problem more or less likely (even though it still happens sometimes) that is useful info. || Anyway, good luck! – SamGibson Aug 05 '21 at 17:17
  • Managed to get it to happen again and was able to scope it this time. When the I2C peripheral was locked, SCL was high, while SDA was low, which as was pointed out, signifies a start condition received by the MCU which is why it probably locks. – Alex Oct 15 '21 at 09:12
  • I will take a SWAG: Check your RESET signal, to be sure all devices receive at least the minimum reset pulse. I have this happen many times with power turn on. Mostly because of a fast reset but also there is a delayed spike in the power or it has a very slow rise time, another parameter that needs to be checked. Not knowing your bus length I would consider lowering the Pull Up resistors from 5.7K to maybe 3.3K. – Gil Jul 28 '23 at 15:04

1 Answers1

0

Were you following the read protocol from the MAX17263 manual of:

  • Slave Addr
  • Mem Addr
  • Slave Addr (again)
  • DATA0 LSB
  • DATA0 MSB ...
  • NACK, STOP
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 17 '21 at 13:31