cancel
Showing results for 
Search instead for 
Did you mean: 

How can I prevent the I2C from getting interrupted?

Florian Moser
Senior

There's a sensor applied to the I2C as a slave. Also on this microcontroller there's a communication running on the UART-Interface in blocking mode. If the UART has to transmit a huge amount of data, it seems that the I2C (also blocking mode) can get interrupted, because the I2C Busy Flag is set and I cannot receive data via I2C anymore.

Is there a possibility for the I2C to not get interrupted?

Or am I doing something horribly wrong?

1 ACCEPTED SOLUTION

Accepted Solutions
Florian Moser
Senior

I just wanted to tell you that I've found the problem:

I'm running FreeRTOS and the priority of the UART task was higher than the priority of the I2C task and so the I2C could get interrupted by the UART. Sometimes this interrupt set I2C to busy state.

View solution in original post

3 REPLIES 3
Florian Moser
Senior

I just wanted to tell you that I've found the problem:

I'm running FreeRTOS and the priority of the UART task was higher than the priority of the I2C task and so the I2C could get interrupted by the UART. Sometimes this interrupt set I2C to busy state.

Piranha
Chief II

I'll remind that changing priorities doesn't solve the problem - it only hides it to come up again in a different situation. The code is incorrect and must be fixed!

Ok, so what's the actual problem? Why could the I2C get interrupted nevertheless? The UART and the I2C task have the same priority now, so they can't interrupt each other.