Main Site Documentation

Cerbuino bee / xbee usart problems


#1

Hi ,

I’ve got 2 Cerbuino bee sbc and 2 Xbee Pro :

   NETMF : V4.3    Firmware  : V4.3.6     TinyCLR  :V4.3.6

     -I can get a good communication between the two Xbee  ( XCTU Terminals) , Xbee mounted on Droids usb adaptators  .


     -With one Xbee on droids and one Xbee on Cerbuino ( result on VS2012 Debug Window) , all received chars are not recognisable , most of them are 0x0E

     -Direct cabling RX to  TX on the cerbuino Xbee pins , COM is good : Cerbuino understand itself

     -direct cabling an FTDI adaptator on the TX/RX and using TERATERM gives the same result 

I think there is a bug in the firmware that makes unworked COM to outside modules ( i didn’t try the Gadgeteer sockets) from the XBEE Pins on the Cerbuino .

Have you a solution to solve this problem ? return to old version of all ( NETMF / firmware / Tiny CLR) or putting my 2 Cerbuino in the garbage and buy another sbc ?

Thanks for any response that can help .


#2

so you have:

Cerb > Xbee | (wireless) | Xbee < Cerb

But the data Cerb to Cerb is garbled?
Try the following:

[ul]Run the serial ports dead slow 2400bps[/ul]
[ul]Connect Cerb to Cerb and verify they talk to each other[/ul]
[ul]Are you using the RTS and CTS pins? You should be. Serial is a very unreliable communication system (dispite what others here may thing, SPI is king in my book)[/ul]
[ul]Can you verify that the Xbee are talking to each other?[/ul]
[ul]Do you have a logic analzer to verify that the cables or crosstalk is not the problem[/ul]
[ul]If you suspect crosstalk, try to avoid sending and receiving at the same time[/ul]


#3

@ guillet -

Hi,
I used a Bluetooth Bee Module as well as RN-XV WiFi Module on the XBee Socket of cerbuino Bee. Both worked without problems. Hardware-FlowControl however is not supported on the XBee Socket of Cerbuino Bee (only on Gadgeteer Socket 2). The lack of Hardware-Flowcontrol should not be a problem if the baudrate is not to high (at least not below 115200 Bits/sec). However there is a known issue on the Cerbuino Bee with the serial port when additionally SPI (e.g. ENC 28 Ethernet) is used at the same time.

https://www.ghielectronics.com/community/forum/topic?id=16549&page=1


#4

Hi,
many thanks for your response , John Smith and Roschemi ; i tried yours ideas , but the problem is still here :

  -connecting my 2 Cerbuino with cross wires (RX TX)  and visalising the result on VS2012 debug window    =That's OK , the txo SBC can discuss themselves  without errors 

   -fall down the baudrate to 2400 and less , the result is always bad , 

I join a drawing of the tests i’ve made , i hope it 'll be comprhensible .

Best regards


#5

Sounds like there is a baud rate or some other configuration problem. Please post your code for initializing the serial port on the CBEE


#6

Hi ,

here is the code ,

using System;
using System.Collections;
using System.Threading;
using System.IO;
using System.IO.Ports;
using System.Text;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using Microsoft.SPOT.IO;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Presentation.Shapes;
using Microsoft.SPOT.Touch;

using Gadgeteer;
using Gadgeteer.Networking;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
//using GHI.Hardware;
//using GHI.Hardware.FEZCerb;
using GHIElectronics.Gadgeteer;

namespace GadgeteerApp8
{
public partial class Program
{
bool Is_LED_On = false;
public static SerialPort Xbee = null;

    void ProgramStarted()
    {
     
        GT.Timer timer_1s = new GT.Timer(1000); // every second (x ms)
       
      //  *******************************************************************************************/
        timer_1s.Tick += new GT.Timer.TickEventHandler(Timer_Tick1); timer_1s.Start();
        Communication();
       
        Debug.Print("Program Started");
    }

    private static void Xbee_DataReceived(object sender, SerialDataReceivedEventArgs e)
    {
        //Debug.Print("Receive");
          byte[] buffin = new byte[50];
          int read_count = Xbee.Read(buffin, 0, Xbee.BytesToRead);
          Debug.Print("Read =" + read_count);
          //String message = new String(Encoding.UTF8.GetChars(buffin));
          //message = "XBEE RECEIVE  =" + message;
         // Debug.Print("RECU=" + message);
          //envoi(message);

          StringBuilder Result = new StringBuilder(buffin.Length * 2);
          string HexAlphabet = "0123456789ABCDEF";

          foreach (byte B in buffin)
              {
              string toto = B.ToString();
              Debug.Print("toto= "+ toto);

                Result.Append(HexAlphabet[(int)(B >> 4)]);
                Result.Append(HexAlphabet[(int)(B & 0xF)]);
              }
         string message=Result.ToString();
         Debug.Print("RECU=" + message);
         Xbee.Flush();
      }

    void Timer_Tick1(GT.Timer timer) {
       // Debug.Print("+");
        Mainboard.SetDebugLED(!Is_LED_On);
        Is_LED_On = !Is_LED_On;
        //envoi("1");
    }

    void Communication()
    {
        Xbee = new SerialPort("COM1", 57600, Parity.None, 8, StopBits.One);
        Thread.Sleep(200);
        Xbee.DataReceived += new SerialDataReceivedEventHandler(Xbee_DataReceived);
        Xbee.DiscardInBuffer();
        Xbee.Open();
        Debug.Print("COM Init");
    }

    public static void envoi(string message)
    {
        Byte[] tx_data = Encoding.UTF8.GetBytes(message);
        Debug.Print("Message=" + message);

        Xbee.Write(tx_data, 0, tx_data.Length);
        Thread.Sleep(200);
        Xbee.Flush();
       Xbee.DiscardOutBuffer();
    }
}

}

As you can see , nothing special !

Bye


#7

hi ,

OK , i red the error : 57600 instead 9600 ; as the program is the same for the 2 Cerbuino , they can exhange with no errors and as i thought i’ve programmed 9600 , it 's normal that the two tests noted as “BAD” don’t work.because Teraterm was 9600 .

I’m very confuse ,but i’ve encountered other problems before this code bigan to work and i don’t read and read again my code .

I try this way tomorow .

So i’m “Newbie” , i will encounter some other situations that makes you an indispensable support .

Many thanks and excuse me


#8

@ guillet - :smiley: