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.

Rik P.'s Content

There have been 9 items by Rik P. (Search limited from 25-April 23)


By content type

See this member's

Sort by                Order  

#56075 Upgrading from N+1 to N+2

Posted by Rik P. on 14 February 2014 - 03:14 PM in Netduino Plus 2 (and Netduino Plus 1)

Hi Chris,

 

I had actually swapped the pins and moved the pull ups, however previously on N+1 I used pull ups to 5V.

 

To get this working on N+2, I had to change from 5V pull ups to 3V3, though maybe this is to do with my resistor values - which I've kept the same, at 12KOhm.

 

Would you recommend different resistors?

 

Thanks,

Richard.




#55989 Upgrading from N+1 to N+2

Posted by Rik P. on 10 February 2014 - 08:10 AM in Netduino Plus 2 (and Netduino Plus 1)

Hi Chris,

 

Thanks for your reply. Just to confirm, I have the data lines the correct way around, but you have asked about "moving the pull up resistors as well", but I can't find any docs that state where/why they need to move? Can you be more specific?

 

Also, I've actually got a very small test project to repro this based on a SparkFun I2C sensor board...

 

Thanks,

Rik.




#55928 Upgrading from N+1 to N+2

Posted by Rik P. on 08 February 2014 - 11:56 AM in Netduino Plus 2 (and Netduino Plus 1)

Just to add as well, I don't have access to any advanced diagnostic equipment to be able to check the state of the I2C lines. I have already moved to the SD/SC pins on N+2, vs. A4/A5 on N+1.



#55927 Upgrading from N+1 to N+2

Posted by Rik P. on 08 February 2014 - 11:23 AM in Netduino Plus 2 (and Netduino Plus 1)

Hello all

 

Having spent a few hours reading through the forums this morning, I can see that I don't appear to be the only one who has issues trying to upgrade from N+1 to N+2. My project also uses I2C, which seems to be causing some people issues, too.

 

For me, simply swapping from the N+1 board to the N+2, targeting MF SDK 4.2 caused I2C to quit working.

 

Can someone please clarify what version of the N+2 firmware correctly supports I2C, and what references they have in their solution? I've read a few conflicting posts and now my brain (and my project) are just fried. All I want my shiny new N+2 board to do is ... work :)

 

Thanks,

Rik.




#55406 More I2C Questions

Posted by Rik P. on 15 January 2014 - 09:30 PM in General Discussion

Hey,

 

Firstly thanks to everyone who keeps offering up support as I learn. Much appreciated!

 

I'm embarking on a relatively ambitious (for me!) project, that involves reading data from an array of I2C sensor devices. I think I'm finally getting my head around I2C and was recently using the AbstractI2CDevice.cs class I'd seen posted on these forums, but ran into a few problems with some sensors.

 

I decided to switch from this, to the MultiI2C class in the NETMF Toolbox.

 

But there are still some things that don't quite make sense to me, that I'm hoping you folks can clarify.

 

Let me pick a concrete example:

 

One of the sensors I'm using is an ITG3200 Gyro. It returns data on the I2C bus, and there's already a driver class built using AbstractI2CDevice. For example, using that class, you call the ReadShort method, pass in the registers you want, and you get the data:

public double readX()        {            int data = ReadShort((byte)Register.GYRO_XOUT_H, (byte)Register.GYRO_XOUT_L);            return (((double)(data)) / scaleFactor) - xOffset;        }

That's great. But, in the MultiI2C world, there is no method that appears to accept an array for the registers one wants to read from, that returns a single int as the result. There

's only Write, or WriteRead, the former accepting a byte array for the registers (presumably) to return values from. But I can't see, in this method, where the values are output to. Likewise, in WriteRead, one specifies an array of bytes to read from, and an array of bytes to read to - so I can see there how the values come out, but then can't quite make sense of how you join the array of bytes coming back out into a single int :)

 

Here's what I mean:

 _device.WriteRead(new [] { (ushort)Register.GYRO_XOUT_H, (ushort)Register.GYRO_XOUT_L }, data);

