Main Site Documentation

RN171 module not working?


#1

My start point was https://www.ghielectronics.com/docs/122/gadgeteer-driver-modification.
The first photo shows the modification to the baud rate. I have also modified the example code from https://www.ghielectronics.com/docs/178/wifi-rn171-module:


using System;
using System.Collections;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Touch;

using Gadgeteer.Networking;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;

namespace GadgeteerControllerA
{
    public partial class Program
    {
        // This method is run when the mainboard is powered up or reset.   
        void ProgramStarted()
        {

            Debug.Print("Program Started");
            bool bFlag = wifi_RN171.Initialize(GTM.GHIElectronics.WiFi_RN171.SocketProtocol.TCP_Server); //Init as TCP Server
            if (!bFlag)
                Debug.Print("WiFi not initalised");
            else
            {
                bFlag = wifi_RN171.EnableHttpServer(); //Enable HTTP Parsing
                if (!bFlag)
                    Debug.Print("Server not initalised");
                else
                    wifi_RN171.HttpRequestReceived += new GTM.GHIElectronics.WiFi_RN171.HttpRequestReceivedHandler(wifi_RN171_HttpRequestReceived);
            }
        }
        void wifi_RN171_HttpRequestReceived(GTM.GHIElectronics.HttpStream request)
        {
            string requestedURL = request.Request.URL;

            if (requestedURL == "/index.html")
            {
                //HeaderData["Content-Length"] = document.Length.ToString();
                string document = "<html><head></head><body>HELLO! KG1</body></html>";
                request.Response.HeaderData["Content-type"] = "text/html";
                request.Response.HeaderData["Content-Length"] = document.Length.ToString();
                request.Response.HeaderData["Connection"] = "close";
                request.Response.HeaderData["Cache-Control"] = "no-cache";
                request.Response.StatusCode = GTM.GHIElectronics.HttpResponse.ResponseStatus.OK;

                //All you have to do is send the document data through the response object.
                //Header data is automatically applied for you when you chose to send.
                request.Response.Send(System.Text.Encoding.UTF8.GetBytes(document));
            }
        }
    }
}

Prior to adding the bFlag, stepping through the RN171 module library, I noted that the WiFi_RN171() function completed ok then passed to _Serial_Listen() at which point I access the Hotpoint using my tablet. This caused the LEDs on the module to change from red and green flashing (red twice as fast as green) to red switching off and green continuing to flash. _Serial_Listen() passed to EnableHttpServer() to _Command_Mode_Start() to _Command_Mode_Write() which tried to send “$$$” to the module. I then added the bFlag to wifi_RN171.Initialize(). Please see the photo of VS attached.
I also used telnet to examine the RN171 module settings. Please see the photo of telnet attached. My tablet is allocated 192.168.1.11 automatically.
I am not able to see the web page in my tablet browser (with debugging or without).
I am using Cobra II (Eco) with the Wifi RN171 Module. The module is plugged into a socket K in the extension board.
Your advice would be much appreciated. Regards, Kevin.


#2

@ KG1 - what tablet are you using as well as what brower is the request originating? What do you see if you use WireShark to monitor network traffic when using the browser as opposed to telnet?


#3

@ James Any progress on the RN171 module? I am working on Wifly presently as it provides a stepping stone re RN171. Please refer to http://121.73.22.247/drupal/content/best-wifi-wifly . I have updated the firmware to 4.00 on two units and next will experiment with commands for AP mode. Once I have a good understanding of AP mode I will then return to C# Gadgeteer.
Regards,
Kevin.