Ok. But, I was told that the Panda II is only 4.1
Correct, and 4.2 SDK supports 4.1 GHI Electronics – Where Hardware Meets Software
JKane, open the GHI 4.1 directory in your program files folder, find the SDK’s readme file, and check the version number of the USBizi referenced in there. Then make sure explicitly that MFDeploy shows the same version in device capabilities.
Yeah, it says 4.1.8.0 is require and under device capabilities 4.1.8.0 is shown. So, I’m at a loss… I’m going to keep trying to mess around
Thanks for the help though
Ok, one step closer! I got the debugger to run without the a3000000 error.
I am trying to use the example that will wait till a byte is received then it prints back some string telling you what you have typed in (transmitted). But, no luck through TeraTerm. I have the baud rate set to 115200 and I have tried swapping RX and TX just incase, but still nothing.
Any thoughts?
show us your FULL current code (or drop a project file somewhere). I have a Panda and a USB-TTL device I’ll test on for you.
Straight from the Example in the Serial to PC Tutorial:
using System.Threading;
using System.IO.Ports;
using System.Text;
namespace MFConsoleApplication1
{
public class Program
{
public static void Main()
{
SerialPort UART = new SerialPort("COM1", 115200);
int read_count = 0;
byte[] rx_byte = new byte[1];
UART.Open();
while (true)
{
// read one byte
read_count = UART.Read(rx_byte, 0, 1);
if (read_count > 0)// do we have data?
{
// create a string
string counter_string =
"You typed: " + rx_byte[0].ToString() + "\r\n";
// convert the string to bytes
byte[] buffer = Encoding.UTF8.GetBytes(counter_string);
// send the bytes on the serial port
UART.Write(buffer, 0, buffer.Length);
//wait...
Thread.Sleep(10);
}
}
}
}
}
OK, so here’s the background and here’s what I did.
I have only the 4.1 SDK and Gadgeteer SDK installed; I do not have the 4.2 SDKs. My device is running the matched firmware for my SDK version.
I Opened Visual Studio
Create new project
Select Panda console app
Opened the program.cs
added the following USINGs
using System;
using System.Threading;
using System.IO;
using System.IO.Ports;
using System.Text;
using Microsoft.SPOT;
using Microsoft.SPOT.IO;
using Microsoft.SPOT.Hardware;
using GHIElectronics.NETMF.FEZ;
using GHIElectronics.NETMF.IO;
using GHIElectronics.NETMF;
Added the following code in MAIN()
SerialPort UART = new SerialPort("COM1", 115200);
int read_count = 0;
byte[] rx_byte = new byte[1];
UART.Open();
// Blink board LED
bool ledState = false;
OutputPort led = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.LED, ledState);
while (true)
{
// Sleep for 500 milliseconds
Thread.Sleep(100);
// toggle LED state
ledState = !ledState;
led.Write(ledState);
// read one byte
read_count = UART.Read(rx_byte, 0, 1);
if (read_count > 0)// do we have data?
{
// create a string
string counter_string =
"You typed: " + rx_byte[0].ToString() + "\r\n";
// convert the string to bytes
byte[] buffer = Encoding.UTF8.GetBytes(counter_string);
// send the bytes on the serial port
UART.Write(buffer, 0, buffer.Length);
Debug.Print("Got character " + (char)rx_byte[0]);
//wait...
Thread.Sleep(10);
}
}
I have the following references added to my project:
FEZPanda_GHIElectronics.NETMF.FEZ
GHIElectronics.NETMF.IO
Microsoft.SPOT.Hardware
Microsoft.SPOT.Hardware.SerialPort
Microsoft.SPOT.IO
Microsoft.SPOT.Native
mscorlib
System.IO
Then, I connected my CP2102 USB to TTL UART device to COM1 on the Panda, with the GND of the Panda linked to the GND of the CP2102.
Then I deployed the code.
I then opened Tera Term. I then connected to the PC’s serial port that the CP2102 creates (COM9 in my case). I then set up the serial port to 115200 N81. I then started typing in TeraTerm. Here’s what I got:
(from Visual Studio Output window)
The thread ‘’ (0x2) has exited with code 0 (0x0).
Got character q
Got character w
Got character e
Got character r
Got character t
Got character y
(from TeraTerm window)
You typed: 113
You typed: 119
You typed: 101
You typed: 114
You typed: 116
You typed: 121
Worked first time. Well actually it didn’t but I did go with the UART Dyslexia approach of random choice of two wires that I then had to swap
So, there’s a working repro that uses your code as a basis to work. Can you please try the same new project approach and see if you can get anywhere?
And here is where I go back to page one of the story thus far on your efforts. Let me just be clear on how you have all this connected up. You have a UART (TTL) to RS232 device. The UART TTL end is connected to Fez. Then you have a RS232 to USB device. The two RS232 ends are connected together, and the USB is connected to the PC.
Let me ask this - do you KNOW that the GNDs are connected all the way along the chain? And also, do you know that on their own these devices do work? Do you have anything that you can connect to the RS232 <–> USB device and make sure you have the PC driver set up and working ok and TeraTerm working?
Here’s a $3 tip. Go to eBay and buy a CP2102 (or three, they’re handy). Here’s one I looked at earlier. http://www.ebay.com.au/itm/USB-2-0-UART-TTL-6PIN-Connector-Module-Serial-Converter-CP2102-New-/280776534912?pt=LH_DefaultDomain_15&hash=item415f95eb80
It worked!! I can’t thank you enough Brett!
The only thing different, is that, in my output window in Visual studio I am getting the correct “Got character” for every letter I type in TeraTerm, but in the TeraTerm output window I am getting gibberish; I am getting a bunch of symbols. I’m not getting what you stated how it outputted “You Typed” ###
Is this a setting in TeraTerm to correct this?
Edit: Reset everything and now in the TeraTerm window I am getting random spacing. No letters or symbols, just spacing. Output in VS is still correct
And yes I do know my setup works. I tested to make sure on another Dev kit from mBed.
garbled characters is a baud rate mismatch most likely. Go back to a slower, known baud rate (9600 is tera term’s default, probably a good idea to try that to start with). Your description totally matches a baud rate issue.
Got it! Awesome, Thanks for the help again!
sweet !