This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

I2C hanging during first boot f28069

Hi there,

I am having an issue with my last project in which the I2C seems to hang the very first time that them Microcontroller is powered up. However once the CPU is reset, the issue disappears.

The microcontroller is F28069 and I have 2 devices connected to the I2C bus, which seem to work fine after the second boot.

In the actual configuration, the code is in the flash but then I copy it to the RAM to for fast execution.

I tried to load the symbols using the debugger, but as the CPU restarts once you load them, once I run the code with the symbols loaded the code executes properly, so I am not able to duplicate the problem.

I though of displaying some sort of debug information using the serial port to figure out where exactly is hanging, but as only happens the first time is powered up, I am not able to establish a successful communicative (the COM port does not even exist because the board is switched off)

Any ideas of what could be the cause? Is there a way I could debug it to figure out what the issue is?

Thanks a lot for your help

regards,

Javier

  • Hi,

    Immediate solution for this to get working is to probably adding some delay for the initialization.

    Regards,

    Gautam

  • Hi Gautam,

    Thank you for your prompt reply.

    I have tried that but this does not fix the problem. The I2C initializes correctly and it evens set up the 2 I2C slaves properly. However The program hangs once I try to read from one of the i2C devices...

    I just managed to connect a debugger in real time mode and I could see that the I2C device from which I am trying to read is completely upset blocking the i2C bus completely.

    In fact, I reset the I2C bus setting the IRS to 0 and then MST, STT and STP to 0 as well and lastly setting IRS to 1 and retry communication. Then for the transmission I set the STT, STP and MST to 1 but then there is none interrupt being generated at all and the STT, STP and MST bits remain set to 1.

    The only solution I founf to unblock the situation is to physically disconnect the I2C device from the network and plug in it again and then the system start to work again.

    The interesting part is that this condition NEVER happens after a second boot and never during a debugging session.

    As I said, I managed to connect the debugger in real time and I could see where the program hangs, but unfortunately it is too late to see what caused the problem...

    My guess is that the second device (LED driver) is basically trying to transmit while the other I2C is communicating, although I take care of checking BB bit and STP etc it within the code, but  for some reason during the first boot one of those checks fails... but I cannot duplicate the issue with the debugger...

    any ideas?

    Thanks

  • Hi,

    You mean to say that there is a possibility that LED driver is interfering with the I2C communication. If so then why don't you remove the driver and check the communication part?

    Regards,

    Gautam