Friday, February 4, 2011

update your xbee firmware under linux!

I just got a pair of xbee radios from Digi (http://www.digi.com/xbee/) last week, as I begin my hobby of embedded electronics, and they're very cool.  I already have a ton of ideas that, given time and money, I want to work on.  The only thing that bothered me was that there was no firmware update utility for Linux.  Well, no more!  The datasheet from Digi had the details of how to enter the bootloader and upload firmware to the xbee, and I spent the past few nights learning about serial communication and programming.  The result is a small utility that can upload new firmware images to your xbee!

As of now, there are a couple of caveats (that will all eventually be fixed):
  • the device is hard-coded as /dev/ttyUSB0
  • you can only program an xbee currently in AT mode (you can go to API mode fine, but my utility doesn't speak API yet)
  • need to handle radios in strange states or non-default baud rates, etc.
I only have 2 radios to test on, so: FLASH AT YOUR OWN RISK!  This works for me, but I'm sure that there will be situations and hardware that this will not work on (for now).  That aside, the xbee bootloader seems fairly robust, and when I accidentally re-programmed the same block several hundred times, it was able to recover.

I'll edit this later after I find a place to put my code...
Edit: https://github.com/roysjosh/xbee-comm

And now, the text equivalent of a screenshot!

$ time { ./xbfwup 2270/ebl_files/XB24-ZB_2270.ebl ; }
Read 100608 byte firmware file (786 blocks).
................................................... 50
.................................................. 100
.................................................. 150
.................................................. 200
.................................................. 250
.................................................. 300
.................................................. 350
.................................................. 400
.................................................. 450
.................................................. 500
.................................................. 550
.................................................. 600
.................................................. 650
.................................................. 700
.................................................. 750
...................................
Programming complete, running uploaded firmware...

real    0m25.392s
user    0m0.023s
sys     0m0.042s

No comments:

Post a Comment