Reading Aggregated Data Legacy Mode on MMA9555L

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Reading Aggregated Data Legacy Mode on MMA9555L

1,544 Views
neilporven
Senior Contributor I

After sending the command to read the data, I collect the data, but is always the same thing?

I don't know if you're suppose to keep sending the command each time you want to collect the data, that

is what I am doing.

Its always

99hex 06hex 06hex 00hex 06hex 1Fhex 1Ahex

I am not sure about the last two, but they are always the same?

I believe I am suppose to get 

99hex 80hex then the six bytes for x,y,z .

Can someone let me know why I am getting the same thing all the time?

Thanks.

Labels (1)
Tags (1)
0 Kudos
8 Replies

1,157 Views
JackITB
NXP Employee
NXP Employee

Hello Neil,

Ok, I see what misleaded you.

I believe that Example 8 at page 47 of MMA9555L manual is wrong, sorry about that.

Reason is that the MBOX application (APP_ID 0x04) has only configuration registers and no status (or output data) registers, hence you cannot request any status register out of it. That's why the command "0x04 0x30 etc..." returns an error.

This application (together with MBOX config App_ID 0x18) are meant to assign specific Application results into given Mailboxes number (that can be assimilated to sensor registers address). Then those results are directly available by reading associated Mailboxes, without involving the 2 steps command/response protocol:

   1/write to APP_ID to query result

   2/read appropriate status registers to fetch the output data

Hence the Quick-read in Legacy Mode makes data collection simpler and faster.

For the record, you may also program INT_O to signal the host MCU that new data is ready:

on top of the LEGACY bit-field, set INT_O_EN and INT_O_FRAME_EN to 1, in MBOX config register. 

Below is a comparison of the legacy/normal modes, still based on current example (settings are the one I already provided).

I simply halted the device before (command W00 12 20 16 01 01) to froze the AFE data.

IIC WRITE TRANSACTION :: Starting MB = 00
Write : 12 20 06 01 01 // enable sleep mode (STOPNC) in Sleep-Wake Application

Quick-read Mailboxes, legacy mode

IIC READ TRANSACTION :: Starting MB = 1A, No. bytes to read = 6
Read : FF A1 FF A6 10 D7

Standard Command/response transaction, for same data

IIC COMMAND TRANSACTION :: Starting MB = 00, No. bytes to read = 10
Write : 06 30 18 06 // query AFE Stage0_LPF data
Read : 06 80 06 06 FF A1 FF A6 10 D7

pastedImage_13.png

Regards,   Jacques.

1,157 Views
neilporven
Senior Contributor I

Thank you Jacques,

I followed your transaction log and it worked!  Now I am getting the sensor values.  I guess the documentation needs to be updated, because

if someone tries the example given, they will get lost as well and will not get the sensor data.

One other question?  In your example you have FF A1 FF A6 10 D7, in which direction where you moving your sensor? Was this up/down on the Z-axis?  It seems that even if I don't move the board, the X, Y, and Z values are changing at least on the LSB.  I would have thought that the LPF

would have corrected certain small jumps or give steady data.

Thank you,

Neil

0 Kudos

1,157 Views
JackITB
NXP Employee
NXP Employee

Hello Neil,

Glad to see you can now proceed with your evaluation. 
Regarding the sensor data: (X,Y,Z) = (-95, -90, 4311) counts in decimal, they've been taken while demoboard was laying horizontal and still on a table. As default FSR was 8g (1count = 0.244mg) => (X,Y,Z) = (-23, -22, 1052) mg.

This is in line with the datasheet (Z axis pointing upward) and represent the earth gravity "static acceleration". 

pastedImage_2.png

I'm not that surprised that measured acceleration data exhibit some noise, as the LPF coefficient defaults to 0 (no filtering).

Did you tried to configure/increase it to reduce the noise further?

pastedImage_3.png

Having said that, as the LPF has an IIR structure, so you may still experience some residual numeric/quantization noise.

Do you have any requirement on this ?

Regards,   Jacques.

0 Kudos

1,157 Views
neilporven
Senior Contributor I

Hi Jacques,

Thank you for replying to my question.  I don't have any requirements on this.

I really don't know if I need LPF data, normalized data, or raw data? 

I would like to know what is the difference between them?

What I am experiencing with the LPF data as I explained is as follows.

