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

WiFly with Netduino Plus 2


  • Please log in to reply
22 replies to this topic

#1 mav29x

mav29x

    New Member

  • Members
  • Pip
  • 7 posts
  • LocationNew York, NY

Posted 18 December 2012 - 02:00 AM

Hello,

I just got the WiFly shield from Sparkfun and am testing it out with the Netduino Plus 2. When I tried to instantiate the shield, it just locks up. Here's my main method. The last thing the debugger would print is "Creating Wifly." Anyone know what might be the cause?

Thanks.

public static void Main()
{

     Debug.Print("Program starting");

     OutputPort led = new OutputPort(Pins.ONBOARD_LED, false);

     Debug.Print("Creating Wifly");

     WiFlyGSX wifiModule = new WiFlyGSX();

     Debug.Print("enabling dhcp");

     wifiModule.EnableDHCP();

     Debug.Print("Joining Network");

     wifiModule.JoinNetwork("ssid");

     Debug.Print("IPAddress: " + wifiModule.LocalIP);

     SimpleSocket mySocket = new WiFlySocket("www.netmftoolbox.com", 80, wifiModule);
     mySocket.Connect();

     while (true)
     {
          if (mySocket.IsConnected)
          {
               led.Write(true);
          }

          else
          {
          led.Write(false);
          }
     }

}


#2 Gutworks

Gutworks

    Advanced Member

  • Members
  • PipPipPip
  • 363 posts
  • LocationOttawa, Ontario

Posted 18 December 2012 - 02:59 AM

I just got the WiFly shield from Sparkfun and am testing it out with the Netduino Plus 2. When I tried to instantiate the shield, it just locks up. Here's my main method. The last thing the debugger would print is "Creating Wifly." Anyone know what might be the cause?

Hi mav29x,

I ran into the same issue. It was Stefan who pointed out the issue is actually with the Sparkfun Xbee Shield (WRL-09976). There is a missing pull-up on the board, which is not really needed when using an Xbee since they have it built into the actually module. However when you try using a WiFly module on this shield you will need to manually bypass the diode on pin 3 of the shield. If you look down through the comments of the shield's webpage you'll see that people have noted this error. They have since released a revision of the board that corrects this issue, however if you're like me, we missed out on it.

Instead I have just been using a Xbee breakout board (don't forget to buy the sockets and headers as they aren't included), my breadboard and some wires to directly connect the WiFly to my Netduino Plus 2. You only have to connect VCC, GND, DOUT and DIN pins to the Netduino for basic use.

I hope this helps.

Steve

#3 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 18 December 2012 - 03:06 AM

Hi mav29x, If I remember correctly, you may need to put the WiFly into a certain mode to configure it for the right baud rate...before trying to use it. Which drivers are you using? Do they have any directions for initial setup? Chris

#4 mav29x

mav29x

    New Member

  • Members
  • Pip
  • 7 posts
  • LocationNew York, NY

Posted 18 December 2012 - 04:33 AM

Instead I have just been using a Xbee breakout board (don't forget to buy the sockets and headers as they aren't included), my breadboard and some wires to directly connect the WiFly to my Netduino Plus 2. You only have to connect VCC, GND, DOUT and DIN pins to the Netduino for basic use.


Thanks Gutworks. I'm actually using this shield. Doesn't appear to be the same board as the Xbee Shield.

Which drivers are you using? Do they have any directions for initial setup?


Hey Chris, I'm using the Toolbox.NETMF.Hardware.WiFlyGSX driver. Looking at the class library, it looks like the baud rate is set by default and I'm actually following the sample code that was provided.

I did some poking around. From the schematic, it looks like the Wifi Shield gets its power from pin VIN. What is the voltage supposed to be on that pin with respect to ground? I'm measuring 2.5V without the shield and it drops down to 0.8V with the shield attached.

Thanks.

#5 Gutworks

Gutworks

    Advanced Member

  • Members
  • PipPipPip
  • 363 posts
  • LocationOttawa, Ontario

Posted 18 December 2012 - 05:22 AM

Ah, yes. I forget there are couple WiFly versions out there. If I recall correctly, I had issues connecting to my network when I first got my WiFly. To resolve it I used Putty to connect to it and from there manually set the SSID, security settings and password. After that I had little to no issues with the Toolbox code. Steve

#6 Gutworks

Gutworks

    Advanced Member

  • Members
  • PipPipPip
  • 363 posts
  • LocationOttawa, Ontario

Posted 18 December 2012 - 05:35 AM

One other thing. I think you may need to power your Netduino Plus 2 with an external power supply if the WiFly Shield uses VIN. I think the shield has its own voltage regulator on it and will regulate the VIN down to 3.3v for you. I'm not near my computer at the moment (using my phone), but will look at a little closer in the morning. Steve

#7 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 18 December 2012 - 07:53 AM

The drivers I wrote aren't tested on the wifly shield, only on the xbee-form-factor-module. I didn't even knew they worked on the shield :)
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#8 mav29x

mav29x

    New Member

  • Members
  • Pip
  • 7 posts
  • LocationNew York, NY

Posted 18 December 2012 - 11:30 PM

Thanks Steve. I think you're right about needing an external power supply. I have one coming in the mail and will retest the voltages once it arrives. Hey Stefan, thanks for creating the driver! :)

#9 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 18 December 2012 - 11:32 PM

One other thing. I think you may need to power your Netduino Plus 2 with an external power supply if the WiFly Shield uses VIN.

