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 to PowerOne power Supply?


  • Please log in to reply
3 replies to this topic

#1 freds

freds

    Advanced Member

  • Members
  • PipPipPip
  • 61 posts

Posted 31 July 2012 - 05:21 PM

I have a PowerOne power supply that I am trying to interface with and it looks like uses a protocol that might not be supported.

Fragment from the manual is:

6.1 How to Read a byte
1) "Start condition" from Master
2) Master sends "Device address" with "write attribute"
3) "Acknowledge" from Slave device (FNP1500/1800)
4) Master sends "EEPROM address"
5) "Acknowledge" from Slave device (FNP1500/1800)
6) Master sends "Inversed EEPROM address"
7) "Acknowledge" from Slave device (FNP1500/1800)
8) "Repeated start" from Master (Sr/S)
9) Master sends "Device address" with "read attribute"
10) "Acknowledge" from Slave device (FNP1500/1800)
11) Slave sends "Data byte"
12) "Acknowledge" from Master (power management system)
13) Slave sends "Inversed Data byte"
14 "Not Acknowledge" from Master (power management system)
15) "Stop condition" from Master

Posted Image

I haven't previously seen an example that mentions inverse address and data on the I2C bus.

Suggestions on how to talk to this device?

I am trying to do this with the 4.2.0 RC5 firmware.

PowerOne I2C Programmers Manual

#2 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 31 July 2012 - 06:05 PM

You'd have to use special I2C methods with internalAddress parameter to handle repeated start condition. The inverse address/data are not related to I2C protocol, it seems to be the device's data corruption detection mechanism. I don't have the device to verify the code, but something like the following should work:

...

static I2CDevice.I2CWriteTransaction CreateReadTransaction(byte[] buffer,
  uint internalAddress, byte internalAddressSize)
{
  // TODO: paste from http://forums.netduino.com/index.php?showtopic=944
}
  
public static void Main()
{
  // TODO: Slave address (does not include the R/W bit), clock rate
  I2CDevice device = new I2CDevice(new I2CDevice.Configuration(<<slaveAddress>>, 100));

  // TODO: The address to read from
  byte address = 0x00;

  var data = new byte[2];
  var readTransaction = CreateReadTransaction(data, (uint)((address << 8) | (~address & 0xFF)), 2);

  if(device.Execute(new I2CDevice.I2CTransaction[] { readTransaction }, 1000) > 0)
  {
    var dataByte = data[0];
    var dataInv  = data[1];
    if((dataByte ^ dataInv) != 0xFF)
    {
      // TODO: Data corrupted ?
    }
  }
}

Also, don't forget the pull-up resistors on I2C signal lines.

#3 freds

freds

    Advanced Member

  • Members
  • PipPipPip
  • 61 posts

Posted 31 July 2012 - 10:48 PM

Thank again CW2. I pasted in the code at the link and it is throwing an error for FieldInfo and BindingFlags. Is there a reference and using statement also required?

#4 freds

freds

    Advanced Member

  • Members
  • PipPipPip
  • 61 posts

Posted 31 July 2012 - 11:09 PM

Is there a reference and using statement also required?


I found it in another post; need to add a "using System.Reflection;" to get it to compile.




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.