Author Topic: FXOS8700 in FRDM-K64F  (Read 6460 times)

Offline carlos789

  • Newbie
  • *
  • Posts: 15
    • View Profile
FXOS8700 in FRDM-K64F
« on: September 10, 2015, 01:03:34 AM »
Hi Mark:
I am analyzing the reading of the acceleration in all three axes, using the file “iic_test.h”.
For this I uncommented the following defined:
#define TEST_FXOS8700                        // test monitoring the 6-axis sensor
#define DISPLAY_ACCELEROMETER_VALUES            // print values to debug output irrespective of debug setting
and in file “config.h”
#define IIC_INTERFACE                                                  // enable IIC interface driver
In debug mode, the result is:
3-axis state: 0xd2 0x08 0xfb 0xcc
I understand that I'm using MMA8451Q functions to read the accelerations in the FXOS8700?. Is this correct?

I uncommented the following defined:
#define MMA8451Q_14BIT_RES
In debug mode, the result is:
3-axis state: 0xd4 0xecfd 0xcc00
The measurement of the Z axis is missing?

Another question?
In the debug mode, pressing any key, the information on the terminal screen is reset. That is, again the measurements of the accelerometer and magnetometer appears. And I can not enter the Main Menu

Many greetings
Carlos
« Last Edit: September 10, 2015, 02:47:47 AM by carlos789 »

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: FXOS8700 in FRDM-K64F
« Reply #1 on: September 10, 2015, 03:05:07 AM »
Carlos

The FXOS8700 is backward compatible with the MMA8451Q if I remember correctly and so the (basic) code is much the same for both.

The define MMA8451Q_14BIT_RES specifically controls the 14 bit mode of the MMA8451Q and hasn't been used with the FXOS8700. The reason why you don't get enough outputs is that RESULT_LENGTH needs to be 7 in 14 bit mode and not 4, and this is not being controlled by the other define. Also it is necessary to configure the device differently, otherwise it will still be in 8 bit mode.

I have attached a new version of iic_tests.h with a new define FXOS8700_14BIT_RES which can be used together with this device for 14 bit operation.

With DISPLAY_ACCELEROMETER_VALUES set there will be a lot of data from the sensor displayed - the debug menu still works but will be difficult to see. It may be best to disable this option and just enable the output in the I2C menu when you want to see it. Then you can also disable it again afterwards.

Regards

Mark

Offline carlos789

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: FXOS8700 in FRDM-K64F
« Reply #2 on: September 10, 2015, 11:31:00 PM »
Mark:
Now I have the new version of “iic_test.h
The project,  has the following lines of code:

************************************
#define IIC_INTERFACE
#define TEST_FXOS8700                                                // test monitoring the 6-axis sensor
    #if defined TEST_FXOS8700
        #define FXOS8700_14BIT_RES
    #endif
    //#define DISPLAY_ACCELEROMETER_VALUES
***************************************   
But I still cannot enter the "Main Menu", wanting to enter an item, the terminal screen is reset.
Screen capture attached.
Regards
Carlos

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: FXOS8700 in FRDM-K64F
« Reply #3 on: September 11, 2015, 11:30:10 PM »
Carlos

I don't seem to be able to reproduce this behaviour  are you sure that the board is not 'crashing' after a short time or when you try to enter something? Watch the blink LED to ensure that it is running continuously.


Operational details:
Each time the serial input is used you should find that the application task is scheduled, which reads the new input by calling
while ((Length = fnRead(SerialPortID, ucInputMessage, MEDIUM_MESSAGE)) != 0) {
..
}

It then passes it to the command line input (in debug.c) for interpretation.

Regards

Mark