HMC5883L interfacing via I2C

Status
Not open for further replies.

bouvett2

Newbie level 5
Joined
May 9, 2012
Messages
8
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,355
Hi Guys,

I have been trying to interface with a HMC5883L magnetometer by ST lately. I had already available I2C functions which are proven to work for the MSP430 microcontroller I am using.

Whilst reading the datasheet for the HMC5883L sensor, I noticed that during a read instruction, after sending the I2C receiver address, the master has to send the number of bytes to be written (Pg. 18).

Now this was different from the I2C slaves I used to work with ( Send write instruction, pointing to which address you want to read; send read instruction and start reading register after the other until stop command is sent by master).

I decided to give it a go anyway, and it worked.. It worked reliably for many iterations. Suddenly it stopped... I don't know whether it is because of this problem I described though.

Attached, is a screen shot of my logic analyser showing the communication time line. Maybe it can be interpreted by anybody who has worked with this sensor before...

Thanks for your time.

Good day
 

Basically, the datasheet says, to transmit the number of bytes to be written, after the master sends a read command... is this possible? does it make sense?
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…