Now I will package a clean driver and post it here.
Hey Quiche, any chance you've had time to pull together a clean (or not so clean driver that you can post? Even a simple example solution would be really helpful.
  | ||||||||||||||
WiFly Shield
Started by Genious, Oct 21 2010 11:52 AM
64 replies to this topic
#41Posted 23 December 2010 - 09:47 PM
Hey Quiche, any chance you've had time to pull together a clean (or not so clean driver that you can post? Even a simple example solution would be really helpful. #42Posted 25 December 2010 - 08:09 AM
James I will as soon as I am back from vacation, in early Jan. Happy Holiday Season JP #43Posted 07 January 2011 - 09:43 PM
Hey Quiche, Happy New Year! Any chance you've had time to pull a sample together? I'm not having much luck cobbling together the code in this thread, though I'm sure its a simple issue.
One thing I noticed is that your code seems to configure the WiFly shield multiple times (i.e. after the response it seems to be re-configuring the chip). I wonder if that could be avoided by using the "save" command when the first configuration attempt happens, then I would hope the WiFly should retain the previous config.
Thanks!
#44Posted 09 January 2011 - 09:54 PM
Hi James, Happy New Year!
I could finally put together a simple web-server, which works both on Netduino Plus and FEZ Panda. The attached example is for N+. There are three key steps to building a successful web-server:
1) The patch of the Wifly is required to make sure that the board is powered at 3.3V. I personally cut the VIN pin on my shield, and soldered a small wire between VIN and 3.3V. See picture here. 2) To configure the module: plug a terminal to COM1 (RX/D0, TX/D1, GND) configured at {38400 bauds + New-Line receive at CR+LF}, then in Program.cs, remove the comment on line 20, and build/deploy/run the program. On the terminal, hit $$$ to switch to command mode, and configure the module by typing: set wlan ssid <your SSID> set wlan phrase <your passphrase, if any> join get ip save Here is a screenshot with my own configuration. Take note of the IP address (returned by the "get ip command") in use for the module (192.168.1.8, in my case) 3) Comment the line 20 in Program.cs, and build/deploy/run the program. You can then open a browser and invoke web-server. In my case: http://192.168.1.8 Note 1: this example keeps returning the same "Hello world!" html page. You can indeed tune Program.cs to return something more meaningfull to your application. Note 2: the example is still very sensitive to timing conditions (this is the reason why the example keeps returning a static page); in Wifly.cs, changing the timing on line 246, 248, 250, or 254, may change your result. I still need to keep experimenting to understand how to fix this. But I trust that you'd be happy if you can serve the "Hello World!" page. Let me know if this works for you too! Edit: the Wifly.cs code uses the default values of 14MHz crystal and localport 80. You can change these values, by inserting before line 21 (module.Open()) the following: module.Type = DeviceType.crystal_12_288_MHz; // should you use the old module module.LocalPort = 8081; // should you want a different port JP #45Posted 09 January 2011 - 10:00 PM
And here is the project that I forgot to attach earlier on EDIT: bug fix in the attached WiFly.zip - in WiFly.cs: you want to comment out line 147 (Thread.Sleep(10) in receiveLine); this delay was eating characters on the UART, step 2 above JP Attached Files#46Posted 09 January 2011 - 10:03 PM
Awesome JP, thanks!! Yes I'd be happy to serve up anything with the WiFly at the moment and work on tuning the solution later. Your work is very much appreciated.
Btw did you forget to attach the code?
Edit: Two seconds after I post there it is!
James
#47Posted 09 January 2011 - 11:58 PM
Great info JP - here are a few comments:
1. If I power the Netduino with an external 9v battery I find that the WiFly works properly. Should I still patch the power as you did to prevent burning it out?
2. Fwiw I configured the WiFly using Ad Hoc networking mode - it'll be nice to have the UART option in the future though! I'm pretty sure this part is correct since I can see the WiFly in my router device list and successfully ping it.
3. I'm not sure which crystal my module uses - the model is RN-131C. I did try both settings before calling module.Open() to be sure.
I tried out the code you posted and it seems to configure the module correctly, but the ReadRegister method in Connect never returns true. Still investigating why that's happening, definitely making progress!
James
#48Posted 10 January 2011 - 06:21 AM
1. Don't change anything if the module works fine for you, which is the case as you can ping it. FYI, once the module has been properly configured and joined to the router, there should be only one LED blinking: it's PIO4, blinking green, slowly (lower than 1Hz) 2. I am using Infrastructure mode myself. Apparently this is one major difference between your configuration and mine. Can you give it a try with infrastructure mode? 3. On the oscillator: I found out mine by trying both values, one at the time, and figured that mine runs at 14.7456 MHz. Not returning from ReadRegister in Connect: either your module is still in command mode (which should not be the case as the last command was either reboot or exit), or it just doesn't receive anything from broadband. I think the latter, and you definitely want to try to configure you module in infrastructure mode PS-1: And, if indicated above, do not forget to comment out line 147 of WiFly.cs - the Thread.Sleep in receivedLine, if you don't want garbled characters on the module configuration via UART. As you'll be there, would you also post a screenshot of your UART config, in particular after "get wlan" or "reboot" comands? This will help for comparaison. PS-2: Another useful troubleshooting info is a network traffic, that you can acquire using a free tool such as Wireshark. Click here to see such a dump on my environment. This dump clearly shows that I cannot close the socket in time and hence "loses" the second GET favicon.ico; it also shows that the last 3 commands are sent to broadband, instead of being interpreted JP #49Posted 11 January 2011 - 02:44 AM
Some results from testing tonight - I've gotten "somewhere" and the Netduino receives string of recognizable text when I telnet into the WiFly at port 2000 (the text looks like "*ERR:OPEN:CLOSE?" or something similar so I think it's real data). Still having some trouble getting it to serve up a web page though, the call to ReadRegister in the Connect method always returns the value 96, so the & 0x1 never evaluates to true and the code never gets further than that.
I think I described my setup poorly, I did use ad hoc to configure the WiFly but now run it in infrastructure mode. Here are the details from "get wlan":
<2.21.D> get wlan
SSID=mywireless
Chan=0
ExtAnt=0
Join=1
Auth=OPEN
Mask=0x1fff
Rate=12, 24 Mb
Linkmon=0
Passphrase=xxx
Also I did comment out the sleep call at line 147 and have seen some "AOK" responses in the VS debug console.
One thing I noticed is that you appear to have a WiFly-GTX where I have a GSX model, I wonder if that could have anything to do with it.
I'll check out WireShark and see if I can monitor the traffic. I've always had a tough time using that tool though, any pointers on the steps I should take to capture a trace like the one you did?
Thanks again for the help, I think this is close to working!
#50Posted 11 January 2011 - 03:06 AM
1) This "get wlan" looks good. Can you also send your output after a "join", and after a "reboot" command? I'd like to see the IP & port on which it is listening 2) I too have a GSX (it's a typo of mine in WiFly.cs#163) 3) WireShark: a) In WireShark, select your wi-fi interface in the interface list B) In WireShark, in the "filter" edittext, type {http.request.method == "GET"} without the braces, and click "Apply" c) Start the test in the browser d) In WireShark, right-click on the GET you are interested in, and select "Follow TCP Stream", et voilà!JP #51Posted 11 January 2011 - 09:30 PM
Here is an update to my WiFly driver and examples. The test application counts the number of visits during the browser session, using HTTP cookies.
There are two main changes from the previous version of the driver:
Step 2, execution: recompile Program.cs with configureViaUART set to false, and re-deploy. From your browser, launch "/count.aspx" on the WiFly IP Known bugs: module command "close" does not close, connections are closed after 2s idle time. HttpResponse.WriteBinary is currently buggy. Also, there is currently an annoying discrepency: it works just fine with firmware 4.1.0.5 (build date 7 Nov 2010), but not with 4.1.1.0 alpha 5(build date 3 Jan 2011): the SPI USART does not initialize correctly (throws an exception in WiFly.cs#93) with the firmware 4.1.1.0 alpha 5. And here is the corresponding application code: using System; using Microsoft.SPOT; using Microsoft.SPOT.Hardware; using SecretLabs.NETMF.Hardware.NetduinoPlus; using astra.WiFly; public class Program { public static void Main() { Boolean configureViaUART = false; // The WiFly module is connected via SPI1, with Chip Select signal on Pin D10: WiFly module = new WiFly(SPI.SPI_module.SPI1, (Cpu.Pin)SecretLabs.NETMF.Hardware.NetduinoPlus.Pins.GPIO_PIN_D10); if (configureViaUART) { // Just configure the WiFly module via UART, connected to COM1 at 38400 bauds module.EnableSerialGateway("COM1", 38400); } else { // Run a service that keeps track of the number of visits on "/count.aspx" module.Open(); Debug.Print("Listening on " + module.SendCommand("get ip", "IP=", 10, 500)); while (true) { HttpContext context = module.Connect(); // Any other path displays an html "Hello World!" String content = "<html><h1>Hello world!</h1>Path: " + context.Request.Path + "</html>\n"; if (context.Request.Path == "/count.aspx") { // Simple & stupid implementation of some useless dynamic code String counter = context.Request.getCookie("counter"); int numberVisits = counter == null ? 1 : Int16.Parse(counter) + 1; context.Response.addCookie("counter", counter = numberVisits.ToString()); content = "<html><h1>Welcome back to your visit #" + counter + "</html>\n"; } context.Response.ContentType = "text/html"; context.Response.ContentLength = content.Length; context.Response.Write(content); context.Response.Close(); } } } } EDIT: you want to use the last version of the driver, posted here in replacement to the one below Attached Files#52Posted 12 January 2011 - 07:54 AM
Here is an update of the last version of the driver, that fixes a bug in the UART configuration (the configuration via UART would not start)
EDIT: the attached version is outdated. See next post JP Attached Files#53Posted 18 January 2011 - 10:22 PM
Here is another update of the last version of the driver, that adds a number of features:
The updated driver and test application are available here. JP #54Posted 08 March 2011 - 05:19 PM
I am about to start a project with Netduino Plus (when I can get one) and Wifly to send acquired data wirelessly to a server for analysis. I have not worked with WiFi before so I am looking for working examples. What resources do you suggest? Did Innovactive post something yet?
#55Posted 27 March 2011 - 05:15 AM
I have a few questions regarding WiFly support status for Netduino+ board:
- What is the status of the current support?
- Is it usable?
- What performance do we have? Is it something that impacts network performance very much?
- Do we have AP Mode/Master aka creating Wireless Access Point on WiFly + N+. Can we do that?
So far I love my Netduino+ board, but WiFly costs almost 90$ + shipping. I wanna find out as much as I can before buying it.
-davidlt
#56Posted 27 March 2011 - 05:52 AM
For best performance, I'd use the Netduino Plus with a WiFi Ethernet Bridge device. I know that a number of people have used Quiche's drivers...but I have not had a chance to use WiFly enough to have a good feel for performance. Chris #57Posted 28 May 2011 - 03:10 AM
Did you ever get the WiFly back up? I think I did the same thing with the 3.3V and P109. #58Posted 09 June 2011 - 07:52 PM
Any new updates on having the Netduino be a reliable Wifi client? I have an application where I need the Netduino to join a Wifi network to post data to a cloud service ...
Suggestions?
Scott
#59Posted 17 June 2011 - 07:18 PM
No. I am trying it now, but I get nothing. No lights, nothing at all. #60Posted 17 June 2011 - 07:29 PM it only works when an external power supply is used.
"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 0 user(s) are reading this topic0 members, 0 guests, 0 anonymous users | ||||||||||||||
|
||||||||||||||
This webpage is licensed under a Creative Commons Attribution-ShareAlike License. | ||||||||||||||