Cobra II Serial Comm Problem

I am having an issue using the RS232 (UART) port on the Cobra II board.

I have the little GHI RS 232 module board plugged in to the exposed port connector 5 on the main Cobra II board.

I tried to access another third party board through the serial port, the program ran, but no response. I backed off and tried just to talk to a laptop running a putty serial port. The putty port was set to 115200 baud as was the Cobra II port. I used the program from one of the GHI web pages (see below). The program runs, and counts, but I get no response from typing in the putty window, and nothing ever gets displayed in the putty window.

The Code:

using Microsoft.SPOT;
using System.IO.Ports;
using System.Text;
using System.Threading;

public class Program
     public static void Main()
         SerialPort UART = new SerialPort("COM1", 115200);
         int counter = 0;
         while (true)
             // create a string
             string counter_string = "Count: " + counter.ToString() +
             // convert the string to bytes
             byte[] buffer = Encoding.UTF8.GetBytes(counter_string);
             // send the bytes on the serial port
             Debug.Print(new string(UTF8Encoding.UTF8.GetChars(buffer)));
             UART.Write(buffer, 0, buffer.Length);
             // increment the counter;

you might need a null modem cable. Google RS232 DTE and DCE.

Hi again Dan

Good to hear your deployment woes are behind you :slight_smile:

I always recommend getting a few of the CP2102 USB-TTL UART devices from ebay for testing this kind of thing, allows you to extricate yourself from cables, converters, and other such things for your testing…

Can you also confirm what your comment “and counts” means ? Does that mean it sends data and you can see it on the PC? If so, then that is GOOD. The fact that you typing in the terminal window goes nowhere makes sense since you never appear to read the serial port in your code !

And I think Mike has hit the reason on the head about why your comms to the other device isn’t working; you need to swap TX/RX

Thanks for all the help guys.

Hi Mike,

I was thinking the same thing, so I called a friend to borrow his break out box. I didn’t want to tear apart the only cable that I have right now. He’s also getting me alligator clamps etc.

I’ll let you know how it works out after tomorrow.

Hi Brett,

The GHI program spits out a message, waits, increments a count, then spits out another message with the updated count. Strictly a write operation.

@ dnoble -

You can do a quick test by connect Pin4 and pin5 (TX and RX) together. If you see data shown in your VS2012 debugger, at least UART in FEZ CorbaII works fine. The rest will be cable or your “putty window”.

Your code should be changed a bit to handle received data if do this test.


It was lines 2 and 3, and I was able to swap the lines and get putty to see what I was sending. Break out box was awesome.

Now that I see talking, I have some listening to do.

Thanks guys.

This is definitely a very helpful form.

After I got back to tying the Cobra II board with a third party Bluetooth board, I realized that the Cobra seems to tie the RTS line low, even when I have the code set the RTS line

_btSerialPort.Handshake = Handshake.RequestToSend;

Any thoughts? I got the communication to work, by breaking the link, and tying the RTS line on the DCE side to the CTS line.

I’ve noticed several questions on the handshaking of some of the GHI boards, but they were all from 2013.

Hi Dan,

how are you connecting to COM1 ? And in particular, how are you connecting to RTS and CTS? I suspect you’ll always have problems with COM1 because I can’t seem to find CTS for COM1 on the schematic; I can find P2.7 (on the LCD R socket) is RTS1, but there’s no sign of CTS1. Even searching the G120 manual doesn’t show a COM1 CTS.

Thank you Brett.

Shows how dangerous assuming things can be. I have the extension for the board to turn it into a serial port and just assumed it was good.

So com2 is the only serial port that would have handshaking available? Does the cobra board allow configuring so that you can run more than one serial port?

if you have the RS232 module, then you have a U or K socket module. That means, when you plug it into a U socket it has no CTS/RTS connection, but if you plug it into a K socket you will. Socket 5 on the Cobra2 is U only. So to wire this up to a K “socket” you’ll need to do wiring. Not simple, but certainly far from impossible. Do you have an extender module or breakout module ? You’d jumper the wires from the edge connection header over to the breakout board, and then plug your RS232 module into that.

Looking at the schematic, it seems only COM2 has flow control; GHI may be able to say whether there are some other pins not documented on the schematic for other serial ports. Otherwise there are multiple serial ports that are all accessible, but are just RX/TX only.

Can I ask what your attached device is that requires RS232 with flow control ?