> Hi everyone, I should transmit and receive data from
master(MSP430f5338)
> to slave sensor(LSM303DLM) by I2C communication.
> I want to read data of x, y and z, so I can't receive multiple bytes
> because I have to change register continuously.
The 303DLM's accelerometer is intended to be read as a burst-mode
transaction with a repeated start, i.e. START+WRITE START+READ
NAK. The LSM303DLH device is the combination of a LIS331DL
and a Honeywell HMC5883L in a single integrated circuit and supports address
auto-increment through the accelerometer output registers. Read the
datasheet!
Hi everyone, I should transmit and receive data from master(MSP430f5338) to
slave sensor(LSM303DLM) by I2C communication.
I want to read data of x, y and z, so I can't receive multiple bytes
because I have to change register continuously.
I made some codes using example codes from this group and TI example code. But
there are two problems in my code.
First, the slave address register UCB0I2CSA is never changed from 0x48.
I assign the slave address 0x30 or the other hex numbers, but it was never
changed from 0x48.
Second, in datasheet of this sensor, to write data, operation protocol is like
below.
Master....Start.....SAD+W.....SUB.....DATA.....Stop
Slave.....................SAK.....SAK......SAK
And to read data, operation protocol is below.
Master....Start.....SAD+W.....SUB.....SR.....SAD+R...........Stop
Slave.....................SAK.....SAK..............SAK..DATA
So I programmed interrupt service routine like below, but RX interrupt service
routine is never called.
Case 10: RXIFG routine in
#pragma vector = USCI_B0_VECTOR
__interrupt void USCI_B0_ISR (void)
is totally ignored and passed. I don't know why these problem is
occured...
Here is my code. please help my problem.. I think the main problem part is
function [DataRead] and interrupt service routine.
Thank you.