xbee for arduino wireless programming

XBee projects like the adapter, xBee tutorials, tweetawatt/wattcher, etc. from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
boulderbill
 
Posts: 14
Joined: Thu Jan 08, 2009 12:25 pm

Re: xbee for arduino wireless programming

Post by boulderbill »

We're just now looking at the way ladyada does it.

It looks like ours is slightly different. We actually pull a pin on the programmer xbee low via a separate arduino running a simple program that pulls a transistor high when it gets an 'r' value. This transistor is connected to the nearby xbee's DIO 7 which when line passed to the remote xbee, happens to reset the attached arduino board, but without any change of wiring on the remote boards. This matters for us given the number of boards we have to control!

It looks like ladyada is using an RTS state to trigger the reset in a similar way. Is this RTS state change by way of the inherent sequence of the avrdude? In which case, this may be better for us, at least in terms of using the existing avrdude timing instead of creating our own timing.

As a note, we are finding pretty significant difference by changing the RO command on the xbees. Nothing conclusive yet. At first glance, changing RO to 0 actually made it worse, whereas increasing the value seems to help, which doesn't make any sense to me whatsoever.

Oh, one more thing... it seems that avrdude differentiates between a 'reset' that it performs and a 'power off' and restart after successful programming. Perhaps the lack of this happening wirlessly could be a potential issue.

We are working on this all day today, by the way, and I will keep checking for posts.

Cheers.

User avatar
boulderbill
 
Posts: 14
Joined: Thu Jan 08, 2009 12:25 pm

Re: xbee for arduino wireless programming

Post by boulderbill »

Is ladyada using the original bootloader and the Arduino IDE in her example: http://www.ladyada.net/make/xbee/arduino.html

???

Cheers.

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Re: xbee for arduino wireless programming

Post by adafruit »

im using my adaboot bootloader which is pretty much idential except that the timeout is a bit longer. that may help a bit

User avatar
blalor
 
Posts: 35
Joined: Tue Jan 06, 2009 11:37 pm

Re: xbee for arduino wireless programming

Post by blalor »

ladyada wrote:im using my adaboot bootloader which is pretty much idential except that the timeout is a bit longer. that may help a bit
I'll give that a try. Where's the best place to grab that bootloader? I see one for the Atmega328 here, and there's this one on Wulfden.org, but I wouldn't expect to find your work only available on their site. :)

User avatar
boulderbill
 
Posts: 14
Joined: Thu Jan 08, 2009 12:25 pm

Re: xbee for arduino wireless programming

Post by boulderbill »

Yes, it sounds like an extra timeout might be beneficial.

On a scale of 1 to 10, how difficult do you think altering a bootloader is for the uninitiated?

I'd be very interested in tweaking the bootloader to 'jive' with the xbee as effectively as possible, if it is the case that the xbee's buffer is causing our problems.

Cheers.

User avatar
boulderbill
 
Posts: 14
Joined: Thu Jan 08, 2009 12:25 pm

Re: xbee for arduino wireless programming

Post by boulderbill »

Hey, Ladyada ( or anyone else that can help )...

We are actually getting very interested in finding someone to help us write or adapt a bootloader that would work wirelessly as effectively as possible between the xbee and arduino to upload large programs. We have a grant for a project that could really benefit from this. Given the other aspects of the grant we need to take care of, we are thinking of the possibility of outsourcing this component. Would you be available to chat off-forum about this? Any advice would be useful. You can contact us directly at [email protected] or [email protected].

Thanks!

Cheers.

User avatar
blalor
 
Posts: 35
Joined: Tue Jan 06, 2009 11:37 pm

Re: xbee for arduino wireless programming

Post by blalor »

I did some bench testing this morning with a few different configurations. Note that the two XBees are sitting less than six inches away from one another; not sure if that makes a difference...

I tried to be consistent in how I did these tests, but I started out using the Arduino IDE and then switched to just using avrdude (copying the command from the IDE with "upload.verbose=true") in the terminal because it was faster.

Code: Select all

small sketch (blink, 1124 bytes) [4/9 succeeded]
    • attempt 1: failed, "programmer not responding". (weird: led on 13 always on afterwards)
    • attempt 2: succeeded
    • attempt 3: failed
    • attempt 4: failed
    • attempt 5: failed
    • attempt 6: succeeded
    • attempt 7: succeeded
    • attempt 8: failed
    • attempt 9: succeeded

    a couple of failed attempts actually worked, even though IDE responded with error above

