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 Plus 2 - I2C not working


  • Please log in to reply
38 replies to this topic

#1 egeorgiou

egeorgiou

    Member

  • Members
  • PipPip
  • 28 posts
  • LocationLondon - United Kingdom

Posted 15 November 2012 - 10:08 PM

I just got my NP2! :) thanks for making such an awesome update!

I'm not able to get the I2C to work with my ADXL345 connected to the new SC/SD connectors?

I'm running the following code:
Byte[] _data = new byte[1] { 0 };

I2CDevice adxl345 = new I2CDevice(new I2CDevice.Configuration(0x53, 400));
I2CDevice.I2CWriteTransaction write = I2CDevice.CreateWriteTransaction(new Byte[] { 0x00 });
I2CDevice.I2CReadTransaction read = I2CDevice.CreateReadTransaction(_data);
I2CDevice.I2CTransaction[] actions = new I2CDevice.I2CTransaction[] { write, read };
adxl345.Execute(actions, 1000);
Debug.Print(_data[0].ToString());

I'm running the same code on my NP1 connecting to A4/A5 pins and the device is working but not on the NP2.

HELP PLEASE!

#2 supra

supra

    Advanced Member

  • Members
  • PipPipPip
  • 210 posts
  • LocationOntario, Canada

Posted 16 November 2012 - 01:47 PM

I just got my NP2! :) thanks for making such an awesome update!

I'm not able to get the I2C to work with my ADXL345 connected to the new SC/SD connectors?

I'm running the following code:

Byte[] _data = new byte[1] { 0 };

I2CDevice adxl345 = new I2CDevice(new I2CDevice.Configuration(0x53, 400));
I2CDevice.I2CWriteTransaction write = I2CDevice.CreateWriteTransaction(new Byte[] { 0x00 });
I2CDevice.I2CReadTransaction read = I2CDevice.CreateReadTransaction(_data);
I2CDevice.I2CTransaction[] actions = new I2CDevice.I2CTransaction[] { write, read };
adxl345.Execute(actions, 1000);
Debug.Print(_data[0].ToString());

I'm running the same code on my NP1 connecting to A4/A5 pins and the device is working but not on the NP2.

HELP PLEASE!


tutorial

Mylink

#3 egeorgiou

egeorgiou

    Member

  • Members
  • PipPip
  • 28 posts
  • LocationLondon - United Kingdom

Posted 16 November 2012 - 02:17 PM

tutorial

Mylink


Hi supra,

thanks for the link to loveelectronics tutorial. I have used used this tutorial before the library they have put together is excellent and I also highly recommended it.

The issue isn't with how to write the code for the i2c device but that the device is not working with NP2! for that matter I can't get any device to communicate via I2C with my new NP2!

have you implemented an I2C devices with the new NP2?

#4 supra

supra

    Advanced Member

  • Members
  • PipPipPip
  • 210 posts
  • LocationOntario, Canada

Posted 16 November 2012 - 02:52 PM

Hi supra,

thanks for the link to loveelectronics tutorial. I have used used this tutorial before the library they have put together is excellent and I also highly recommended it.

The issue isn't with how to write the code for the i2c device but that the device is not working with NP2! for that matter I can't get any device to communicate via I2C with my new NP2!

have you implemented an I2C devices with the new NP2?



I'm using NGo. But i will get one by xmas
Mlink

#5 JerseyTechGuy

JerseyTechGuy

    Advanced Member

  • Members
  • PipPipPip
  • 870 posts

Posted 16 November 2012 - 02:52 PM

I can't be of any help yet, but I'll have my ND+2s on Saturday. I plan to work on upgrades this coming week to Pandora's Box. I have four I2C devices connected currently. I'll be working to get my ADXL345, RTC, BMP085 and LCD Backpack working with I2C.

#6 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 16 November 2012 - 06:16 PM

Hi egeorgiou,

I just got my NP2! :) thanks for making such an awesome update!

B)

I'm not able to get the I2C to work with my ADXL345 connected to the new SC/SD connectors?

So sorry about that. There appears to be a bug in the I2C core which is affecting some users. We have a repro and ordered in test hardware; we should have a bug fix for this in the 4.2.1.1 update next weekend.

Chris

#7 egeorgiou

egeorgiou

    Member

  • Members
  • PipPip
  • 28 posts
  • LocationLondon - United Kingdom

Posted 23 November 2012 - 07:37 PM

Hi egeorgiou,


B)


