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

I²C connection with RFID


  • Please log in to reply
No replies to this topic

#1 FVN.Net

FVN.Net

    Member

  • Members
  • PipPip
  • 15 posts
  • LocationCentral Belgium, EU

Posted 03 October 2012 - 07:06 PM

I made a new topic to abandon the old (here) since I feel I made some progress.

I tried to write 'native' VB code for my I²C connection, so not using any custom class or wrapper like the Toolbox. Here's what I came up with:

Dim outbytes() As Byte = New Byte() {}
Dim inbytes(6) As Byte '= New Byte() {}

Dim cfg As New I2CDevice.Configuration(80, 400)
Dim iic As New I2CDevice(cfg)

outbytes = New Byte() {160, 1, 1}

Dim write_transaction As I2CDevice.I2CTransaction = I2CDevice.CreateWriteTransaction(outbytes)
Dim read_transaction As I2CDevice.I2CTransaction = I2CDevice.CreateReadTransaction(inbytes)
Dim transActionList As I2CDevice.I2CTransaction() = New I2CDevice.I2CTransaction() {write_transaction, read_transaction}

Dim i As Integer = iic.Execute(transActionList, 5000)

The good thing is: this code does NOT result in an error. It seems the array that will contain the read bytes should have a fixed size. That makes sense, in retrospect. So after defining the size of this array, the exception was gone.

The bad thing is: the inbytes array is not filled with valid data but stays filled with zeroes.
FWIW, the device I'm trying to interface with is here (RFID reader).

EDIT after 2 hours of more testing and trying.
This line of code:
Dim i As Integer = iic.Execute(transActionList, 1000)[/code]

returns 1 WITH 10k or 2k2 pull ups
returns 3 WITHOUT these pull ups.
I'd say 3 is correct because of 3 items in outbytes. The inbytes array does not change, unfortunately.

Any clues?
- Franki




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.