Oh yes, great point Gutworks.

I believe that the WiFly shield does require an external power adapter (feeding into the power barrel or VIN/GND). This may be due to the amount of current that the shield needs to operate. The Netduino's 5V/3V3 headers can supply several 100 mA of power, but the shields are designed for the Arduino boards where 3.3V can typically only supply 50mA.

Chris

#10 mav29x

mav29x

    New Member

  • Members
  • Pip
  • 7 posts
  • LocationNew York, NY

Posted 25 December 2012 - 03:42 AM

So I got my external power supply, powered it up and it's looking promising. The WiFly shield actually powered up with blinking lights and all. When I ran the same code in my original post, it's still stuck at the same place - just stops at instantiating the WiFly module. Is there something I can do to get it to work or do I really have to buy the XBee version?

-Eric

#11 ericcox

ericcox

    Member

  • Members
  • PipPip
  • 19 posts

Posted 12 January 2013 - 04:36 AM

Hi mav29x,

 

I'm also using the WRL-09954 shield.  If you're using this driver, and unless I'm completely mistaken, it won't work directly with a Wifly shield.  It's designed to work with a WiFly module connected directly to a SerialPort.  But the WiFly shield does not connect the WiFly directly to a serial port, it connects it through a SC16IS750 SPI-to-Uart bridge. 

 

Today I started working on a driver class for the SC16IS750 that I'm hoping will perform all of the bridge-setup code, and return a descendent of SerialPort that you can pass into the Toolbox driver. (The Toolbox driver will require a small modification - a new constructor - but I think it should work)

 

I'll post here when I've got something to show - right now it just contains code to define all the registers and read and write them (didn't know what SPI was until today :lol:)

 



#12 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 12 January 2013 - 08:32 AM

Hi ericcox,

 

That's nice to hear! If you have success in that, please let me know, it would be awesome to be able to put that into the toolbox.


"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#13 ericcox

ericcox

    Member

  • Members
  • PipPip
  • 19 posts

Posted 14 January 2013 - 05:08 PM

Hi Stefan,

 

Things rarely go according to plan.  :lol:

 

Apparently, the Microsoft NETMF team didn't want anyone to subclass the SerialPort class, and the SerialDataReceivedEventHandler and SerialErrorReceivedEventHandler classes both have internal constructors.  I wish the MS team hadn't made those choices.  So unfortunately I'm having to re-write part of the WiFlyGSX class to use a SerialPort-like interface, ISerialPort.

 

Thankfully only about 6 SerialPort members are used in the WiFlyGSX code, so it won't be too bad. If someone wants to come along and implement the rest of the ISerialPort methods/properties later, to make it a fully-functional SerialPort implementation, they're more than welcome.

 

I'll send a patch against rev 21420 of the toolbox code when I'm done. I'm hoping to have it functional today, and then get the code cleaned up and "presentable" afterward.

 



#14 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 14 January 2013 - 05:18 PM

When setting up the toolbox I actually considered to make interfaces for the serial port, so you're doing a great job :D


"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#15 ericcox

ericcox

    Member

  • Members
  • PipPip
  • 19 posts

Posted 14 January 2013 - 05:47 PM

When setting up the toolbox I actually considered to make interfaces for the serial port, so you're doing a great job :D

 

Unfortunately, I didn't think this through very well. There is no way for me to make SerialPort class implement my interface.  Which means that I can't create a common interface for the SPI Serial port class and the original SerialPort class.

 

Any ideas?



#16 ericcox

ericcox

    Member

  • Members
  • PipPip
  • 19 posts

Posted 14 January 2013 - 06:32 PM

Never mind, I found a way to do it - it's a bit messy but compiles and should work.



#17 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 15 January 2013 - 07:50 AM

Ok awesome. If you need any help, please send me a pm :)


"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#18 testmonkey107

testmonkey107

    New Member

  • Members
  • Pip
  • 2 posts

Posted 15 January 2013 - 10:48 AM

I've been using wiFly over SPI on Netduino Plus for about 8 months. 

I have a modified version of Stefan's WiFlySocket.cs and a WiFlyGSX_SPI.cs.

I did the initial configuration manually, so there may be a couple of things missing, but it's at

https://github.com/s.../topsoil-reader

if you want to take a look. It's not well documented, but it could be a good reference.

Maybe I should clean it up and post it to the public.

 

As soon as my Netduino Plus 2 arrives I will begin writing a firmware level driver so that I can use the NetworkInterface Class and all the goodies that go with it. SSL is the main thing I want to take advantage of.



#19 tenback

tenback

    New Member

  • Members
  • Pip
  • 2 posts

Posted 15 January 2013 - 10:56 AM

Never mind, I found a way to do it - it's a bit messy but compiles and should work.

Did you had any luck to get the Wifly module to work on your Netduino Plus 2 yet?



#20 ericcox

ericcox

    Member

  • Members
  • PipPip
  • 19 posts

Posted 16 January 2013 - 09:44 PM

Did you had any luck to get the Wifly module to work on your Netduino Plus 2 yet?

Hi Tenback,

 

I have had some success. I'm currently grappling with some sort of flow control/interrupt problem so it isn't ready yet.  Basically, it either works perfectly, or fails waiting for a response to a command.  :( Still trying to figure out what the cause those two results is.

 

At least the proof-of-concept is complete, so I know that if I can get this problem worked out, it should be useful for my project.






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.