What I need to do, according to the AbstractI2CDevice implementation, is calculate the value of the 'X axis' by dividing the returned data by the scaleFactor variable and then subtracting xOffset from the total:

return (((double)(data)) / scaleFactor) - xOffset;

In ths example though, data isn't a single int - it is a byte[] (or ushort[]) array, so clearly isn't convertible to a double.

 

Clearly there's a concept here I'm not understanding, but it seems most of the material I've been able to Bing/Google is aimed at folks who kinda already have a very good understanding of I2C and just want to figure out how to work with that in the .NET MF world. Whereas, the world of bits and bytes are relatively new to me :)

 

Of course, if I really understood what was happening under the hood I'd probably be able to write my own drivers for most of these sensors (and would happily offer them up to the community when I'm done).

 

Any help you could offer would be much appreciated.

 

Thanks,

 

rik




#55159 Support understanding I2C comms

Posted by Rik P. on 03 January 2014 - 03:20 PM in Netduino Plus 2 (and Netduino Plus 1)

Hi Rik, With NETMF, you'll want to dispose of one I2CDevice object before creating another: each I2CDevice class reserves the I2C bus. Chris

 

Thanks, Chris. 

 

Rik




#55098 Support understanding I2C comms

Posted by Rik P. on 01 January 2014 - 10:21 AM in Netduino Plus 2 (and Netduino Plus 1)

Hi Stanislav,

 

Thank you for your reply, this has helped a lot.

 

I do have one follow-up query, if you don't mind. I can read from any one device at a time using the code I've written, however I cannot initialise two devices on the I2C bus, and then read from them both in sequence. When I attempt to do this, I receive an InvalidOperationException. My guess is this has to do with timing.

 

Any ideas?

 

Thanks




#55043 Support understanding I2C comms

Posted by Rik P. on 31 December 2013 - 03:48 PM in Netduino Plus 2 (and Netduino Plus 1)

Hello all

 

I've been lucky enough to get hold of a Sparkfun 9DOF sensor stick (https://www.sparkfun.../products/10736), which uses I2C for communication. Whilst I've spent a lot of time reading up on I2C (as this is not something I have any experience with), and I'm fairly confident now with the programming model, I'm not really sure how to get started reading the sensor values from the device via I2C.

 

The sensor board has three onboard sensors, one of which is an ADXL345.According to the manual, this is addressed on 0x53. 

 

Am I write in assuming I need to instantiate a new I2CDevice.Configuration object as follows?

var config = new I2CDevice.Configuration(0x53,400);

If that's correct, this allows me to target that device on the bus (I think). What I now need to do is 'poll' the bus on a periodic basis to retrieve the current sensor values. And this is the part I am struggling with...

 

The manual says the register for "X Axis Data 0" is at 0x32, and "X Axis Data 1" is at 0x33. I figured I need to create a Read transaction, but the APIs don't seem to have any parameters which target the registers I want to read from?

var rxBuffer = new byte[4];var readTransaction = new I2CDevice.I2CTransaction[]{   I2CDevice.CreateReadTransaction(rxBuffer)};adxlDevice.Execute(readTransaction, 1000);

With this in mind, I'm not entirely sure what I'm supposed to do in order to obtain values from the registers. My guess, is that I'm going about this completely the wrong way and would really appreciate a steer. 

 

Any help?

 

Many thanks.

 

 




#52760 News about Visual Studio 2012 .NETMF Support ?

Posted by Rik P. on 15 September 2013 - 12:38 PM in Visual Studio

Hi Victor, Confirmed. .NET MF 4.3 will be the first version of the NETMF SDK to support VS2012. We are anticipating an alpha/beta release of NETMF 4.3 by next month. Chris

 

Hi Chris

 

What's the latest in regards to Netduino development using Professional/Ultimate versions of Visual Studio 2012 (or even 2013) at this time? I can see a lot of forum chatter relating to it being released 'imminently', back in 2012.

 

Thanks,

Richard.





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.