IMU-3000 interfaced with MSP430F2471

By heike_reurik , 4 November 2011

Im interfacing a IMU-3000 with a MSP430F2471 through I2C. Im having problems coding the Write/Read Sequence of an I2C using the MCU as master and the IMU-3000 as slave. My I2C initialization is as follows:

RESET mov.w #SFE(CSTACK),SP ; (Initialize stackpointer)
StopWDT mov.w #WDTPW+WDTHOLD,&WDTCTL ; (Stop WatchDogTimer)
SetupUCB0 bis.b #UCSWRST,&UCB1CTL1 ; (Enable SW reset)
mov.b #UCMST+UCMODE_3+UCSYNC,&UCB1CTL0 ; (I2C Master, synchronous mode)
bis.b #UCSSEL_2+UCSWRST,&UCB1CTL1 ; (Use SMCLK)
mov.b #12,&UCB1BR0 ; (fSCL = SMCLK/12 = ~100kHz)
mov.b #00,&UCB1BR1
SetupP1 bis.b #00001111b,&P1DIR ; (P1.0 output)
bic.b #00001111b,&P1OUT

SetupP5 bis.b #00000110b,&P5SEL ; (Assign I2C pins to USCI_B1)
mov.w #68h,&UCB1I2CSA ; (Set slave address)
bic.b #UCSWRST,&UCB1CTL1 ; (Clear SW reset, resume operation)
bis.b #UCNACKIE,&UCB1I2CIE ; (Enable Not Acknowledge Interrupt)

To initialize the IMU-3000 im doing the following:

BIS.B #UCTR,&UCB1CTL1 ; (Transmitter mode)
BIS.B #UCTXSTT,&UCB1CTL1 ; (Start Sequence)

MOV.B #16h, &UCB1TXBUF ; (Register Address = 0x16)

loopTest:
BIT.B #UCTXSTT,&UCB1CTL1 ; (Wait until Start Condition is cleared)
JC loopTest

MOV.B #0Bh, &UCB1TXBUF ; (Sample Rate = 1khz, Filter BW = 42Hz, Range = 500d/s)

BIS.B #UCTXSTP, &UCB1CTL1 ; (Stop Sequence)

stopAck1:
BIT.B #UCTXSTP, &UCB1CTL1 ; (Wait until Stop Condition is cleared)
JC stopAck1

I do the same for Registers:

14h : Write 0Fh - slave address of AUX_ACCEL
18h : Write 06h - Register address of ACCEL(XOUT_L)

And then do a Read Sequence to retreive data from the IMU-3000 registers 1Dh-28H. This is the read sequence:

BIS.B #UCTR,&UCB1CTL1 ; (Transmitter mode)
BIS.B #UCTXSTT,&UCB1CTL1 ; (Start Sequence)

MOV.B #1Dh, &UCB1TXBUF ; (GYRO_XOUT)

startAck5:
BIT.B #UCTXSTT, &UCB1CTL1
JC startAck5

BIC.B #UCTR,&UCB1CTL1 ; (Receiver mode)
BIS.B #UCTXSTT, &UCB1CTL1 ; (Start Sequence Again)

MOV.B #0D1h,&UCB1TXBUF

startAck6:
BIT.B #UCTXSTT, &UCB1CTL1
JC startAck6

buffer:
dec.b R11 ; (Decrement RX byte counter)
jz completed ; (Jump if all bytes were RX'd)

mov.b &UCB1RXBUF,0(RAM) ; (Get received byte and store it in RAM)
inc.w RAM

JMP buffer

completed:
mov.b &UCB1RXBUF,0(RAM) ; (Get final received byte)
bis.b #UCTXSTP,&UCB1CTL1 ; (Generate I2C stop condition)
bis.b #UCTXNACK,&UCB1CTL1 ; (Generate Not Acknowledge condition)

stopAck4:
BIT.B #UCTXSTP, &UCB1CTL1 ; (Wait until stop condition is cleared)
JC stopAck4

When I do this all i'm getting from the IMU-3000 are the same values over and over again. The values i'm getting are:

GYRO_X_HIGH+GYRO_X_LOW = FF71h
GYRO_Y_HIGH+GYRO_Y_LOW = 3468h
GYRO_Z_HIGH+GYRO_Z_LOW = D545h
ACCEL_X_HIGH+ACCEL_X_LOW = 051Dh
ACCEL_Y_HIGH+ACCEL_Y_LOW = 4C52h
ACCEL_Z_HIGH+ACCEL_Z_LOW = 4607h

Any help is appreciated. Thanks

phpbb Topic ID
13908