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.

pajama

Member Since 08 Apr 2015
Offline Last Active Apr 20 2015 12:54 AM
-----

Posts I've Made

In Topic: Netduino + 2 I2C with VNCL4000 Proximity Sensor

17 April 2015 - 08:15 PM

_slaveDevice.Execute(writeXAction, transactionTimeout) is returning 0


In Topic: Netduino + 2 I2C with VNCL4000 Proximity Sensor

17 April 2015 - 08:10 PM

I would try using the WriteRegister and ReadRegister methods rather than the generic Write and Read methods.

 

Thank you for the suggestion.

Here's what I'm doing, still getting the same error. Should my writebuffer be a different size?

 public byte ReadVersion()
        {
            // write register address
            byte[] writeBuffer = new byte[1];
            I2CBus.GetInstance().WriteRegister(_slaveConfiguration, (byte)CommandRegisters.ProductId, writeBuffer, TransactionTimeout);

            // get the byte result
            byte[] data = new byte[1];
            I2CBus.GetInstance().ReadRegister(_slaveConfiguration, (byte)CommandRegisters.ProductId, data,TransactionTimeout);
            //force the convertion to a signed byte
            return data[0];
        }

In Topic: Netduino + 2 I2C with VNCL4000 Proximity Sensor

16 April 2015 - 09:30 PM

 

  • You are using a 8-bit I2C address in your code. (0x27) and it needs to be a 7-bit address (0x13).
  • Your I2C clock is set too high. I do not think that the Net Micro Framework supports clock at 3400. Try setting your clock to 100 and then (if successful) try a higher clock (400).

 

 

Thank you for the reply! I changed the values above. Still throwing an exception here:

 

 if (transferred != writeBuffer.Length)
                    throw new Exception("Could not write to device.");

 

 

Any ideas?


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.