Dear all !
I really need your help. i try to do a project with G120HDR connected with cellular radio.
And i use the display TE35 touchscreen as a button
when i run the code, there is no error . the display shows the button i want , but the cellular doesn’t work, when i touch the button it shows error in the output window. i use the cellular radio on socket 6 and display T on socket 4
And i connect pins as follow
socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(6);
socket.SupportedTypes = new[] {‘K’};
socket.CpuPins[3] = Pin.P1_7;
socket.CpuPins[4] = Pin.P2_0;
socket.CpuPins[5] = Pin.P0_16;
socket.CpuPins[6] = Pin.P0_6;
socket.CpuPins[7] = Pin.P0_17;
socket.CpuPins[8] = Pin.GPIO_NONE;
socket.CpuPins[9] = Pin.GPIO_NONE;
socket.SerialPortName = “COM2”;
// S
socket.SPIModule = SPI.SPI_module.SPI2;
// X
socket.NativeI2CWriteRead = nativeI2C;
GT.Socket.SocketInterfaces.RegisterSocket(socket);
#endregion Socket 6
#endregion Socket Setup
this is my code i download it with the cellular driver TCPcellular radio
using Gadgeteer.Modules.GHIElectronics;
using Gadgeteer.Modules.Mekalogic;
using Microsoft.SPOT;
using Microsoft.SPOT.Input;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;
using System;
using System.Threading;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
namespace CellularRadioTest
{
public partial class Program
{
CellularRadio cellularRadio = new CellularRadio(6);
void ProgramStarted()
{
Debug.Print("Program Started gugughghugh");
SetupWindow();
// cellularRadio = new GTM.Seeed.CellularRadio(6);
cellularRadio.DebugPrintEnabled = true;
cellularRadio.PowerOn(5);
//button.ButtonPressed += new Button.ButtonEventHandler(button_ButtonPressed);
// button.TurnLEDOff();
//resetButton.ButtonPressed += new Button.ButtonEventHandler(resetButton_ButtonPressed);
//cellularRadio.PINStateReceived += new CellularRadio.PINStateReceivedHandler(cellularRadio_PINEvent);
//cellularRadio.NetworkRegistrationReceived += new CellularRadio.NetworkRegistrationReceivedHandler(cellularRadio_NetworkRegistrationEvent);
cellularRadio.SmsReceived += new CellularRadio.SmsReceivedHandler(cellularRadio_NewSMSEvent);
//cellularRadio.IncomingCall += new CellularRadio.IncomingCallHandler(cellularRadio_IncomingCall);
cellularRadio.SmsRetrieved += new CellularRadio.SmsRetrievedHandler(cellularRadio_SMSReady);
//cellularRadio.PhoneActivityReceived += new CellularRadio.PhoneActivityReceivedHandler(cellularRadio_PhoneActivityReady);
//cellularRadio.ContactOpen += new CellularRadio.ContactOpenHandler(cellularRadio_ContactReady);
//cellularRadio.ClockReceived += new CellularRadio.ClockReceivedHandler(cellularRadio_ClockReady);
//cellularRadio.SignalStrengthReceived += new CellularRadio.SignalStrengthReceivedHandler(cellularRadio_SignalStrengthReady);
//cellularRadio.OperatorReceived += new CellularRadio.OperatorReceivedHandler(cellularRadio_OperatorReady);
//cellularRadio.SMSListReceived += new CellularRadio.SMSListReceivedHandler(cellularRadio_SMSListReady);
//cellularRadio.ConnectedLineEvent += new CellularRadio.ConnectedLineEventHandler(cellularRadio_ConnectedLineEvent);
//cellularRadio.NoCarrier += new CellularRadio.NoCarrierHandler(cellularRadio_NoCarrierEvent);
cellularRadio.ModuleInitialized += new CellularRadio.ModuleInitializedHandler(cellularRadio_ModuleInitialized);
}
private Bitmap normalButton;
private Bitmap pressedButton;
private Image imgButton;
private Text txtMessage;
private void SetupWindow()
{
Font baseFont = Resources.GetFont(Resources.FontResources.NinaB);
// Bitmap normalButton = new Bitmap(Resources.GetBytes(Resources.BinaryResources.NormalButton), Bitmap.BitmapImageType.Jpeg);
// Bitmap pressedButton = new Bitmap(Resources.GetBytes(Resources.BinaryResources.PressedButton), Bitmap.BitmapImageType.Jpeg);
normalButton = Resources.GetBitmap(Resources.BitmapResources.NormalButton);
pressedButton = Resources.GetBitmap(Resources.BitmapResources.PressedButton);
Window window = displayTE35.WPFWindow;
Canvas canvas = new Canvas();
window.Child = canvas;
imgButton = new Image(normalButton);
imgButton.TouchDown += new TouchEventHandler(imgButton_TouchDown);
imgButton.TouchUp += new TouchEventHandler(imgButton_TouchUp);
canvas.Children.Add(imgButton);
Canvas.SetTop(imgButton, 50);
Canvas.SetLeft(imgButton, 90);
txtMessage = new Text(baseFont, "Press the botton to send SMS");
canvas.Children.Add(txtMessage);
Canvas.SetTop(txtMessage, 200);
Canvas.SetLeft(txtMessage, 90);
}
private void imgButton_TouchUp(object sender, TouchEventArgs e)
{
imgButton.Bitmap = normalButton;
txtMessage.TextContent = "Press the botton to send SMS";
}
void cellularRadio_ModuleInitialized(CellularRadio sender)
{
Debug.Print("MODULE INITIALIZED");
}
void cellularRadio_NoCarrierEvent(CellularRadio sender)
{
Debug.Print("NO CARRIER EVENT");
}
void cellularRadio_ConnectedLineEvent(CellularRadio sender, string number)
{
Debug.Print("CONNECTED: " + number);
}
void cellularRadio_SMSListReady(CellularRadio sender, System.Collections.ArrayList smsList)
{
if (smsList != null)
{
Debug.Print("SMS LIST");
foreach (GTM.Seeed.CellularRadio.Sms message in smsList)
{
Debug.Print("FROM: " + message.TelephoneNumber);
Debug.Print("MSG: " + message.TextMessage);
Debug.Print("WHEN: " + message.Timestamp);
Debug.Print("STATUS: " + message.Status + "\n");
Debug.Print("POS:" + message.Index);
}
}
}
void cellularRadio_OperatorReady(CellularRadio sender, string operatorName)
{
if (operatorName != null)
Debug.Print("OPERATOR: " + operatorName);
else
Debug.Print("NO OPERATOR WAS FOUND");
}
void cellularRadio_SignalStrengthReady(CellularRadio sender, CellularRadio.SignalStrengthType signalStrength)
{
Debug.Print("SIGNAL STRENGTH: " + signalStrength);
}
void cellularRadio_ClockReady(CellularRadio sender, DateTime clock)
{
Debug.Print("CLOCK: " + clock.ToString("r"));
}
void cellularRadio_ContactReady(CellularRadio sender, CellularRadio.Contact contact)
{
Debug.Print("NAME: " + contact.name);
Debug.Print("TEL: " + contact.telephoneNumber);
}
void cellularRadio_PhoneActivityReady(CellularRadio sender, CellularRadio.PhoneActivityType activity)
{
Debug.Print("Phone Activtiy: " + activity);
}
// void resetButton_ButtonPressed(Button sender, Button.ButtonState state)
// {
// if (cellularRadio.SendSms("1591919220", "HELLO") != GTM.Seeed.CellularRadio.ReturnedState.OK)
// {
// Debug.Print("Retrieve clock failed");
// }
// }
void cellularRadio_SMSReady(CellularRadio sender, CellularRadio.Sms message)
{
if (message != null)
{
Debug.Print("RETRIEVED");
Debug.Print("FROM: " + message.TelephoneNumber);
Debug.Print("MSG: " + message.TextMessage);
Debug.Print("WHEN: " + message.Timestamp);
Debug.Print("STATUS: " + message.Status);
Debug.Print("POS:" + message.Index);
}
}
void cellularRadio_IncomingCall(CellularRadio sender, string caller)
{
Debug.Print("NEW CALL: " + caller);
}
void cellularRadio_NewSMSEvent(CellularRadio sender, CellularRadio.Sms message)
{
if (message != null)
{
Debug.Print("NEW SMS");
Debug.Print("FROM: " + message.TelephoneNumber);
Debug.Print("MSG: " + message.TextMessage);
Debug.Print("WHEN: " + message.Timestamp);
Debug.Print("STATUS: " + message.Status);
Debug.Print("POS:" + message.Index);
}
}
void cellularRadio_NetworkRegistrationEvent(CellularRadio sender, CellularRadio.NetworkRegistrationState networkState)
{
Debug.Print("NETWORK EVENT " + networkState);
}
void imgButton_TouchDown(object sender, TouchEventArgs e)
{
Debug.Print("BUTTON BEGIN");
imgButton.Bitmap
```cs][code=cs]=
pressedBu[/code
tton;
txtMessage.TextContent = “SMS is send”;
* SMS Test
*/
cellularRadio.SendSms("393272843093", "HELLO");
Debug.Print("BUTTON END");
}
void cellularRadio_PINEvent(CellularRadio sender, CellularRadio.PINState pinState)
{
Debug.Print("PIN: " + pinState);
}
}
}
Here is the output. and i don't know what is wrong.
Found debugger!
Create TS.
Loading start at a0e85838, end a0e9cf94
Assembly: mscorlib (4.2.0.0) Assembly: Microsoft.SPOT.Native (4.2.0.0) Assembly: Microsoft.SPOT.Hardware (4.2.0.0)
Assembly: Microsoft.SPOT.Hardware.PWM (4.2.0.1) Assembly: Microsoft.SPOT.Security.PKCS11 (4.2.0.0)
Assembly: System.Security (4.2.0.0) Loading Deployment Assemblies.
Attaching deployed file.
Assembly: Microsoft.SPOT.IO (4.2.0.0) Attaching deployed file.
Assembly: Microsoft.SPOT.Hardware.SerialPort (4.2.0.0) Attaching deployed file.
Assembly: Gadgeteer (2.42.0.0) Attaching deployed file.
Assembly: GTM.GHIElectronics.DisplayTE35 (4.2.107.0) Attaching deployed file.
Assembly: System.IO (4.2.0.0) Attaching deployed file.
Assembly: Microsoft.SPOT.Net.Security (4.2.0.0) Attaching deployed file.
Assembly: Microsoft.SPOT.Touch (4.2.0.0) Attaching deployed file.
Assembly: GTM.Seeed.CellularRadio (1.6.0.0) Attaching deployed file.
Assembly: System (4.2.0.0) Attaching deployed file.
Assembly: Microsoft.SPOT.Graphics (4.2.0.0) Attaching deployed file.
Assembly: System.Net.Security (4.2.0.0) Attaching deployed file.
Assembly: Microsoft.SPOT.TinyCore (4.2.0.0) Attaching deployed file.
Assembly: CellularRadioTest (1.0.0.0) Attaching deployed file.
Assembly: GTM.Mekalogic.CellularRadio (1.1.0.0) Attaching deployed file.
Assembly: System.Http (4.2.0.0) Attaching deployed file.
Assembly: Microsoft.SPOT.Net (4.2.0.0) Attaching deployed file.
Assembly: Gadgeteer.Serial (2.42.0.0) Attaching deployed file.
Assembly: GHI.Premium.Hardware (4.2.11.1) Attaching deployed file.
Assembly: GHI.Premium.System (4.2.11.1) Attaching deployed file.
Assembly: MCormier.Gadgeteer.G120HDR (1.0.5.0) Resolving.
GC: 1msec 557556 bytes used, 6782112 bytes available
Type 0F (STRING ): 24 bytes
Type 15 (FREEBLOCK ): 6782112 bytes
Type 17 (ASSEMBLY ): 36168 bytes
Type 1E (BINARY_BLOB_HEAD ): 520860 bytes
Type 28 (MEMORY_STREAM_HEAD ): 36 bytes
Type 29 (MEMORY_STREAM_DATA ): 396 bytes
Type 34 (APPDOMAIN_HEAD ): 72 bytes
GC: performing heap compaction...
The debugging target runtime is loading the application assemblies and starting execution.
Ready.
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\mscorlib.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.Native.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.Hardware.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.Hardware.PWM.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.Security.PKCS11.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\System.Security.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.IO.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.Hardware.SerialPort.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.Graphics.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.TinyCore.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.Net.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\System.IO.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Gadgeteer\Core\Assemblies\.NET Micro Framework 4.2\le\Gadgeteer.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.Touch.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files (x86)\GHI Electronics\GHI .NET Gadgeteer SDK\Modules\DisplayTE35\NETMF 4.2\le\GTM.GHIElectronics.DisplayTE35.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.Net.Security.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Users\ASUS PC\Desktop\tcpcellularradio_5f9fd7c69bf7\CellularRadio\CellularRadio_42\bin\Debug\le\..\Gadgeteer.Serial.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files (x86)\Seeed\Seeed .NET Gadgeteer SDK\Modules\CellularRadio\NETMF 4.2\le\GTM.Seeed.CellularRadio.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\System.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\System.Net.Security.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Users\ASUS PC\Desktop\G120HDR\G120HDR\G120HDR_42\bin\Debug\le\..\GHI.Premium.System.dll'
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Users\ASUS PC\Desktop\G120HDR\G120HDR\G120HDR_42\bin\Debug\le\..\GHI.Premium.Hardware.dll'
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Users\ASUS PC\Desktop\G120HDR\G120HDR\G120HDR_42\bin\Debug\le\MCormier.Gadgeteer.G120HDR.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Users\ASUS PC\Desktop\tcpcellularradio_5f9fd7c69bf7\CellularRadio\CellularRadio_42\bin\Debug\le\GTM.Mekalogic.CellularRadio.dll', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Users\ASUS PC\Desktop\tcpcellularradio_5f9fd7c69bf7\CellularRadioTest\bin\Debug\le\CellularRadioTest.exe', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\System.Http.dll', Symbols loaded.
The thread '<No Name>' (0x2) has exited with code 0 (0x0).
Warning: socket 5 is not compliant with Gadgeteer : Cpu pin 3 must be specified for socket of type D
Warning: socket 5 is not compliant with Gadgeteer : Cpu pin 6 must be specified for socket of type D
Warning: socket 5 is not compliant with Gadgeteer : Cpu pin 7 must be specified for socket of type D
Using mainboard GHI Electronics G120HDR version 2.0
Program Started gugughghugh
CellularRadio : Turning ON
CellularRadio : Turning module on
CellularRadio : SENT: AT
CellularRadio : SENT: AT+CMGF=1
The thread '<No Name>' (0x4) has exited with code 0 (0x0).
CellularRadio : SENT: AT+CSDH=0
CellularRadio : SENT: AT+CPBS="SM"
CellularRadio : SENT: AT+CPMS="SM"
CellularRadio : SENT: AT+CNMI=2,1,0,1,0
CellularRadio : SENT: AT+COLP=1
CellularRadio : SENT: AT+CGREG=1
CellularRadio : SENT: AT+CREG=1
The thread '<No Name>' (0x5) has exited with code 0 (0x0).
BUTTON BEGIN
CellularRadio : <AT+CMGS="+393272843093"
ERROR
HELLO>
BUTTON END
CellularRadio : <
>