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

I2C Help - Data not appearing in the output


  • Please log in to reply
6 replies to this topic

#1 Nevyn

Nevyn

    Advanced Member

  • Members
  • PipPipPip
  • 1072 posts
  • LocationNorth Yorkshire, UK

Posted 29 April 2011 - 07:54 PM

I'm just trying to get to grips with I2C and I've either got a problem with code or interpreting teh logic analyser output. My code looks like this:

device = new I2CDevice(new I2CDevice.Configuration(0x48, 400));
byte[] command = new byte[] { 1, 0 };
I2CDevice.I2CWriteTransaction[] transaction = new I2CDevice.I2CWriteTransaction[] { I2CDevice.CreateWriteTransaction(command) };
int result = device.Execute(transaction, 1000);

So on the LA I'm expecting to see
Start command
Device code with the lower bit set to 0 (for write) followed by ACK
Two bytes 1 and 0 (each followed by an ACK)
Stop command

What I'm actually seeing is
Start command
Device code and lower bit set correctly followed by NAK
Stop command

The LA is Saleae and I've set the system to process I2C data.

Have I missed something in the code as it appears that the 1 and the 0 bytes are not being output to the I2C device

Thanks in advance,
Mark

Edit: Aditional Information
The chip is a lone chip on the bus and has the specified pull-up resistors.
According to the spec the data transfers do not require repeated start bits.

Edited by Nevyn, 29 April 2011 - 09:03 PM.

To be or not to be = 0xFF

 

Blogging about Netduino, .NET, STM8S and STM32 and generally waffling on about life

Follow @nevynuk on Twitter


#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 30 April 2011 - 09:15 AM

Hi Nevyn, When you say that you're getting a NAK, is your device actively refusing the message? If there's no ACK from the device, then data won't be sent... What device are you trying to talk to? Does it have a datasheet? Chris

#3 Nevyn

Nevyn

    Advanced Member

  • Members
  • PipPipPip
  • 1072 posts
  • LocationNorth Yorkshire, UK

Posted 30 April 2011 - 10:03 AM

When you say that you're getting a NAK, is your device actively refusing the message?


That's the conclusion I'm coming to. I've modified the code and config back to the default address of 0x64 and I'm still getting the same results.

What device are you trying to talk to? Does it have a datasheet?


Device details can be found here. The Functional Description document talks about the I2C interface on pages 8 & 9. I'm wondering of the debug monitor (discussed on page 10) is on and so the chip is refusing a connection - however I've got the serial input pin held low so this should be disabled.

Thanks for any help,
Mark

To be or not to be = 0xFF

 

Blogging about Netduino, .NET, STM8S and STM32 and generally waffling on about life

Follow @nevynuk on Twitter


#4 Michel Trahan

Michel Trahan

    Advanced Member

  • Members
  • PipPipPip
  • 155 posts

Posted 30 April 2011 - 12:23 PM

Would that solve our Math library problem ? LOL
Started with C in 1985, moved to Vb3 ... to vb6 and stopped. Now started with .Net and learning C# and VB.net and wishing VB.net was on MF !

#5 Nevyn

Nevyn

    Advanced Member

  • Members
  • PipPipPip
  • 1072 posts
  • LocationNorth Yorkshire, UK

Posted 30 April 2011 - 04:02 PM

Would that solve our Math library problem ? LOL


Maybe if I could get the little begger to work :) - an old solution to an old problem. Off to get a serial cable and try and talk to the debug monitor as even SPI is playing up now (well more than it was a day or two ago). Public holidays here so it'll be Wednesday before I can get the parts - drat.

Regards,
Mark

To be or not to be = 0xFF

 

Blogging about Netduino, .NET, STM8S and STM32 and generally waffling on about life

Follow @nevynuk on Twitter


#6 Nevyn

Nevyn

    Advanced Member

  • Members
  • PipPipPip
  • 1072 posts
  • LocationNorth Yorkshire, UK

Posted 07 May 2011 - 06:13 PM

When you say that you're getting a NAK, is your device actively refusing the message?

If there's no ACK from the device, then data won't be sent...


Finally got the FTDI cable and have manged to talk to this little beastie. I have also found a horrible little comment on the chip and it relates to the 3.3V power supply. Apparently, the chip should be clocked at 15MHz if using 3.3V power and not the full 30MHz (the default). Using the debug mode I reconfigured it and I managed to get the thing synchronising with the N+.

Next step, add 1 to 1 and hopefully get the right answer.

Thanks,
Mark

To be or not to be = 0xFF

 

Blogging about Netduino, .NET, STM8S and STM32 and generally waffling on about life

Follow @nevynuk on Twitter


#7 Nevyn

Nevyn

    Advanced Member

  • Members
  • PipPipPip
  • 1072 posts
  • LocationNorth Yorkshire, UK

Posted 08 May 2011 - 06:29 PM

Next step, add 1 to 1 and hopefully get the right answer.


YES: 1 + 1 = 2 and even better, 1 + 1 + 1 = 3 !

Now on to hard sums :)

Mark

To be or not to be = 0xFF

 

Blogging about Netduino, .NET, STM8S and STM32 and generally waffling on about life

Follow @nevynuk on Twitter





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.