Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Netduino 2 and MinIMU-9 Accelerometer LSM303DLM


  • Please log in to reply
2 replies to this topic

#1 giusjuve

giusjuve

    New Member

  • Members
  • Pip
  • 1 posts

Posted 22 August 2013 - 08:37 AM

[color=rgb(40,40,40);font-family:helvetica, arial, sans-serif;]Hi,[/color]

 

I have a problem with my accelerometer LSM303DLM [color=rgb(40,40,40);font-family:helvetica, arial, sans-serif;]. It don't comunicate with my netduino 2 (firmware 4.2.2).[/color]

The line SDA, SCL are connected with [color=rgb(40,40,40);font-family:helvetica, arial, sans-serif;]pull-up resistors in the Pin 5V.[/color]

I used I2CBus.cs posted by phantomtypist here:  http://forums.netdui...rch=1#entry4156.

[color=rgb(40,40,40);font-family:helvetica, arial, sans-serif;]When I  try a read or write operation the answer is always 0 ( both the number of byte transferred and the byte written in the buffer ). [/color]

The code used for send data to the device is the following:

 I2CBus bus = I2CBus.GetInstance(); I2CDevice.Configuration accWrite = new I2CDevice.Configuration(0x30, FREQUENCY);  bus.WriteRegister(accWrite,0x20,0x27,TIMEOUT); I2CDevice.Configuration accRead = new I2CDevice.Configuration(0x31, FREQUENCY);  bus.ReadRegister(accRead, 0x0F, buffer, TIMEOUT);

[color=rgb(40,40,40);font-family:helvetica, arial, sans-serif;]Any idea on what is causing this?[/color]

 

 

 

Attached Files



#2 bionicco

bionicco

    New Member

  • Members
  • Pip
  • 1 posts

Posted 26 August 2013 - 04:20 PM

Hi Gius,

the problem is in the address!

You try tu use 30h and 31h, one for write and one for reading, maybe because in the reference sheet of the the device they are written as the address of the device. But you have to use only the first 7 bit of the address for pointing to the device and the last one will be added by the driver, 1 in case of write and 0 in case of read.

So when you create the configuration use 18h (30h shift 1 right) instead of 30h and it should work.



#3 jeffs47

jeffs47

    New Member

  • Members
  • Pip
  • 1 posts

Posted 14 September 2013 - 03:23 AM

I'm having the same issue, though I don't have any Pull-ups (schematics show they're already there). I keep trying to write to the device and I get 0.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.