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.

TheIceManProgrammeth's Content

There have been 7 items by TheIceManProgrammeth (Search limited from 28-September 21)


By content type

See this member's

Sort by                Order  

#61694 Pull Up, Pull Down, Pulling my hair out!

Posted by TheIceManProgrammeth on 22 February 2015 - 10:45 PM in Netduino 2 (and Netduino 1)

Thanks Paul. Got readings from both the magnet and accelerometer now but I'm intrigued as to why the standard I2C stuff didn't work. Think one of the other posters mentioned repeated-start condition so going to experiment with that to see if I can see what is wrong with the standard transaction based stuff.

 

Will post all results to the wiki once I've finished.

 

Seems so easy now it's working properly!




#61687 I2C on original netduino not reading multiple bytes

Posted by TheIceManProgrammeth on 21 February 2015 - 11:02 PM in Netduino 2 (and Netduino 1)

I had the same issue. Try amending:

 

byte write = { AddressOfFirstRegisterIneed };

 

to

 

byte write = { AddressOfFirstRegisterIneed | (1 << 7) };




#61686 Pull Up, Pull Down, Pulling my hair out!

Posted by TheIceManProgrammeth on 21 February 2015 - 10:45 PM in Netduino 2 (and Netduino 1)

Ok update on this one. I eventually started to get some readings when I switched the I2C sensor code to the toolbox MultiI2c but only for the magnet not the accelerometer. No resistors needed and worked using the sensor shield I bought so haven't wasted money after all.

 

Will post the code when I get the accelerometer working!

 

Thanks to Paul for his suggestions and I've certainly learnt a lot more about how I2C works!




#61674 Pull Up, Pull Down, Pulling my hair out!

Posted by TheIceManProgrammeth on 20 February 2015 - 10:44 AM in Netduino 2 (and Netduino 1)

Haha thanks Paul well this is the sensor for the heading so it could end up anywhere in Berkshire if it doesn't work! ;-)
 
So the code sends 8bytes to be populated by the sensor and then checks if the number of bytes coming back is equal to the buffer.

            lock (_slaveDevice)

            {

                // the i2c data is received here from the device.

                int transferred = _slaveDevice.Execute(readXAction, transactionTimeout);

 

                // make sure the data was received.

                if (transferred != readBuffer.Length)

                   throw new Exception("Could not read from device.");

            }

When I use the code above transferred is always 0. When I use the same _slaveDevice.Execute method for the write it returns 2 for the init and 1 for the pre-read send. Adding the resistors has no impact (I've placed one between the power and the SDA and one one betwen the SCL and power). Even without anything connected to the netduino the write returns 2 and 1 from the method and the read still returns 0.

 

So what I can't get my head round is why is the netduino saying the write worked when clearly there was nothing attached to it? Your earlier post suggested the ACK was being wrongly interpreted but since there is nothing connected to the pin where did the ACK come from?

 

Thanks for any suggestions you can give me.




#61666 Pull Up, Pull Down, Pulling my hair out!

Posted by TheIceManProgrammeth on 19 February 2015 - 11:03 PM in Netduino 2 (and Netduino 1)

Cool hopefully you will see one of my netduino projects flying around the Reading area soon!

 

So I tried the i2C again and still nothing.

 

With absolutely nothing attached to the netduino the write seems to work sending 2 bytes for the init and 1 for the pre-read. The read returns 0. This is exactly the same result when I plug in the sensor with or without resistors between them and the board.

 

I did notice the arduino library code for the sensor was slightly different to the Netduino conversion but even changing those had no effect and would explain why the sensor seems to have no impact on the results whatsoever.

 

Pretty frustrating. Is there any way to test the i2c using something simpler?

 

Thanks again in advance for any help. I'm sure it's probably something silly.




#61657 Pull Up, Pull Down, Pulling my hair out!

Posted by TheIceManProgrammeth on 19 February 2015 - 12:41 PM in Netduino 2 (and Netduino 1)

Thanks Paul! Will give it a go tonight when I get home!

 

Nice to know there is another Netduiner in the area (I'm in Berkshire too!)




#61653 Pull Up, Pull Down, Pulling my hair out!

Posted by TheIceManProgrammeth on 18 February 2015 - 11:34 PM in Netduino 2 (and Netduino 1)

Hi really love the netduino but I'm definitely more of a programmer than an electronics guy so am probably doing something silly but I can't work out what.

 

I'm trying to use  LSM303DLH compass and accelerator module on a Netduino 1 firmware 4.2 using the excellent code provided in the netduino forums "Sensor Library" by sfugrino on 14th March 2014.

 

Unfortunately I didn't do my research enough and bought an arduino sensor shield thinking I could just plug the i2c cable in there. The sensor didn't return any readings.

 

On reading a few other posts I realised my mistake that the ND doesn't have pulldown or pullup resistors so I abandoned the sensor shield and tried to connect the sensor to the ND via a breadboard instead.

 

The sensor is on (the red LED is on) but I just can't get any readings from it.  I'm not entirely sure where to place the resistors but I've placed them seemingly in every combination I could think of but the reading is always 0 bytes transferred.

 

I've also noticed that even if I don't plug in anything to A4 or A5 that the code still registers that the write succeeded which can't be right can it?

 

Any help would be greatly received.

 

 

 

 





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.