So sorry about that. There appears to be a bug in the I2C core which is affecting some users. We have a repro and ordered in test hardware; we should have a bug fix for this in the 4.2.1.1 update next weekend.

Chris


Any news on when to expect the fix for the i2c issue?

#8 HAMZA

HAMZA

    Member

  • Members
  • PipPip
  • 12 posts

Posted 26 November 2012 - 04:25 PM

Hi i have netduino plus that i updated last week with the new firmware 4.2 because the I2C don't work in firmware 4.1, and i tried again but nothing the same error again happen. i use this code that i found here http://www.tinyclr.c...m/topic?id=9074 using System; using System.Net; using System.Net.Sockets; using System.Threading; using Microsoft.SPOT; using Microsoft.SPOT.Hardware; using SecretLabs.NETMF.Hardware; using SecretLabs.NETMF.Hardware.NetduinoPlus; namespace i2C { public class Program { static OutputPort led = new OutputPort(Pins.ONBOARD_LED, false); public static void Main() { // write your code here i2c(); while (true) { led.Write(true); Thread.Sleep(10); led.Write(false); Thread.Sleep(1500); } //Thread.Sleep(Timeout.Infinite); } static void i2c() { // i2c configuration(address of my eeprom , clock speed) I2CDevice myi2c = new I2CDevice(new I2CDevice.Configuration(0xA2, 400)); // to store the received value from eeprom byte[] readBuffer = new byte[1]; byte[] address = new byte[] { 1 }; // Reading data stored in the selected address register I2CDevice.I2CTransaction[] xActions = new I2CDevice.I2CTransaction[1]; xActions[0] = I2CDevice.CreateWriteTransaction(address); myi2c.Execute(xActions, 1000); xActions[0] = I2CDevice.CreateReadTransaction(readBuffer); myi2c.Execute(xActions, 1000); // print the received data Debug.Print("address:" + address[0].ToString() + "data:" + readBuffer[0].ToString()); // go to the next address address[0]++; led.Write(true); Thread.Sleep(1000); led.Write(false); } } } there are any solution of my problem ?

#9 JerseyTechGuy

JerseyTechGuy

    Advanced Member

  • Members
  • PipPipPip
  • 870 posts

Posted 26 November 2012 - 07:06 PM

Is your board a Plus 2? You wrote Netduino Plus.

#10 HAMZA

HAMZA

    Member

  • Members
  • PipPip
  • 12 posts

Posted 27 November 2012 - 04:20 PM

Hi Dave VanderWekke

Is your board a Plus 2? You wrote Netduino Plus.


i have Netduino Plus (not Netduino Plus 2)

#11 JerseyTechGuy

JerseyTechGuy

    Advanced Member

  • Members
  • PipPipPip
  • 870 posts

Posted 27 November 2012 - 05:04 PM

Hi Dave VanderWekke



i have Netduino Plus (not Netduino Plus 2)


Just checking since you posted in the wrong thread. This is about Netduino Plus 2 problems with the I2C as these are specific to the Netduino Plus 2. You should create a new thread with your question.

#12 HAMZA

HAMZA

    Member

  • Members
  • PipPip
  • 12 posts

Posted 27 November 2012 - 05:19 PM

Just checking since you posted in the wrong thread. This is about Netduino Plus 2 problems with the I2C as these are specific to the Netduino Plus 2. You should create a new thread with your question.



ok & thanks (^_^)

#13 egeorgiou

egeorgiou

    Member

  • Members
  • PipPip
  • 28 posts
  • LocationLondon - United Kingdom

Posted 29 November 2012 - 03:21 PM

any update on the fix for the i2c issue?

#14 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 30 November 2012 - 08:56 AM

Hi egorgiou,

any update on the fix for the i2c issue?

Here you go:
http://forums.netdui...-v421-update-1/

Please let us know how this works for you.

Chris

#15 egeorgiou

egeorgiou

    Member

  • Members
  • PipPip
  • 28 posts
  • LocationLondon - United Kingdom

Posted 30 November 2012 - 08:44 PM

Hi egorgiou,

Here you go:
http://forums.netdui...-v421-update-1/

Please let us know how this works for you.

Chris


Hi Chris,

Thank you for your hard work to get the update released.

I'm very sad to report the update has not resolved my issues and the N+2 is not able to communicate with my I2C devices.

#16 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 30 November 2012 - 08:54 PM

Hi egeorgiou,