"large" sketch (furnace monitor, 2980 bytes) [1/9 succeeded]
    • attempt 1: failed
        avrdude: stk500_loadaddr(): (a) protocol error, expect=0x14, resp=0x3d

        avrdude: stk500_paged_load(): (a) protocol error, expect=0x14, resp=0x3d
        avrdude: stk500_cmd(): programmer is out of sync

    • attempt 2: failed
        avrdude: stk500_read_sig_bytes(): (a) protocol error, expect=0x14, resp=0x3d
        avrdude: error reading signature data for part "ATMEGA168", rc=-2
        avrdude: error reading signature data, rc=-1
        avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x65

    • attempt 3: failed (upload might have worked)
        avrdude: stk500_cmd(): programmer is out of sync 
    
    • attempt 4: failed
        avrdude: stk500_initialize(): (a) protocol error, expect=0x14, resp=0x3d
        avrdude: initialization failed, rc=-1
                 Double check connections and try again, or use -F to override
                 this check.

        avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x3d

    • attempt 5: failed
        avrdude: stk500_loadaddr(): (a) protocol error, expect=0x14, resp=0x3d

        avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x3d
        avrdude: failed to write flash memory, rc=-4
        avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x3e

    • attempt 6: failed (same as above)

    • attempt 7: failed
        avrdude: stk500_read_sig_bytes(): (a) protocol error, expect=0x14, resp=0x3d
        avrdude: error reading signature data for part "ATMEGA168", rc=-2
        avrdude: error reading signature data, rc=-1
        avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x65

    • attempt 8: SUCCESS!

    • attempt 9: failed
        avrdude: stk500_initialize(): (a) protocol error, expect=0x14, resp=0x3d
        avrdude: initialization failed, rc=-1
                 Double check connections and try again, or use -F to override
                 this check.

        avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x3d

"large" sketch (furnace monitor, 2980 bytes); baud rate of local XBee set to 115200 [no success]
    • attempt 1: failed
        avrdude: stk500_initialize(): (a) protocol error, expect=0x14, resp=0x3d
        avrdude: initialization failed, rc=-1
                 Double check connections and try again, or use -F to override
                 this check.

        avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x3d

    • attempt 2: failed
        avrdude: stk500_cmd(): programmer is out of sync

    • attempt 3: failed
        avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x3d
        avrdude: failed to write flash memory, rc=-4
        avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x3d

    • attempt 4: failed
        avrdude: stk500_getsync(): not in sync: resp=0x3d
        avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x5a

    • attempt 5: failed
        avrdude: stk500_getsync(): not in sync: resp=0x3d
        avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x5a

    • attempt 6: failed
        avrdude: stk500_getsync(): not in sync: resp=0x3d
        avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x5a

    • attempt 7: failed
        avrdude: stk500_getsync(): not in sync: resp=0x3d
        avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x5a

    • attempt 8: failed
        avrdude: stk500_getsync(): not in sync: resp=0x3d
        avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x5a

    • attempt 9: failed
        avrdude: stk500_getsync(): not in sync: resp=0x3d
        avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x5a

"large" sketch (furnace monitor, 2980 bytes); baud rate of local XBee set to 38400 [2/9 succeeded]
    • attempt 1: failed, but upload happened
        avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x3d
        avrdude: failed to write flash memory, rc=-4
        avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x3e

    • attempt 2: failed
        avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x20
        avrdude: stk500_initialize(): (a) protocol error, expect=0x14, resp=0x65
        avrdude: initialization failed, rc=-1
                 Double check connections and try again, or use -F to override
                 this check.

        avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x61
    
    • attempt 3: failed

    • attempt 4: succeeded!

    • attempt 5: failed
        avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x3d
        avrdude: stk500_initialize(): (a) protocol error, expect=0x14, resp=0x3d
        avrdude: initialization failed, rc=-1
                 Double check connections and try again, or use -F to override
                 this check.

        avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x3e

    • attempt 6: failed
        avrdude: stk500_loadaddr(): (a) protocol error, expect=0x14, resp=0x3d
        avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x3d
        avrdude: failed to write flash memory, rc=-4
        avrdude: stk500_cmd(): programmer is out of sync
        
    • attempt 7: succeeded.  reset FTDI cable before upload

    • attempt 8: failed
        avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x3d
        avrdude: failed to write flash memory, rc=-4
        avrdude: stk500_cmd(): programmer is out of sync
    
    • attempt 9: failed
        avrdude: stk500_loadaddr(): (a) protocol error, expect=0x14, resp=0x3d

        avrdude: stk500_paged_load(): (a) protocol error, expect=0x14, resp=0x3d
        avrdude: stk500_cmd(): programmer is out of sync
    
