8 years, 4 months ago.

configuring FXAS21002

I am trying to read data from the fxas21002 gyroscope sensor from freescale. can any one tel me what is the initial configurations required for the sensor and also after reading the data, if there is any data conversion required how is it done. Please guide me

Regards Sathya Prasad

1 Answer

8 years, 4 months ago.

http://cache.freescale.com/files/sensors/doc/data_sheet/FXAS21002.pdf 1. Conenct the device to i2c mode:" To use the I 2 C interface, the I 2 C_B/SPI (pin 8) pin must be connected to GND (logic low) and the SPI_CS_B (pin 17) must be connected to V DDIO (high). FXAS21002C's I 2 C interface is compliant with I 2 C interface specification for Standard, Fast, and Fast Mode Plus modes as outlined in the I 2 C-bus specification and user manual - Rev 6 , published by NXP Semiconductors. The 7-bit slave addresses that may be assigned to the device are 0x20 (with SA0 = 0) and 0x21 (with SA0 = 1). When I 2 C_B/SPI is held low, the SA0/MISO pin is used to define the LSB of this I 2 C address. The key bus timing constraints are shown in Table 9 "

Mbed uses 8 bit adressing, so shift 0x20 one bit to left. Use mbed i2c class with multibyte read and write, so your code will work with Nucleo boards too. See HMC5883L mbed class about how to use i2c.

2. init the device, note: "A transition from Standby mode to Active mode takes 1/ODR + 60 ms, typical" Here some rigsters taht ypu need to initalize: "Active: All blocks are enabled (digital and analog), the device is actively measuring the angular rate at the ODR specified in 0x13: CTRL_REG1 " "NOTE When CTRL_REG3[ EXTCTRLEN ]

0, the Active mode

is entered/exited using the register interface ( CTRL_REG1[ ACTIVE ] bit). When CTRL_REG3[ EXTCTRLEN ]

1, the Active mode is

entered/exited via the logic state on the PWR_CTRL input pin (pin 2)"

As you read the spec, you will notice more registers that you might need to initalize to get the output you want.