Hello All,
I’ve bought a couple of weeks ago my first Netduino Board together with an adafruit fona 808 shield to begin a little Geo Location Project.
During those weeks I’ve discovered a lot of subtle things such as the pinout issues with the shield and it’s default 5V TTL configuration.
Fortunately, the guys at adafruit designed the board to be completely compatible with Arduino and other microcontrollers that doesn’t work on 5V TTL. So I’ve soldered the 3V jumper and hardwired the TX pin of the shield with the RX pin of COM2 port on the netduino and vice-versa:
From there I’ve plugged the shield into the netduino headers and tried following code:
public static void Main(){
SerialPort COMport = new SerialPort(SerialPorts.COM2,(int)BaudRate.Baudrate4800,Parity.None,8,StopBits.One);
COMport.DataReceived += SerialPort_DataReceived;
COMport.Open();
byte[] input_buffer = UTF8Encoding.UTF8.GetBytes("ATI");
COMport.Write(input_buffer, 0, input_buffer.Length);
}
private static void SerialPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
SerialPort port = (SerialPort)sender;
byte[] buffer = new byte[port.BytesToRead];
port.Read(buffer, 0, buffer.Length);
// print out our received data
Debug.Print(new String(System.Text.Encoding.UTF8.GetChars(buffer)));
}
According to the Adafruit library written in C for Arduino (available here: https://github.com/adafruit/Adafruit_FONA), the ATI command should respond with an OK message and eventually the version of the Chipset built into the FONA.
Unfortunately the only response I get in the DataReceived Event handler is ATI.
The thread '<No Name>' (0x2) has exited with code 0 (0x0).
ATI
The thread '<No Name>' (0x1) has exited with code 0 (0x0).
Done.
Waiting for debug commands...
The program '[18] Micro Framework application: Managed' has exited with code 0 (0x0).
So my question is obvious, What am I doing wrong?
In the debug window I’ve also noticed that there is a thread (no name) (0x2) which has completed without any error. What is that thread?
Thanks in advance for your suggestions.
Kind regards
Alain