AnsweredAssumed Answered

I2C hangs intermittently

Question asked by iscan on Feb 17, 2016
Latest reply on Mar 6, 2016 by Erich Styger

Hello all,

I am using the PE components (including mcuonelcipse) for a FRDM-K22F board using KDS 3.1.0  I am using the FreeRTOS PE component.

The RTOS system has a shell task and a couple of LED tasks.  The FRDM board is connected to a DS3232 RTC and a 24C32 EEPROM, connected with short wires.

 

The code hangs intermittently at the line highlighted below. I can duplicate the problem in various conditions.

 

The difficult part:  It works a lot of the time.

 

I can duplicate the problem calling PE functions in my code and using the shell interface. 

As an example of the problem, I can read the data from the RTC registers if I start at address 0.  If I try to start reading at a higher address it will hang.

Some of the PE components work properly (tested via shell) like setting / reading date/time on the RTC. Other PE components hang immediately when they access the bus - I2CSPY, 24Cxx EEPROM.

 

I have tested this with *similar* results on FRDM boards for KL46, KL26, and K22F.  By this I mean the same project with different processor - the I2C fails for different operations

I have NOT been able to duplicate the problem without the RTOS but I haven't tested that extensively.

 

The flag that is being tested "GI2C_deviceData.dataTransmittedFlg", can be changed through the debugger when halted and the code will continue properly.

The same problem exists with the receive flag.

 

I suspect that in some conditions the interrupt that triggers those flags being set is being disabled.  I think this is related to the RTOS (I'm new to FreeRTOS) but not sure where to go next.  I have seen a couple threads indicating the same problem but it isn't clear if/how they were resolved.

 

I have been chasing this for a couple days. Any thoughts or advice welcome!

 

Thanks

Ian

Outcomes