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.

NitinSontakke

Member Since 26 Feb 2015
Offline Last Active Dec 21 2015 01:52 AM
-----

#64537 I2C strange behavior

Posted by NitinSontakke on 19 November 2015 - 05:27 PM

@scardinale, You are a STAR!

 

I copied and executed the I2C Scanner and it gave me Int32 address 112, which i right shifted by 1 and used and it WORKED for my other project!

 

Not sure how on earth one (read, novice like me!) would think of running a scanner to determine an address of a device and then use it.

 

Anyway, I thank you very much for taking away the biggest stumbling block in my journey towards ambitious home automation project.

 

Thanks, again!




#64533 I2C strange behavior

Posted by NitinSontakke on 18 November 2015 - 05:03 PM

Hello,

 

Right shifting 0x40 by 1 bit gives me 0x20 (decimal 32). Now it makes sense to me why this value is being used in all the code i see here. While it was step in right direction, unfortunately, it hasn't help resolve the issue.

 

Shown below is the code i copied from this thread, added the "magic code block" right at the beginning and changed the address to 0x20.

 

I commented out the "read" transaction because data-sheet mentions that this address is for "write" transaction.

 

The output is "not found" three times.

 

PCF8574 -> N2P connections are as follows:

VCC -> 5V - 10k pull-up registered applied

INT -> Nothing

SCL -> SCL

SDA -> SDA

A0, A1, A2 -> Ground

 

I had taken the photo of assembly but i am facing problem uploading it here.

    public static void Main()
    {
      using (OutputPort i2cPort = new OutputPort(Pins.GPIO_PIN_SDA, true))
      {
        i2cPort.Write(false);
        Thread.Sleep(100);
      }

      I2CDevice.Configuration config = new I2CDevice.Configuration(0x20, 100);
      I2CDevice I2C_Bus = new I2CDevice(config);

      I2CDevice.I2CTransaction[] transactions;
      transactions = new I2CDevice.I2CTransaction[1];

      transactions[0] = I2CDevice.CreateWriteTransaction(new byte[0xff]);
      //transactions[1] = I2CDevice.CreateReadTransaction(new byte[1]);

      for (Int32 i = 0; i < 3; i++)
      {
        Int32 result = I2C_Bus.Execute(transactions, 1000);

        if (result > 0)
        {
          Debug.Print("found");
        }
        else
        {
          Debug.Print("not found");
        }
      }
    }




#64528 I2C strange behavior

Posted by NitinSontakke on 18 November 2015 - 02:10 AM

Thanks! Will try and update.




#64526 I2C strange behavior

Posted by NitinSontakke on 17 November 2015 - 05:20 PM

@hareega,

 

If you could care to mention the device / chip you are using, please!

 

I am using NP2 and NETMF 4.3 and....

 

I have been struggling to get i2c working with PCF8574 and PCF8575 over days now with no luck so far and any help from anyone on forum is hugely appreciated.

 

I using classes generously provided by NooM

 

The data-sheet indicates address 0x40, which i tried and also tried the default of 0x20.

 

Pins -> Absolutely nothing special. Pull-up registers are applied as am working on break-out board.

 

Please help!




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.