10 years ago.

i2c not working

Hi there,

I spent a lot of time to get the I2C interface working on the freescale FRDM-K64F (LPC1768 working fine) The demo's with the accelleration and compass are working without a problem. With a scope I see the data and clock. Using my own I2C routine, nothing is working, no signals on the pins stay high all the time. I know PTE24 and PTE25 should be reversed and frequency should be 400000.

there is a lot to be read on the mbed site, lots of people with problems, but I could not find a solution.

please help me, kind regards, Andries

Question relating to:

The Freedom-K64F is an ultra-low-cost development platform for Kinetis K64, K63, and K24 MCUs.

Can you try the latest mbed-src ? There was a bugfix last week in I2C

posted by Martin Kojtal 18 Nov 2014

Or revert back to rev 89 of mbed.lib. I too wasted a whole day with i2c and rev 91

...kevin

posted by Kevin Braun 18 Nov 2014

thank you both for the comments. today i am out. tomorrow I will inform you about the results.

posted by andries oyens 19 Nov 2014

Dear Martin.

I am not sure how to work with the mbed-src files. I tried but got lots of errors like: Error: A value of type "void *" cannot be assigned to an entity of type "void " in "mbed-rtos/rtx/TARGET_CORTEX_M/rt_CMSIS.c", Line: 597, Col: 21 etc

Dear Kevin,

working with rev 89 did not do the trick. 91 gives errors with the EthernetInterface.

I like the FRDM-K64F a lot, but the I2C interface make me frustrated.Why is it so difficult???

cheers, Andries

posted by andries oyens 19 Nov 2014

src and rev 91 give errors with Ethernet Interface like Error: Too few arguments in invocation of macro "BW_MPU_CESR_VLD" in "EthernetInterface/lwip-eth/arch/TARGET_K64F/hardware_init_MK64F12.c", Line: 44, Col: 22

cheers, Andries

posted by andries oyens 19 Nov 2014

Hi there, i found a SOLUTION Stupid, but it works for me. 1-import FXOS8700Q lib and #include "FXOS8700Q.h" in main.cpp 2-add in main.cpp after I2C i2c(PTE25,PTE24); FXOS8700Q_acc acc( PTE25, PTE24, FXOS8700CQ_SLAVE_ADDR1); 3-in main() add: acc.enable(); acc.disable(); 4-now i2c.write() etc works !

hope it will help other people, cheers, Andries

posted by andries oyens 19 Nov 2014

1 Answer

10 years ago.

I havn't checked the K64 but the K22 I2C lines shown on the mbed pin image are also mapped to the default uart driving the opensda communications channel. I would recommend insuring that the I2C pins you chose are not already defined? I have a K64 so I'll check it out the next couple of days - I have a variety of I2C chips to test against.

Scott