Help with setting up serial communication on FEZCerbuinoBee

So your trying to do this?

Only possible issue i see is that the Cell module requires a K socket which by the looks of it Cerb’s do not support.

It may still work but i have never used one so i dont know for sure. I’m sure someone will know.

Hi Justin,
That is the idea. I added an image to better elaborate this.

According to the link here:
The FEZ Cerbuino does support ‘K’ type sockets. Is this a typo?


It appears that the K sockets on Cerbs are not supported in the firmware

Hi Justin,

This is both sad and frustrating because it clearly says 2x on the website that the FEZ Cerbuino Bee supports the K socket type (handshaking image attached for details):open_mouth: :-[ :wall: Someone needs to have a serious discussion with the GHI Marketing team that put together this website because if it is indeed true then the website was flatly wrong and money (and time) was wasted due to these inaccuracies

but that won’t fix the problem…what I need is some firmware that supports handshaking… Since this seems to be a firmware issue are there instructions on how to recompile this firmware with this option enabled , the firmware source code or some beta version we could test?

there is a community firmware thread here where you can use GCC to compile Cerb family firmware, but I don’t know if that exposes flow control either. Next you’d need to make sure the Gadgeteer definition for the cerb-bee exposed this as a K module.

GHI will be along in the new year to comment on the status of K on the firmware, I feel sure…

1 Like

Ok…I’ll wait for GHI to comment…I guess we all need a break sometimes. I’ll be ready when they get back though…

I thought we added hand shaking in an earlier release! Not to worry this is on our list now for the future.


@ Gus - I think you should have your guys test this, because I just did a test and I believe it is working. I have my CerbuinoBee sending data to my Spider using a makeshift null modem adapter with CTS/RTS wired and things are working as expected.

If I enable hardware handshaking on the spider and not on the cerbuino then I get no data, as soon as I enable handshaking on both or disable it on both then things work…

;D I appreciate all the input to get to this point so far!
Two open questions exist:

However…My USB-Serial module: arrived yesterday. There are some things missing in the Developers guide:, mainly that the ‘socket’ needs to be assigned:

Here I have documented my specific solution for the FEZCerbuino Bee.  I attached the serial module to socket 1. This program echos what is sent to it over the serial line and it also prints the date, time and a short message. (see the screen shot)

Here is my assembly data:
[quote]Create TS.

 Loading start at 8062c94, end 808d014

   Assembly: mscorlib (     Assembly: Microsoft.SPOT.Native (     Assembly: Microsoft.SPOT.Hardware (  
   Assembly: Microsoft.SPOT.Graphics (     Assembly: Microsoft.SPOT.TinyCore (  
   Assembly: Microsoft.SPOT.Hardware.SerialPort (     Assembly: Microsoft.SPOT.IO (  
   Assembly: System.IO (     Assembly: Microsoft.SPOT.Hardware.OneWire (  
   Assembly: Microsoft.SPOT.Hardware.Usb (     Assembly: System.Xml (  
   Assembly: Microsoft.SPOT.Hardware.PWM (     Assembly: Microsoft.SPOT.Net (  
   Assembly: System (  Loading Deployment Assemblies.

Attaching deployed file.

   Assembly: GHIElectronics.Gadgeteer.FEZCerbuinoBee (  Attaching deployed file.

   Assembly: Gadgeteer (  Attaching deployed file.

   Assembly: GHI.OSHW.Hardware (  Attaching deployed file.

   Assembly: Gadgeteer.Serial (  Attaching deployed file.

   Assembly: GTM.GHIElectronics.UsbSerial (  Attaching deployed file.

   Assembly: GadgeteerApp10 (  Resolving.[/quote]

Here is the script:

using System;
using System.Collections;
using System.Threading;
using System.Text;

using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Presentation.Shapes;
using Microsoft.SPOT.Touch;

using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
using Gadgeteer.Interfaces;
using Gadgeteer.Networking;
using Gadgeteer.Modules.GHIElectronics;

namespace GadgeteerApp10
    public partial class Program
        //This command is VERY important. It assigns the port that the module is physically attached to. Without this you will see a system.nullexception error.
        UsbSerial usbSerial = new UsbSerial(1);
        bool state = false;
        // This method is run when the mainboard is powered up or reset.   
        void ProgramStarted()
            // initialize the loop timer
            GT.Timer timer = new GT.Timer(500);

            //set the interrupt
            timer.Tick += new GT.Timer.TickEventHandler(timer_Tick);

            try //both usbSerial.Configure and usbSerial.Open()have different exceptions but it is rare that they will triggered in this specific code
                //configure the usbSerial port
                usbSerial.Configure(115200, GT.Interfaces.Serial.SerialParity.None, GT.Interfaces.Serial.SerialStopBits.One, 8);
                //if the port is not open then open it
                if (!usbSerial.SerialLine.IsOpen)
            catch (Exception e) //Catch any exceptions
                Debug.Print(e.ToString()); //print the error to the debug ouput 
            timer.Start();    //start the timer loop        

        //this method is the main loop for the process
        void timer_Tick(GT.Timer timer)
            //this event handeler 
            usbSerial.SerialLine.DataReceived += new GT.Interfaces.Serial.DataReceivedEventHandler(SerialLine_DataReceived);
            //toggle the LED
            state = !state;
            /*Announce that the comm port is working*/
            //Text to write to the com port
            byte[] openingStatement = Encoding.UTF8.GetBytes("\n\rComm is working\n\r"); //some text
            byte[] buffer = Encoding.UTF8.GetBytes(DateTime.Now.ToString() + "\r\n"); //the time and date
            //preform the write
            usbSerial.SerialLine.Write(openingStatement, 0, openingStatement.Length);
            //preform the write
            usbSerial.SerialLine.Write(buffer, 0, buffer.Length); 
            usbSerial.SerialLine.Flush(); //flush the line out

        //This method echos the commands
        void SerialLine_DataReceived(GT.Interfaces.Serial sender, System.IO.Ports.SerialData data)
            state = !state;
            int NumberOfBytesToRead = usbSerial.SerialLine.BytesToRead;
            byte[] readInputBuffer = new byte[NumberOfBytesToRead+4]; //create a byte array the same lenght as the input
            char[] readInputchar = new char[NumberOfBytesToRead];
            usbSerial.SerialLine.Read(readInputBuffer, 0, NumberOfBytesToRead); //read the buffer into the byte array
            // From byte array to string. Add the character returns so it is readable when it echos
            readInputchar = Encoding.UTF8.GetChars(readInputBuffer, 0, readInputBuffer.Length);
            string s = "\r\n" + new string(readInputchar) + "\r\n";
            readInputBuffer = Encoding.UTF8.GetBytes(s); // add a return to the output
            //write to the serial line
            usbSerial.SerialLine.Write(readInputBuffer, 0, readInputBuffer.Length); 
            usbSerial.SerialLine.Flush(); //flush the line out

Actually, if you add it in the designer (as all good Gadgeteer apps do :wink: ) then you don’t need that. That is why it’s not documented - you should add modules in the designer, they will then auto-include the code necessary and the component libraries the module needs.

I see (and thought so too)… but for some reason it didn’t let me do this on the CerbuinoBee.

I can do it… what else did you have connected?

Assuming the tests I did today are correct, then yes the FEZ CerbuinoBee supports K socket functionality (handshaking).

1 Like

@ Brett

That is weird. I have the XBee plugged in but that does not show up in the config. My set up matches the one in the image you shared. I am using VS2012 on Windows 8. I wonder if either of those are the issue? Since it works just fine now i’m not going to worry about it too much until my GPRS module gets here.

I’m using VS2012 on Win8.1 (x64 machine). So no, unlikely to be related to that, but could be related to the SDK install ?


OK…so, in the program.gadgetter tab, where the FEZCerbuinoBee is pictured there is the ‘toolbox’ tab that is present on typical winForms applications. I had to drag the USB-Serial module into the work space :stuck_out_tongue: :open_mouth:

It works just fine now…

:slight_smile: that’s how you need to add all modules :slight_smile: :dance:

Chalk another one up to experience !