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.

MSPM0G1106: I2C issues

Part Number: MSPM0G1106

Hi, I'm implementing an I2C multimaster driver. Eventually it gets stuck in one of the many while loops that are required and my watchdog resets it.

I would like to avoid that and implement like a kind of timeout to reset only the driver and not the whole micro.

It gets stuck in those 2 cases.

Case 1

For switching it from controller to master, I have this sequence:

It gets stuck in that while.

Case 2:

When sending in controller mode, it gets stuck in either one of these whiles.

NOTE: Currently I'm testing collisions ( and I've never seen that interruption happen ) while activating 3 microcontrollers at the same time, so the "getting stuck issue" happens every 150-200 activations approx. 

So the thing is, I would like to create a timeout or something that would catch an error, restart the peripheral and break those whiles. 

This is my current configuration:

  • Asiel -

    Do you have a spare timer module that you can use to catch/implement a timeout while waiting on the while loop? 

    You can start/reset a timer when entering the while loop and then set a flag in the ISR for that timer.  If the flag gets set, you can break out of the while loop and then do your error handling. 

    Also, if you already have a timer that is running, you can just add a counter variable to that ISR. You can reset the counter before starting the while loop. 

    Then you can just test the count value to determine if you need to break the while loop. 

    -Jason