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

Unplugged I2C bus stops Netduino


  • Please log in to reply
2 replies to this topic

#1 gbreder

gbreder

    Advanced Member

  • Members
  • PipPipPip
  • 53 posts
  • LocationGermany

Posted 05 March 2011 - 05:26 PM

Hi,
congratulation to the creation of the wonderful Netduino board. After the announcement of the first processor which had enough memory to host the .NET Micro Framework I was eager to get the first board.

But yesterday I encountered an issue with I2C bus on my Netduino and Netduino Plus after I upgraded to firmware 4.1.1.0 Alpha7. If I have started my application with disconnected I2C bus the Netduino was unresponsive after the I2C read command and could only brougth back to life by pressing the reset button. Even Visual Studio of MFDeploy couldn't connect to the device without reseting it first.
To cut a long story short: If the I2C bus has no external pullups neither an exceptions will be thrown nor data (like an empty byte array) will be received. The board waits to get an high level on SCL and without pull-ups it waits forever. The timeout value of the ReadTransaction will be completly ignored.
I'm not sure if the behaviour was diffrent in the release firmware of Netduino but i would appreciate some error handling like exceptions or empty results.

public class Program
{
	private static I2CDevice _I2CDevice;
	private static Timer _Timer;
	private static OutputPort _OnboardLed;

	public static void Main()
	{
		_Timer = new Timer(TimerElapsed, null, new TimeSpan(0, 0, 8), new TimeSpan(0, 0, 1));

		//Initialize the I2CDevice with a dummy configuration
		_I2CDevice = new I2CDevice(new I2CDevice.Configuration(20, 100));
		_OnboardLed = new OutputPort(Pins.ONBOARD_LED, false);

		Thread.Sleep(Timeout.Infinite);
			
	}

	private static void TimerElapsed(object state)
	{
		var bytesToRead = new byte[2];

		var configuration = new I2CDevice.Configuration(0x48, 100);
		_I2CDevice.Config = configuration;

		var transactions = new[] { I2CDevice.CreateReadTransaction(bytesToRead) };

		_OnboardLed.Write(true);
		Thread.Sleep(50);
		_OnboardLed.Write(false);

		// Execute the read or write transaction, check if byte was successfully transfered
		int bytesTransfered = _I2CDevice.Execute(transactions, 200);

		Debug.Print("Bytes transferred '" + bytesTransfered + "' at " + DateTime.Now);
	}
}

Are there any workarounds for this issue? Are there any issues in my (example) code? Any help would be appreciated...

#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 07 March 2011 - 11:20 AM

Hi gbreder, We'll dig into this for the v4.1.1 beta. Thanks for bringing this to our attention. Chris

#3 gbreder

gbreder

    Advanced Member

  • Members
  • PipPipPip
  • 53 posts
  • LocationGermany

Posted 08 March 2011 - 09:12 PM

Thanks Chris, I look forward to the Beta firmware. Guido




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.