[ulist]I spend hours on debugging and code analysis.
I spend 80 EUR on a logic analyser (http://www.ikalogic.com/scanalogic2/)
Used different power supplies
Used differnt modules
Used latest sourcecode for gadgeteer and modules[/ulist]
And my only result is that there is no data transfered over my I2C bus.
I wrote a very simple test application connected the logic analyser and no trigger fire.
Now I have no idea what else can I try.
Testapplication
using Gadgeteer.Modules.GHIElectronics;
using Gadgeteer.Modules.Seeed;
using Microsoft.SPOT;
namespace I2CLC
{
public partial class Program
{
void ProgramStarted()
{
Debug.Print("Program Started");
button.ButtonPressed += new Button.ButtonEventHandler(button_ButtonPressed);
}
void button_ButtonPressed(Button sender, Button.ButtonState state)
{
//Start Logic analyser here
gyro.Calibrate();
gyro.MeasurementComplete += new Gyro.MeasurementCompleteEventHandler(gyro_MeasurementComplete);
gyro.StartContinuousMeasurements();
}
void gyro_MeasurementComplete(Gyro sender, Gyro.SensorData sensorData)
{
Debug.Print(sensorData.ToString());
}
}
}
Output:
attached picture shows connected modules and analyser Settings.
I don’t have a Gadgeteer board so can’t really help there; but have you tried to program this like a standard EMX application?
I’d also suggest trying out the I2C scanner that Wim has on the code repository, [url]http://code.tinyclr.com/project/356/i2c-scanner/[/url] that might give you confirmation that the I2C device is connected and functioning correctly.
And I hope you also realise that the drivers for the Seeed modules are still stamped “beta”? You may be (un)lucky in that nobody else has tested the Gyro.
I know this wiki paged tried this before now with logic analyser:
public static void Main()
{
I2CDevice.Configuration con =
new I2CDevice.Configuration(0x68, 50);
I2CDevice MyI2C = new I2CDevice(con);
I2CDevice.I2CTransaction[] xActions =
new I2CDevice.I2CTransaction[2];
// create write buffer (we need one byte)
byte[] writeBuffer8 = new byte[1];
writeBuffer8[0] = (byte)0x1B;
xActions[0] = I2CDevice.CreateWriteTransaction(writeBuffer8);
// create read buffer to read the register
byte[] readBuffer64 = new byte[8];
xActions[1] = I2CDevice.CreateReadTransaction(readBuffer64);
if (MyI2C.Execute(xActions, 1000) == 0) // at this point SDA and SCL went from high to low thats all
{
Debug.Print("Failed to perform I2C transaction"); // Result is always 0
}
else
{
Debug.Print("Register value: " + readBuffer64[0].ToString());
}
}
is 0x68 the address? Since I saw the scanner pointed out a few days ago I would always suggest using that - in that way you get to know the real address (assuming everything works).
Have you had success with other modules on your gedgeteer board? Can you do the normal things, make LED blink etc?
I’ll have two more stabs in the dark here. First, can you check firmware and SDK versioning match? I know the gadgeteer stuff hsan’t been around long and therefore less likely to be an issue, but I really like to confirm this all is aligned. Second, can you check the gadgeteer socket you’re connecting to is right (again, I’d try to use something simple like LED blinkies to verify that we think the pins in question should work). Logic Analyser on them too just to verify.
I tested again only extender module and power connected.
Same result
Attached you find the Output from the logic analyser
Test application:
public static void Main()
{
I2CDevice.Configuration con =
new I2CDevice.Configuration(0x68, 100);
I2CDevice MyI2C = new I2CDevice(con);
I2CDevice.I2CTransaction[] xActions =
new I2CDevice.I2CTransaction[2];
// create write buffer (we need one byte)
byte[] writeBuffer8 = new byte[1];
writeBuffer8[0] = (byte)0x1B;
xActions[0] = I2CDevice.CreateWriteTransaction(writeBuffer8);
// create read buffer to read the register
byte[] readBuffer64 = new byte[8];
xActions[1] = I2CDevice.CreateReadTransaction(readBuffer64);
if (MyI2C.Execute(xActions, 1000) == 0) // at this point SDA and SCL went from high to low thats all
{
Debug.Print("Failed to perform I2C transaction"); // Result is always 0
}
else
{
Debug.Print("Register value: " + readBuffer64[0].ToString());
}
}
[ulist]
Latest firmeware.
No gadgeteer stuff.
Tried all “I” sockets
tried different I2C clock rates
[/ulist]
OK, so go back and try toggling the pins yourself. As Gus says, that combination of bits does not seem a sensible thing that an I2C protocol would try to drive.
Maybe I’m just too stupid for that. It was a nice experiment but is currently just too frustrating I will change back to normal computer. They’re easier to handle
seriously, let us know what help you want, and we can try to figure this out and do the things we need to do (give you code snippets etc) so we can figure out what is going on - its very strange !
I work with computers and electronics for several years. The word “impossible” does not exist
But Gus has looked exactly right, it is impossible it should at least see something and it looks like the only logical answer would be something is broken. And that’s also almost impossible since everything else seems to work
By impossible, I mean I am not finding a logical explanation for it. It happened so there is a reason but I am just not understanding it. We will know once we try it tomorrow.