AnsweredAssumed Answered

Kinetis I2C MQX code

Question asked by Elizabeth Russell on Jul 5, 2011
Latest reply on Nov 29, 2015 by abid esmail

I am working with the Kinetis TWR-K60N512 kit and am trying to get some i2c code running. I am using CW10. I can run the i2c demo in the example code in the rev_1_4 folder from Freescale with no problem. This example doesn't use MQX.

 

However when I try to use MQX,  I get an unhandled interrupt  in the i2c task even though the task is using polled mode and the i2c interrupt is disabled in the bsp project. I started with the pe_demo_twrk60n512 example project (from the pe_demo project in the MQX 3.7 folder), modified the bsp_twrk60n512_pe project to add the i2c component, recompiled all the libraries, and added the i2c code as a separate task. I disabled all other tasks except the led task which still runs fine. The i2c task starts up but is aborted as soon as the unhandled interrupt is encountered. I can look at the i2c registers and verify that the interrupt is not enabled. I don't know what the source of the interrupt is.

 

I have also tried using the PE generated code as outlined in the help for the i2c component with my own external i2c peripheral (using I2C0) with the same result. The unhandled interrupt doesn't always occur at the same place in the code. And looking at the i2c communication on a scope hasn't revealed any errors. I installed a task exception handler using _task_set_exception_handler() and print out the exception number that is passed in. This value is always 3.

 

Any help would be greatly appreciated!

 

Outcomes