The X-axis with the board laying flat on the breadboard no movement I get (this is converted values to decimal)

87, 67, 110, 95, 68, 124, 75, 92, 105, ...... etc.  I would expect some bouncing but rather in this form 87, 88, 89,

86, 88, 90, in other words values close to each other +/- 4 or maybe 5, not the big swings I am seeing.

This is why maybe the LPF data is not what I need and maybe the normalized data, or maybe the raw data?

Maybe you can help me with this.

Thank you,

Neil

0 Kudos

1,157 Views
JackITB
NXP Employee
NXP Employee

Hello Neil,

I configured the MMA9555L with the following settings and it operates as expected (acceleration changes according to DUT orientation).

Please note that default data rate is about 30.5Hz so you need to wait enough time for a new measurement to be completed.

You can also program INT_O output pin as a DataReady interrupt for the host MCU.

W00 12 20 06 01 00 //disable sleep mode (STOPNC) in Sleep-Wake Application

   simplified notation => Write 5 bytes (12 20 06 01 00 hexadecimal), stating at Mailbox/register address 0x00

W00 04 20 2C 0C 06 18 06 19 06 1A 06 1B 06 1C 06 1D //set up quick-read mailboxes MB26-MB31 to contain the FRONTEND_488_100_LPF XYZ data
W00 18 20 00 01 10 //configure the Mailbox application to operate in Legacy mode

R1A-1F (read Mailboxes/registers 0x1A to 0x1F in "Quick-read Legacy mode")

move the DUT

R1A-1F

move the DUT

etc...

Below is the I2C transaction log: 

pastedImage_1.png

Regards,   Jacques.

0 Kudos

1,157 Views
neilporven
Senior Contributor I

Hi Jacques,

Thank you for replying, I was starting to think my post was not being viewed or understood.

Anyways, I noticed that in your transaction log you are not sending 04H 30H 1A 06H, which

the manual states you need?  Does this mean the last part of the steps in the manual are

wrong?

I will try what you suggested of course.

Thank you,

Neil 

0 Kudos

1,157 Views
neilporven
Senior Contributor I

Another update,

I switched somethings around and now after sending the following command (Page: 47 of MMA9555L Intelligent Pedometer Data Sheet, Rev. 2.2):

MBOX0 = 0x04 /* Host communicating to MBOX Application

MBOX1 = 0x30 /* Read Output Data command

MBOX2 = 0x1A /* Starting at Offset 0x1A, the hexadecimal offset for mailbox 26

MBOX3 = 0x06 /* Number of bytes to read 6 bytes two bytes each for X, Y, andZ

Bytes to send: 0x04, 0x30, 0x1A, 0x06, 0x__ , 0x__ , 0x__ , 0x__ , 0x__ , 0x__ .

Response:

0x99  0x04  0x84, then followed by the low pass data configuration????

Instead I should be getting

0x99

0x44

0x80

MBOX4 = 0x__ /* MSB - X

MBOX5 = 0x__ /* LSB - X

MBOX6 = 0x__ /* MSB - Y

MBOX7 = 0x__ /* LSB - Y

MBOX8 = 0x__ /* MSB - Z

MBOX9 = 0x__ /* LSB - Z

Error Code 84 states the following:

0x04             MCI _ERROR_PARAM                        Incorrect input parameter. Error may be due to an incorrect application ID, an incomplete                                                                                            command, or an incorrect offset.

1.  The application ID  is correct 0x04

2.  Command is complete App ID, command, offset, bytes to read

3.  Incorrect offset  *****  This one I am not too sure about *********  The comment is 0x1A is for mailbox 26, but I believe it should be 2D from Table 46

Is the offset bad?  Is the documentation bad?  Can someone help?

thanks,

Neil

0 Kudos

1,157 Views
neilporven
Senior Contributor I

Ok, let me correct the response 

Its always
99hex 06hex 06hex 00hex 06hex 19hex 06hex 1Ahex

The command I send is: W00 04hex 30hex 1Ahex 06hex  (page 47 of MMA9555L.pdf)

then I send R(99) , then the above is the response?

I always start with the wake, legacy, LPF data config, and finally the command

mentioned above.

Can someone, tell me why am I getting the above response?

If I send the command once, can I simply sit collecting? Or do I always have to

send W00 before collecting?

Thanks.

0 Kudos