Main Site Documentation

Fez Cerbuino Bee - UART?


#1

Which SerialPort is the Xbee socket on the Cerbuino Bee wired to? Com1, Com2 etc.


#2

You can find the information in the Fez Cerburino Bee documentation:

RN171

The RN171 Wifi capability can be added to the Cerbuino Bee two ways.

Using a Gadgeteer socket with a Gadgeteer Module like our RN171 Module. In this case GHI supplies a Gadgeteer driver for the module. Our module and driver defaults to 115200 baud.
Using an RN171 equipped device hosted on an XBee form factor and plugged into the board’s socket. In this case, GHI does not supply a driver. There are a number of community created drivers that are based on a SerialPort object. Most of these 171 based devices default to 9600 baud. Use “COM7” as the name of the port.

https://www.ghielectronics.com/docs/45/fez-cerbuino-bee-developer

Here you can find a sample:
https://www.ghielectronics.com/community/codeshare/entry/561

I hope this information is correct and helps you.


#3

You know, I read that whole page and did not notice that. Thanks much.


#4

The example uses COM1; and when I use COM7 I get an argument exception.


#5

COM1 I recall was on socket 2.

How about trying COM6 as the schematic refers to UART6 although the logical to physical is not always the case, it may be worth a try.


#6

There are 3 COM ports on the Cerb family firmware COM1, COM2 and COM3

The confusion is from which pins are wired up on the STM to which are mapped to the firendly COM names…

CerbuinoBee

PC6, PC7 (UART6) = COM1 - xBee Socket
PA2, PA3 (UART2) = COM2 - Socket 2
PB10, PB11 (UART3) = COM3 - Socket 1

So you can see from the Firmware the order of COM1, 2 and 3

#define STM32F4_UART_RXD_PINS {39, 3, 27} // PC7, PA3, PB11
#define STM32F4_UART_TXD_PINS {38, 2, 26} // PC6, PA2, PB10


#7

So i’ve tried IO on ports 1,2,3 so far no response from the device.


#8

Post the code you are testing with


#9
using System;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using System.IO.Ports;
using System.Text;
using System.Threading;

namespace XbeeWifi {
    public class Program {
        public static void Main() {
            try {
                SerialPort _xBeeWifi = new SerialPort("COM1", 9600, Parity.None, 8, StopBits.One);
                _xBeeWifi.Open();
                _xBeeWifi.DataReceived += _xBeeWifi_DataReceived;
                
                byte[] _message = Encoding.UTF8.GetBytes("HS");
                _xBeeWifi.Write(_message, 0, _message.Length);
                while (true) {
                    Thread.Sleep(10);
                    if (_xBeeWifi.BytesToRead > 0) {
                        Debug.Print("Reading bytes");
                    }
                }
            }
            catch (Exception ex) {
                Debug.Print(ex.Message);
            }
        }

        static void _xBeeWifi_DataReceived(object sender, SerialDataReceivedEventArgs e) {
            SerialPort _xbee = (SerialPort)sender;
            byte[] _buffer = new byte[1024];
            int _count = _xbee.Read(_buffer, 0, _xbee.BytesToRead);
            string _response = new String(Encoding.UTF8.GetChars(_buffer));
            Debug.Print(_response);
        }

    }
}


#10

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


#11

The firmware is up to date :
4.2.6.1 on this device.

Still no response.


#12

How are your Xbee modules configured?

Are they in AT mode or API mode?

I am assuming they are Series 2B modules or something else?

Are you able to run the Digi X-CTU configuration code with them? ie, do you have a suitable XBee USB module?


#13

It is a Xbee Wifi Module. I can connect to it via the Soft-Ap mode https://www.sparkfun.com/products/12569.


#14

I don’t have an oscilioscope, but is there any way to test the UART port with a multimeter?


#15

If I install a jumper from TX to RX I should get back my data right? I’ll see


#16

The module does require configuration to tell it what port etc to listen on. There are default parameters, but if I recall it is defaulted to port 2000.

To set the listen port send this series of strings, it would be best to check the return string for AOK/ERR, otherwise you will need a small delay between sending these three strings:


$$$
set ip local <desired_port>
exit

#17

Well, I confirmed that COM1 is on the Xbee, via a resistor (330 Ohms) across pin 2 and 3; I got back my command. So it’s most likely some configuration thing.

@ James, do you know any “hello” commands for this module? I’m trying to connect to it via the UART interface.


#18

What it receives is simply spit back out when it receives it, so the only way to catch it’s attention and to respond is to initiate command mode with $$$, it will return CMD


#19

So it’s $$$\r\n ?


#20

For command mode entrance I do not believe it is necessary to CRLF.