MAX21000CQ Gyro interfacing with FRDM-K20D50M board

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

MAX21000CQ Gyro interfacing with FRDM-K20D50M board

751 Views
Amit_Kumar1
Senior Contributor II

Hi

I am trying to interface MAX21000CQ Gyro with FRDM-K20D50M board Through I2C, I am having a confusion of address selection, please refer the following table

pastedImage_0.png

By default I have connected SA0 PIN to logic 1 ,

when I am sending the command, i.e GI2C1_WriteByteAddress8(GYRO_I2C_ADDR, GYRO_CTRL_REG_1, GYRO_ACTIVE_BIT_MASK);   in this code

GYRO_I2C_ADDR will be 0xB2  ??

and while receiving data i.e GI2C1_ReadAddress(GYRO_I2C_ADDR, (uint8_t*)&addr, sizeof(addr), &InpData, sizeof(InpData));    in this

GYRO_I2C_ADDR will be 0xB3.  ??

I am confused with the R/W bit addressing. So Please look into the matter.

Thanks and Regards

Amit Kumar

Tags (5)
4 Replies

538 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Amit,

I think your understand is right and I've also included the I2C device address sequence of MMA8451Q with the reply.

The I2C device address sequence of MMA8451Q is as same as MAX21000CQ Gyro, so please refer to it for details.

I hope my support can help you. If you have any other questions, please feel free to constact with me.

Best regards,

Ping

3.jpg

537 Views
Amit_Kumar1
Senior Contributor II

Hi Ping

Thanks for the reply. I think if we are using PE component i.e GenericI2C , So we need to have 7 bit address i.e in your example we select 0x1C or 0x1D according to SA0 bit. the final 8th bit value is done by the write and read command of the PE component.

So in my case the address which I had to write is 0x59 instead of 0xB2 or 0xB3  ie 7 bit address. the 8th bit will be automatically added by the PE component.

just to clarify,  While exploring I found out that the FXAS2100 gyro from freescale has the following configuration

pastedImage_2.png

So in this case also we need to select 7 bit address according to SA0 pin ie 0x20 or 0x21. the 8th bit will be added by the PE component??

i.e GI2C1_WriteByteAddress8(); and GI2C1_ReadAddress();  Please correct me if I am wrong. I tried the above address also which I mentioned but while in debug mode my programs hangs in the 1st command i.e write command.

Thanks and Regards

Amit Kumar

0 Kudos

538 Views
TomasVaverka
NXP TechSupport
NXP TechSupport

Hi Amit,

Your understanding is correct.


With the SA0 pin low, the 7-bit I2C address for the FXAS2100 is 0x20 followed by the R/W bit. This translates to 0x40 for a write and 0x41 for a read. An alternate I2C address of 0x21 (followed by the R/W bit) can be chosen with the SA0 pin high. This translates to 0x42 for a write and 0x43 for a read.


When using an I2C component (I2C_LDD) in Processor Expert, just write the selected 7-bit I2C address in the properties (Target slave address) as shown below. Make sure to switch the format to the ‘H’ mode, as you are entering hex values.


FXAS2100 Slave Address.JPG.jpg


I hope it helps.


Regards,

Tomas

0 Kudos

538 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Amit,

I'm glad to receive your reply. Regarding about the GenericI2C you mentioned in last reply, I can't find in componets library, so I don't know about the struct of GI2C1_WriteByteAddress8 and GI2C1_ReadAddress(). However I've included a accelerrometer_demo which KL25 connect MMA8451Q through I2C interface. In this demo code, the R/W bit is added by PE. I think it should be useful for reference. I hope my support can help you.

I'm looking forward to your reply.

Best regards,

Ping

0 Kudos