Resolution of MMA8451 on KL25Z

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

Resolution of MMA8451 on KL25Z

688 Views
michelmeunier
Contributor I

Hello,

I am using a FRDM-KL25Z board to use the accelerometer MMA8451 on it. The resolution is 14bits so -16384 to 16383. As it is set to +-2g mode (bit 0 and 1 of address 0x0E set to 0), the resolution is 32768/4=4096 step for 1g. When my board is horizontal, I get aproximatly 0,0,4096 for x,y,z. That's normal. But when I move the board in an other position, the value of x,y,z are ALLWAYS even. So in fact the resolution is 2048 steps for 1g. There is something I don't understand.

Michel

0 Kudos
4 Replies

503 Views
mjbcswitzerland
Specialist V

Michael

In 14 bit mode the range is 0x0000..0xfffc and the final 2 bits are always zero.

The first application at http://www.utasker.com/kinetis/FRDM-KL25Z.html includes accelerometer operation in 14 bit mode (enabled it with "acc_on" in the I2C menu on the virtual COM port). Compare its output vaues with yours.

It uses 2g mode.

Regards

Mark

0 Kudos

503 Views
michelmeunier
Contributor I

Hello,

I know that, it's the reason why the number return is ( >>2 ), so I shouldn't have allways even value.

Michel

0 Kudos

503 Views
mjbcswitzerland
Specialist V

Hello Michel

There was no indication originally that you were shifting the result before displaying it. In this case I expect 0x0000..0x3fff as range.

There are some results from my FRDM-KL25Z in 2g 14 bit mode when the board is randomly moved around (I have shifted the values read by >>= 2)

Status/X/Y/Z

3-axis state: 0x00 0x340c 0x3fb0 0x0ada

3-axis state: 0x0f 0x31f2 0x3e93 0x0911

3-axis state: 0x00 0x30da 0x3a73 0x05ae

3-axis state: 0x00 0x3338 0x36e9 0x0151

3-axis state: 0x00 0x39de 0x3059 0x3f43

3-axis state: 0x00 0x017c 0x2e41 0x01cb

3-axis state: 0x00 0x01ee 0x32a6 0x0476

3-axis state: 0x00 0x04b6 0x314b 0x0549

3-axis state: 0x00 0x0042 0x36b8 0x0e24

3-axis state: 0x00 0x3e12 0x02c4 0x0f8f

3-axis state: 0x00 0x0089 0x0960 0x0b7c

3-axis state: 0x00 0x01f5 0x0a72 0x0ce1

3-axis state: 0x00 0x034d 0x3ec1 0x0fdb

3-axis state: 0x00 0x0404 0x3de6 0x0f3c

3-axis state: 0x00 0x0558 0x3cb3 0x0e77

3-axis state: 0x00 0x05e7 0x38a6 0x0ea4

3-axis state: 0x00 0x0009 0x38f0 0x0e91

3-axis state: 0x09 0x347f 0x3b05 0x09a2

3-axis state: 0x00 0x338a 0x3abb 0x0572

3-axis state: 0x00 0x3603 0x0005 0x37c4

3-axis state: 0x00 0x386e 0x3ac3 0x3201

3-axis state: 0x00 0x3cf3 0x2e43 0x3bc9

3-axis state: 0x00 0x3b3c 0x2b5f 0x0125

3-axis state: 0x00 0x3c1e 0x33b9 0x06d9

3-axis state: 0x09 0x39fb 0x3e8e 0x0fa5

3-axis state: 0x00 0x3c1b 0x3e82 0x0ec1

3-axis state: 0x00 0x0096 0x3fd7 0x108c

3-axis state: 0x00 0x013f 0x0055 0x1140

3-axis state: 0x00 0x0118 0x005e 0x0ff3

3-axis state: 0x00 0x0117 0x0058 0x0ff2

3-axis state: 0x00 0x0111 0x005b 0x0ffa

3-axis state: 0x0b 0x0114 0x004f 0x0ffc

3-axis state: 0x00 0x0115 0x0056 0x0ffb

3-axis state: 0x00 0x011b 0x005c 0x0ff4

3-axis state: 0x00 0x011d 0x005b 0x1003

3-axis state: 0x00 0x0118 0x0051 0x0fe7

3-axis state: 0x00 0x0118 0x0061 0x0fe8

3-axis state: 0x00 0x0115 0x0061 0x0ffa

This shows that the LSB changes in all three axis.

Try the attached binary on your board to verify that there is no difference.

Connect to its OpenSDA virtual COM at 115'200 Baud, move to the I2C menu (7) and then turn on the output with "acc_on".

If the behavior is then as expected double check all of your configuration values.

Regards

Mark

0 Kudos

503 Views
michelmeunier
Contributor I

Hello,

Thank you Mark for your answer. I have test your program on my first FRDM-KL25Z, and the problem is still here, the values are allways even. BUT with my other board the problem disappear!!

I think the MMA8451 is wrong on my first board.

Thanks again

Michel

0 Kudos