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's Content

There have been 4 items by pajama (Search limited from 29-April 23)


By content type

See this member's

Sort by                Order  

#62175 Netduino + 2 I2C with VNCL4000 Proximity Sensor

Posted by pajama on 17 April 2015 - 08:15 PM in Netduino Plus 2 (and Netduino Plus 1)

_slaveDevice.Execute(writeXAction, transactionTimeout) is returning 0




#62174 Netduino + 2 I2C with VNCL4000 Proximity Sensor

Posted by pajama on 17 April 2015 - 08:10 PM in Netduino Plus 2 (and Netduino Plus 1)

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];
        }



#62153 Netduino + 2 I2C with VNCL4000 Proximity Sensor

Posted by pajama on 16 April 2015 - 09:30 PM in Netduino Plus 2 (and Netduino Plus 1)

 

  • 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?




#62098 Netduino + 2 I2C with VNCL4000 Proximity Sensor

Posted by pajama on 14 April 2015 - 12:18 AM in Netduino Plus 2 (and Netduino Plus 1)

Dear Netduino Community,

I'm having a hard time writing this I2C driver. I've looked through a number of tutorials/examples, but everything I try always throws a System.ArgumentException, without much information.

 

I'm trying to get this little proximity/ambient light sensor up and running with a Netduino Plus 2:

http://www.adafruit....ts/vcnl4000.pdf

 

The important bit in that data sheet is probably the example application:

Addressing:command: 26h, 85h (VCNL4000_I2C_Bus_Write_Adr., Ambient Light Result Register #5 [85]) Read register #5:command: 27h, data (VCNL4000_I2C_Bus_Read_Adr., {High Byte Data of Ambient Light Result Register #5 [85])} Read register #6:command: 27h, data (VCNL4000_I2C_Bus_Read_Adr., {Low Byte Data of Ambient Light Result Register #6 [86])}

 

 

I can't find any other netduino I2C examples that are remotely similar. I would really appreciate any advice! Maybe if someone can help me figure out the most basic example of reading command register #1 (product ID), that would give me a huge step in the right direction. 

 

I've attached a VS project if anyone cares to check it out.

 

Thank you for your time!

Attached Files





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.