9 years, 5 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:

A Simple Hello World for the FXAS8700Q combination accelerometer / magnetometer FXOS8700Q

2 Answers

9 years, 5 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

Accepted Answer

thank you very much longer works and gives me values X, Y and Z per, I would like to know where and how should I add the calculations to make a compass with the magnetometer ... if you could help me I'd appreciate it and thank you very much for all the support

posted by Alfredo Nahuat 07 Nov 2014
9 years, 5 months ago.

There is an error in I2C library in mbed-src. Check this question: http://developer.mbed.org/forum/bugs-suggestions/topic/5220/

I can´t found the library can you help me?

posted by Alfredo Nahuat 06 Nov 2014

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 Jose Corbalán 07 Nov 2014

I will change that part but still does not work! ... which could be the problem ??

posted by Alfredo Nahuat 07 Nov 2014