Hi everyone,

I was curious if anyone out there had devised a means for transferring files between a PC and a Gadgeteer board using XBEE? I see Iggmoe has developed a XMODEM library. (https://www.ghielectronics.com/community/codeshare/entry/697) Any thoughts on using XMODEM over XBEE? I’m pretty new to this space, so I won’t be surprised if I’m way off the mark on this question.


XBee communicates over serial so there’s no reason you shouldn’t be able to implement this using XBees.

I noticed that the XMODEM class in Iggmoe’s code is designed to sit on top of a System.IO.Ports.SerialPort. Yet, the XBEE class exposes a GT.Interfaces.Serial property (SerialLine). Can I just spin up a System.IO.Ports.SerialPort and map it to the XBEE? (No idea what COM Port Name should be; but I think I can figure that part out.)

I’m wondering if I can send some data from my PC to my Spider; have the Spider recognize a request for data; and send the data using XMODEM.

Thanks for the vote of confidence!

why do you want to use XBEE. Did you consider to use WiFi or Bluetooth? Perhaps you do not need XMODEM to have reliable data Transfer?

Hi Roland! It all comes down to range. I’m hoping I can send data about a mile away - there’s no internet/wifi access available.

Just don’t use the Gadgeteer module. :wink:

No, seriously. Once it’s connected you can just open the COMPort as per normal. You do not NEED to use the Gadgeteer Module Driver at all.

As long as the XMODEM driver allows you to break up the packets to fit within the packet size allowed with Xbee it should work. It’s around 140 or 160 characters as I recall.

Use the PRO version with an external antenna to get your range.

As Skewworks says, just connect it, open a serial port to it and start sending data. If you want to make sure that your 2 devices only talk to each other, you will need a way to connect the Xbee module to your PC and run Digi X-CTU software to configure your own PAN ID (personal area network) and then your devices will only be seen by each other.

You can also do this via code with the AT commands. :slight_smile:

Yup, AT commands would be the best way to go. I’ve looked the docs, they’re pretty straightforward.

@ jeffvan - If you have to limit the packet size to less than 140 bytes, the XModem-CRC variant is the way to go, since it’s sized for 128-byte packets. You can also customize the packet sizes using the Modem.Packet1024NominalSize or Modem.Packet128NominalSize properties.

My radios arrived today. Is it normal for the RED LED on the Gadgeteer module to constantly blink? I have the sneaking suspicion that it’s trying to tell me something bad. Maybe not enough power?

I’m using PRO modules. It’s early, but so far, I haven’t had luck getting them to talk. I bought a USB shield from Sparkfun. I used X-CTU to configure the devices. I’m not sure this is the correct procedure, but I set each device’s destination address to its partner’s address. Then, I read here: XBee Radios in .NET Gadgeteer Devices | Integral Design that one device needed to be a coordinator. My radios don’t follow that tutorial exactly, as they are XBEE Pros. But I did configure one to “enable coordinator”.

Any suggestions?

BTW: I just have a simple timer running every second on a FEZ-Spider. It simply does a writeline on the Gadgeteer XBEE Serial Line. I was hoping that my PC would see the output (through the XBEE connected to it over USB) in the X-CTU Terminal.

There is the old XBee and the new Version 2. These have slightly different setups and requirements. Make sure you’re looking at the right docs

The flashing LED is correct.

As for addressing, make sure you set the PAN ID on both to be the same.

Series 2 modules are very noisy because of all the network communications going on in the background over and above your data sending/receiving. That should not affect the working but it does mean that the data bandwidth is less than series 1.

When you reflash them, keep them in AT mode so that the serial passthrough works. Do not use API mode as this will require you to use a specialised packet to talk to them.

You can use MFToolkit to work with the XBee modules in API mode if you decide to go this route with custom code. It works with both the Gadgeteer modules and on regular PC if you use VS2012 and C#. :slight_smile:

Thanks guys.

I’m still having a heck of a time getting my modems to talk to each other. I’ve been able to get a modem connected to my PC via Sparkfun Explorer to send data to the other modem connected to FEZ Spider. But I can’t get my Spider to send data to the PC.

In both cases, I’m using a simple Serial Port class. In the MF application, I simply create a Serial Port (“COM1”, 9600, 8, N 1), hook the data receive event, and every once in a while write something to the port (timer). In the Win application, I simply create a Serial Port (this case COM10 - at least according to X-CTU); still using 9600, 8, N, 1. Here, in the Win app, I have a Button that, when clicked, sends to my Spider. I also have the data received event hooked so I can dump data to a text box.

The send from PC to Spider is working; it’s just the reverse that doesn’t work. I’ve checked and triple checked my addresses, PAN-IDs, and channels. But to no avail. I even re-flashed one of the modems (it bricked for a while b/c I flashed it as a XB24 instead of a XBP24 - it IS a XBP24). Yet, still no cross-talk.

I’m using Series 1 XBP24’s. Is there anything fancy I need to do in my setup? I’m just trying to use each modem as an end device - no coordinator. Do I need to enable/disable RTS or CTS? I’ve seen some chatter online about disabling RTS, but I think that’s the default for my modems.


Good news! I fixed the problem. It turns out that the default configuration of my XBP24’s had RTS enabled. I turned it off and now everything works. Whew.

1 Like

Just in case others are following the discussion…

I managed to get IGGMOE’s XMODEM class to work over XBEE. I used my FEZ-Spider to send data over XBEE to my PC; on the PC I used HyperTerminal to receive the Spider’s data. The version of HyperTerminal I used only offered XMODEM-1K, so that’s the XMODEM Variant I used on the Spider.

I tried to get XMODEM-CRC up and running in between my Spider and PC. Here, I used a custom .NET Application with a “ported” version of IGGMOE’s XMODEM class. However, I couldn’t get the Receiver (PC) to initiate the transfer. There seems to be something preventing the full .NETFX SerialPort class from transmitting receiver’s initiation bytes. I’ve seen some posts on the internet suggesting I may need to change the “Encoding” on the full .NETFX SerialPort in order to get it to transfer binary data; but I’m not sure. If/when I get a solution, I’ll update the forum.

can you tell us which “Bytes” you want to send, show the code you tried and explain why it did not work?

@ jeffvan - I’m gonna try to port the code over to the desktop and see what happens . . . .

@ jeffvan - Here you go!


@ Iggmoe: Sweet! I’ll give it a try.

If it helps… the problem I’m seeing is that the full .NETFX program is trying to send 0x67, but it doesn’t seem to ever leave the serial port. The reason I say this is that I have a breakpoint set on the Gadgeteer’s Data Received event, and it never fires.

@ jeffvan -
did you try to send the Byte in this form

byte[] SendBuffer = new byte[1] {0x67};