Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years, 2 months ago.
Why the code doesn´t work into the FRDM-K22F
I used the code and changed the ports to use the accelerometer / magnetometer on board K22F yet to use it and move it just me evuelve accelerometer values as X -1 -1 -1 AT Y and Z that I can or should I do??
Question relating to:
2 Answers
10 years, 2 months ago.
you should also set the proper i2c pin and slave addr for K22F, different from K64F
FXOS8700Q_acc acc( PTB3, PTB2, FXOS8700CQ_SLAVE_ADDR2); // Proper Ports and I2C Address for K22F Freedom board FXOS8700Q_mag mag( PTB3, PTB2, FXOS8700CQ_SLAVE_ADDR2); // Proper Ports and I2C Address for K22F Freedom board
10 years, 2 months ago.
There is an error in I2C library in mbed-src. Check this question: http://developer.mbed.org/forum/bugs-suggestions/topic/5220/
You have to load the library "mbed-src" and you have to change in the file "mbed-src/targets/hal/TARGET_Freescale/TARGET_KPSDK_MCUS/i2c_api.c the line 100 and you have to swap the "return I2C_HAL_GetStatusFlag(i2c_addrs[obj->instance], kI2CReceivedNak) ? 0 : 1;" to "return I2C_HAL_GetStatusFlag(i2c_addrs[obj->instance], kI2CReceivedNak) ? 1 : 0;
It will work!
posted by 07 Nov 2014