I'm very sad to report the update has not resolved my issues and the N+2 is not able to communicate with my I2C devices.

What pins are you using for your I2C devices? The SDA/SCL pins or the A4/A5 pins?

The new Arduino R3 shield format has moved the I2C pins to SDA/SCL. We are working on a software I2C feature which will enable A4/A5 to be used for I2C as well, providing the best of both worlds.

If you are using A4/A5 for your I2C pins, there are two even faster ways to get this to work for you:
  • Connect jumper wires between the A4/A5 and SDA/SCL headers on your Netduino Plus. This will mirror the pins for you.
  • Check out Dave's Software I2C
If you're using the SDA/SCL pins...what value of pull-ups do you have? What is the part you're using?

Chris

#17 egeorgiou

egeorgiou

    Member

  • Members
  • PipPip
  • 28 posts
  • LocationLondon - United Kingdom

Posted 30 November 2012 - 09:09 PM

Hi egeorgiou,


What pins are you using for your I2C devices? The SDA/SCL pins or the A4/A5 pins?

The new Arduino R3 shield format has moved the I2C pins to SDA/SCL. We are working on a software I2C feature which will enable A4/A5 to be used for I2C as well, providing the best of both worlds.

If you are using A4/A5 for your I2C pins, there are two even faster ways to get this to work for you:

  • Connect jumper wires between the A4/A5 and SDA/SCL headers on your Netduino Plus. This will mirror the pins for you.
  • Check out Dave's Software I2C
If you're using the SDA/SCL pins...what value of pull-ups do you have? What is the part you're using?

Chris


Thanks for the quick reply.

I'm using the SD/SC pins, I have also tried A4/5 with no success.

Attached is an image of my setup.
Attached File  setup_example.jpg   309.61KB   98 downloads

The device has pull-ups built in with 4.7k resistors. I'm using the Sparkfun SEN-10724 (https://www.sparkfun.../products/10724) The sensor works with my N+1 and Nmini (with the above mentioned code).

I will look at dave's code and see if that helps.

#18 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 30 November 2012 - 09:19 PM

Hi egeorgiou,

I'm using the SD/SC pins, I have also tried A4/5 with no success.

The device has pull-ups built in with 4.7k resistors. I'm using the Sparkfun SEN-10724 (https://www.sparkfun.../products/10724) The sensor works with my N+1 and Nmini (with the above mentioned code).

I will look at dave's code and see if that helps.

Hmm, very interesting. A few things:

1. Do you have a logic analyzer by any chance? If you do, it would be _really_ helpful to see what data is on the line and what might be missing. And also measure the pulse width...in case there's a clock mismatch somehow.

2. If you lower the clock speed, does it work?

3. Please let me know if Dave's code works for you.

4. If the above fails, I can order one of these and have it here next week. Then we can run your code on both Netduino and Netduino Plus 2 and figure out what's different. We definitely want to enable existing code to be re-used on the new boards.

Thank you for all your help getting to the bottom of this case,

Chris

#19 carb

carb

    Advanced Member

  • Members
  • PipPipPip
  • 352 posts
  • LocationCrystal River, Florida

Posted 30 November 2012 - 09:26 PM

Thanks for the quick reply.

I'm using the SD/SC pins, I have also tried A4/5 with no success.

Attached is an image of my setup.
Attached File  setup_example.jpg   309.61KB   98 downloads

The device has pull-ups built in with 4.7k resistors. I'm using the Sparkfun SEN-10724 (https://www.sparkfun.../products/10724) The sensor works with my N+1 and Nmini (with the above mentioned code).

I will look at dave's code and see if that helps.

egeorgiou,

From the picture it looks like you have both the power and the ground plugged into the same row of the bread board, this will short out the power supply, please check your wiring?

Chuck

#20 JerseyTechGuy

JerseyTechGuy

    Advanced Member

  • Members
  • PipPipPip
  • 870 posts

Posted 30 November 2012 - 09:37 PM

Hi Chris,

Thank you for your hard work to get the update released.

I'm very sad to report the update has not resolved my issues and the N+2 is not able to communicate with my I2C devices.


egeorgiou, your wiring looks fine. While I don't have that specific sensor, I have two of the individual sensors on that board, the Magnetometer and the Accelerometer. I will try to wire them up and see if I can get them working on my ND+2. Meanwhile can you share the code you are using? Perhaps it's a code issue. Today I tried the update with the DS1307 real time clock and that worked fine, but was not working fine with 4.2.1.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.