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.

FVN.Net

Member Since 04 Jul 2012
Offline Last Active Oct 23 2014 11:04 AM
-----

Topics I've Started

I²C connection with RFID - revisited

05 October 2012 - 09:28 PM

Sorry dear forum members that I repeat my earlier question here in the N+ department.
The original posting of the problem is here:
http://forums.netdui...tion-with-rfid/

I know that this double posting isn't good practice but when browsing the VB.Net part of the forum, I noticed that the topic I²C came up in the dedicated VB pages 3 or 4 times over the past months with no answer at all or just a vague code snippet at best. So I take my chance again by posting it on the N+ pages, which seem to be read and replied to more.

VB support is what brought me to Netduino so I'd really like to get my project going. It's been over three days and numerous hours of trying to get something into /out of the SL030 RFID reader over I²C.

Here's my code:
Dim cfg As New I2CDevice.Configuration(80, 100)
Dim iic As New I2CDevice(cfg)

Dim outbytes() As Byte = New Byte() {}
Dim inbytes() As Byte = New Byte(7) {}

Dim i As Integer = 0
Dim sInput As String = ""

outbytes = New Byte() {80, 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}

i = iic.Execute(transActionList, 10)
Debug.Print(i.ToString)
Thread.Sleep(50)
For Each item As Byte In inbytes
   sInput &= item.ToString & " "
Next
Debug.Print(sInput)

This code tells me that 3 bytes have been sent as expected (outbytes array) and that nothing comes into the inbytes array since it all remain bytes set to zero by the declaration of the array.

Right now there are no external pull ups engaged, since WITH pull ups I get '1' for bytes sent and WITHOUT I get the expected 3 bytes sent.

I've searched everywhere and have tried numerous things. It drives me crazy.
I'd be really grateful if someone could help me out? Thanks a lot!
- Franki

I²C connection with RFID

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

Using Adafruit RGB LCD Shield (I²C)

28 September 2012 - 03:03 PM

"Just checking" - and keeping fingers crossed. I'm about to finish the assembly of the I²C driven LCD + buttons from Adafruit (RGB LCD Shield I²C). To use it, can I just connect +5V/GND and SCA/SCL to the right pins on the N+ and their pull-ups (10k?) and run/modify the module "Adafruit RGB LCD Shield" from the NetMFToolbox? Could that be all? Connect and use the Write and ChangePosition methods? Or am I overlooking something? I know classic electronics and am a self-taught VB.Net programmer, but this N+ stuff is all new to me, and I have so many things in mind I want to do with it. - Franki

Problem using AnalogInput

19 September 2012 - 07:52 PM

Hello to all

For the first time I try to use an analog input on my N+ with latest firmware.

I tried the obvious:

Dim potMeter As New AnalogInput(Pins.GPIO_PIN_A0)
but this gave me:
Option Strict On disallows implicit conversions from 'Microsoft.SPOT.Hardware.Cpu.Pin' to 'Microsoft.SPOT.Hardware.Cpu.AnalogChannel'.

This link told me to use this line of VB code:
Dim potMeter As New Microsoft.SPOT.Hardware.AnalogInput(Cpu.AnalogChannel.ANALOG_0)
or
Dim potMeter As New SecretLabs.NETMF.Hardware.AnalogInput(Pins.GPIO_PIN_A0)
results in this error:
An unhandled exception of type 'System.ArgumentException' occurred in Microsoft.SPOT.Hardware.dll

So I can't even run my code, it breaks when initialising the analog input.
What am I doing wrong? What am I overlooking? All help appreciated. Thanks already.

N+ loses IP info

07 August 2012 - 01:28 PM

I hope this is a common newbie problem although a quick search doesn't reveal a solution. Using MFDeploy I set my N+ to 10.1.1.10 / 255.0.0.0 / DG = 10.1.1.1. No DHCP. I ping from the laptop and it sees the N+. So far so good. In VS2010, I have ported this code to VB: http://netduinohacki...ello-world.html THIS HAS WORKED A COUPLE OF TIMES from the start but it fails to do so now. However, the code is ok since it works from the browser and also replies to my own Windows Forms program. The code GetAllNetworkInterfaces()(0).IPAddress gives 10.1.1.10 when it works but 0.0.0.0 when it doesn't. After this trial, a ping doesn't show the N+ anymore, so I need to run MFDeploy again. Somewhere it has set the N+ to DHCP and since there is no DHCP, all IP's are 0. When the IP info is set again, running the code sets DHCP to 'on' and IP's to 0.0.0.0. Can someone please explain what might be the problem? All input appreciated!

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.