"large" sketch (furnace monitor, 2980 bytes); adaboot_8h13, 19200 [2/10 succeeded]
    • attempt 1: failed
        avrdude: stk500_recv(): programmer is not responding
    
    • attempt 2: failed
        avrdude: Device signature = 0x1e9406
        avrdude: stk500_recv(): programmer is not responding
    
    • attempt 3: failed
        avrdude: Device signature = 0x1e9406
        avrdude: stk500_recv(): programmer is not responding
    
    • attempt 4: failed.  started writing flash, at least
        avrdude: stk500_recv(): programmer is not responding
    
    • attempt 5: success!

    • attempt 6: success!

    • attempt 7: failed (did not unplug FTDI cable)
        avrdude: stk500_initialize(): (a) protocol error, expect=0x14, resp=0x3d
        avrdude: initialization failed, rc=-1
                 Double check connections and try again, or use -F to override
                 this check.

        avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x3d

    • attempt 8: failed (*did* unplug FTDI cable)
        avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x3d
        avrdude: failed to write flash memory, rc=-4

        avrdude: stk500_cmd(): programmer is out of sync

    • attempt 9: failed?
        avrdude: verifying ...
        avrdude: 2980 bytes of flash verified

        avrdude: stk500_cmd(): programmer is out of sync
    
    • attempt 10: failed.
        avrdude: stk500_loadaddr(): (a) protocol error, expect=0x14, resp=0x3d
        avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x3d
        avrdude: failed to write flash memory, rc=-4
        avrdude: stk500_cmd(): programmer is out of sync
Rob Faludi had suggested changing the baud rate on the local (transmitting) XBee. That doesn't seem to have helped any. Small sketches work more of the time, but still not every time. I'm also having weird issues with my FTDI cable. It occasionally seems to lock up; it'll still read incoming serial data (and transmit the DTR line) but I can't get its attention with "+++" or seemingly transmit any data. Unplugging it from my MacBook and plugging it back in seems to reset it, so I started doing that with some of the uploads above. I'm fairly certain that may be responsible for some of the upload failures above.

I guess I'm just going to give up on wireless uploads for now. :cry:

User avatar
blalor
 
Posts: 35
Joined: Tue Jan 06, 2009 11:37 pm

Re: xbee for arduino wireless programming

Post by blalor »

Nathan at SparkFun has written his own bootloader and uploader to work with the XBee for wireless uploading of code to an AVR. The tutorial is here. He's looking for folks who can help bring his solution to a wider audience.

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Re: xbee for arduino wireless programming

Post by adafruit »

i spent a few hours yesterday on this and gotten it working 9999x better with a few minor changes
check it out & let me know!
http://www.ladyada.net/make/xbee/arduino.html

User avatar
blalor
 
Posts: 35
Joined: Tue Jan 06, 2009 11:37 pm

Re: xbee for arduino wireless programming

Post by blalor »

ladyada wrote:i spent a few hours yesterday on this and gotten it working 9999x better with a few minor changes
check it out & let me know!
http://www.ladyada.net/make/xbee/arduino.html
Great! I'll try and take a whack at this later this week. Looks like the packetization timeout is a new param; any other changes?

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Re: xbee for arduino wireless programming

Post by adafruit »

theres a few changes. i suggest just going through the whole thing since some of the params may need tweaking!

grapeghot
 
Posts: 11
Joined: Wed Feb 18, 2009 7:19 pm

Re: xbee for arduino wireless programming

Post by grapeghot »

Before I go out and buy a pair of XBee 2.5s, I would like to know how well the wireless bootloading works with them? I was reading in Nathan's wireless bootloader code where he states:
With XB24-ZB unit, the end device can transmit all it wants, the coordinator seems to die after a few seconds. This was the ultimate downfall of the series 2.5 for me. The link would work, but the coordinator would drop off after a few seconds? Series 1 did not do this.
Please share your experience with using XBee 2.5s. Thanks!

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Re: xbee for arduino wireless programming

Post by adafruit »

i dont know anyone who thinks the series 2 is better than series 1
unless you need a mesh network. and thats very uncommon

User avatar
blalor
 
Posts: 35
Joined: Tue Jan 06, 2009 11:37 pm

Re: xbee for arduino wireless programming

Post by blalor »

I played around with this new configuration this weekend with only limited success. I'm uploading sketches between 4k and 7k and although my success rate is definitely higher, it's still only like 30%. I still get errors like programmer out of sync, or programmer not responding, etc. I'm using version 0012 of the Arduino IDE with OS X 10.5.6, and fairly current XBee firmware (although I don't have the exact version handy). The wireless link itself seems to be fine; I've been spooling data from the Arduino in my basement to my laptop upstairs with no problem.

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Re: xbee for arduino wireless programming

Post by adafruit »

use avrdude directly, the arduino ide programmer system is overly complex

Locked
Please be positive and constructive with your questions and comments.

Return to “XBee products (discontinued)”