I know nothing about this module, but to diagnose it I would suspect you need to show us the code in cellularRadio_ModuleInitialized(). Can you make sure you add a debug.print in the top of that so you know it gets hit, and it’s probably worth putting a breakpoint there and stepping into it - I am assuming that this is the code that’s generating the exception rather than the driver, but that obviously could be wrong.
using Gadgeteer.Modules.GHIElectronics;
using GHI.Networking;
using Microsoft.SPOT;
using Microsoft.SPOT.Net.NetworkInformation;
using System.Net;
using System.Text;
using System.Threading;
using Gadgeteer.Modules.GHIElectronics;
namespace SampleCellRadio
{
public partial class Program
{
void ProgramStarted()
{
NetworkChange.NetworkAvailabilityChanged += (a, b) => Debug.Print("Network availability changed: " + b.IsAvailable.ToString());
NetworkChange.NetworkAddressChanged += (a, b) => Debug.Print("Network address changed");
this.cellularRadio.ModuleInitialized += this.cellularRadio_ModuleInitialized;
this.cellularRadio.PowerOn(30);
}
void cellularRadio_ModuleInitialized(CellularRadio sender)
{
new Thread(() =>
{
Thread.Sleep(15000);
this.cellularRadio.UseThisNetworkInterface("internet.movistar.com.co", "movistar", "movistar", PPPSerialModem.AuthenticationType.Pap);
while (this.cellularRadio.NetworkInterface.IPAddress == "0.0.0.0")
{
Debug.Print("Waiting on DHCP");
Thread.Sleep(250);
}
Debug.Print(cellularRadio.NetworkInterface.IPAddress);
using (var req = HttpWebRequest.Create("http://www.ghielectronics.com/") as HttpWebRequest)
{
req.KeepAlive = false;
req.ContentLength = 0;
using (var res = req.GetResponse() as HttpWebResponse)
{
using (var stream = res.GetResponseStream())
{
int read = 0, total = 0;
var buffer = new byte[1024];
do
{
read = stream.Read(buffer, 0, buffer.Length);
total += read;
Thread.Sleep(20);
} while (read != 0);
Debug.Print(new string(Encoding.UTF8.GetChars(buffer)));
}
}
}
}).Start();
}
}
}
Actually it was published at the CellRadio GHIElectronics site.