Main Site Documentation

Fez Cobra II (WiFi) - built in RS9110-N-11-22-04 WiFi module


#1

I’ve been trying to instantiate an instance of WiFiRS9110 in order to get the wireless capabilities on my board, but I’m stuck and I’ve tried everything I can think of…

I’m stuck on the constructor:


public WiFiRS9110(
	SPI_module spi,
	Pin chipSelect,
	Pin externalInterrupt,
	Pin reset,
	uint clockRateKhz
)

I can’t seem to figure out the first argument. I looked on the schematic ( http://www.ghielectronics.com/downloads/FEZ/Cobra_II/FEZ%20Cobra%20II%20sch.pdf ) and I do notice some mention of SPI near the bottom of the chip (bottom of the diagram. But I’m not really clear on any of these arguments, or if I’m even approaching this correctly.

I’ve looked around for a bunch of tutorials/examples, but part of the issue is I think most of these were for .NETMF 4.1 and I’m using .NETMF 4.2… Either that or they’re using the WiFi_RS21 module which can be constructed with a port number and I am not using one of the Gadgeteer ports since the module is on the board…

I think it’s time to ask for help, so here is all the information a helpful hacker would need to help a polite novice:
Program.generated.cs



//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by the Gadgeteer Designer.
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

using Gadgeteer;
using GTM = Gadgeteer.Modules;

namespace GadgeteerApp2
{
    public partial class Program : Gadgeteer.Program
    {
        // GTM.Module definitions
        Gadgeteer.Modules.GHIElectronics.SerCam serCam;

        public static void Main()
        {
            //Important to initialize the Mainboard first
            Mainboard = new GHIElectronics.Gadgeteer.FEZCobra_II();			

            Program program = new Program();
            program.InitializeModules();
            program.ProgramStarted();
            program.Run(); // Starts Dispatcher
        }

        private void InitializeModules()
        {   
            // Initialize GTM.Modules and event handlers here.		
            serCam = new GTM.GHIElectronics.SerCam(5);

        }
    }
}

Program.cs


using System;
using System.Collections;
using System.Threading;
using System.Net;
using System.Net.Sockets;

using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Touch;

using Microsoft.SPOT.Net;
using Microsoft.SPOT.Net.Security;
using Microsoft.SPOT.Net.NetworkInformation;

using Gadgeteer.Networking;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
using GHI.Premium.Net;
using Gadgeteer.Modules.GHIElectronics;

namespace GadgeteerApp2
{
    public partial class Program {


        NetworkInterface wifi_network_iface;
        //WiFiRS9110 wifi;

        void ProgramStarted()
        {
            //WiFiRS9110 wifix = new WiFiRS9110(Gadgeteer.SPI.????
                // or this... what?!?
                //Microsoft.SPOT.Hardware.SPI.SPI_module.SPI4,Microsoft.SPOT.Hardware.Cpu.Pin.GPIO_NONE, Microsoft.SPOT.Hardware.Cpu.Pin            
            
            
            NetworkInterface[] ifaces = NetworkInterface.GetAllNetworkInterfaces();
            
            foreach(NetworkInterface iface in ifaces) {
                if (iface.NetworkInterfaceType == Microsoft.SPOT.Net.NetworkInformation.NetworkInterfaceType.Wireless80211)
                {
                    wifi_network_iface = iface;
                    break;
                }
            }

            Debug.Print("Break point");

            if (wifi_network_iface == null)
            {
                Debug.Print("No wireless interface available");
                return;
            }
            else
            {
                Debug.Print("Found a wireless interface");
                Debug.Print(wifi_network_iface.ToString());
            }


            //Debug.Print(new Gadgeteer.Interfaces.SPI());
            //NetworkInterfaceExtension.AssignNetworkingStackTo(new WiFiRS9110(new Microsoft.SPOT.Hardware.SPI.SPI_module);

            //Debug.Print(GHI.Premium.Net.WiFiRS9110.AssignedNetworkInterface);
            //wifi_RS21.Interface.StartAdHocHost("PM_DC1", SecurityMode.WPA2, "testing", 4);
            //WiFiNetworkInfo nif = new WiFiNetworkInfo(0, SecurityMode.WPA2, "ig ad hoc", NetworkType.AdHoc);
            // wifi.Interface.StartAdHocHost("PM_DC1", SecurityMode.WPA2, "testing", 4);

            /*
            Thread.Sleep(500);
            WiFiNetworkInfo[] networks = wifi.Interface.Scan();
            foreach(WiFiNetworkInfo network in networks) {
                Debug.Print("Physical Address: " + network.PhysicalAddress.ToString());
                Debug.Print("Network Type : " + network.networkType.ToString());
                Debug.Print("Channel No : " + network.ChannelNumber.ToString());
                Debug.Print("SSID : " + network.SSID);
            }*/

        }

    }
}

and two pictures:
One is my hardware layout
the other is my debugging session (showing the closest I have gotten to enabling the wireless capabilities) as well as the assemblies I have included


#2

That answers my question. Thank you, it would have taken me forever to figure out those arguments. I knew I should have asked for help.
It is so very much appreciated!

You have no idea how happy I was to see the green light on the wifi chip light up.