Ask Your Question
0

rosserial/cmake flashing fails with atmega168

asked 2011-11-28 23:26:37 -0500

updated 2011-11-30 02:16:38 -0500

Hi, I'm once again working on getting rosserial to work with a atmega168 based motor controller. With the arduino IDE, I can flash the rosserial "hello world" example just fine, but with the cmake-based system, the "make upload" command always aborts at the verification step at about 6 to 20% with "stk500_recv(): programmer is not responding".

I changed node_handle.h like so:

  template<class Hardware,
           int MAX_SUBSCRIBERS=5,
           int MAX_PUBLISHERS=5,
           int INPUT_SIZE=128,
           int OUTPUT_SIZE=128>
  class NodeHandle_

to make the code fit into the limited memory of the atmega168 (It would be good if this could be set without editing in the rosserial_client package btw :) /edit: Just noticed one can actually do this by using ros::NodeHandle_<ArduinoHardware,5,5,128,128> instead of ros:NodeHandle)

What I get when flashing is:

 make upload
[ 76%] Built target diecimila_CORE
[100%] Built target chatter
Scanning dependencies of target chatter-upload
avrdude: successfully opened stk500v1 device -- please use -c stk500v1

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9406
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
a    vrdude: erasing chip
avrdude: reading input file "chatter.hex"
avrdude: writing flash (9774 bytes):

Writing | ################################################## | 100% 7.60s

avrdude: 9774 bytes of flash written
avrdude: verifying flash memory against chatter.hex:
avrdude: load data flash data from input file chatter.hex:
avrdude: input file chatter.hex contains 9774 bytes
avrdude: reading on-chip flash data:

Reading | ##########                                         | 19% 1.35savrdude: stk500_recv(): programmer is not responding
make[3]: *** [CMakeFiles/chatter-upload] Error 1
make[2]: *** [CMakeFiles/chatter-upload.dir/all] Error 2
make[1]: *** [CMakeFiles/upload.dir/rule] Error 2
make: *** [upload] Error 2

Is there a quick way to disable the verification step? Seeing how it works with the arduino IDE upload, I suspect that the verification step fails because of timing issues or so and not because flashing went bad.

Update: After updating to most recent mercurial version and setting <ArduinoHardware,4,4,128,128> for nh , I can get the Atmega168 to publish on the chatter topic (Flashing still seems to fail sometimes though). However, if I add a subscriber, I can still flash the system, but rosserial fails to connect every time. If I upload the code using the arduino IDE, it works. Interestingly, the Arduino IDE reports a sketch size of

Binary sketch size: 9282 bytes (of a 14336 byte maximum)

while 'make upload' of the cmake based script tells me

avrdude: writing flash (11220 bytes):

for the exact same code

edit retag flag offensive close merge delete

Comments

The latest release of rosserial (0.3.0) should be setting the node handle parameters based on the chip -- your mega168 would get <6,6,150,150> -- does that not fit in RAM?
fergs gravatar image fergs  ( 2011-11-29 04:28:40 -0500 )edit
I'm running the latest version from mercurial, so this should be used already, right? Looking into the sources generated in src/ros_lib for my package, I see the default <25,25,512,512> parameters. Or does this get changed during compilation somehow?
Stefan Kohlbrecher gravatar image Stefan Kohlbrecher  ( 2011-11-29 04:53:51 -0500 )edit
ros.h should contain a big series of "#if defined(__AVR_ATmega8__).." type things, if not, you don't have the latest version (did you possibly "pull" but not "update"?)
fergs gravatar image fergs  ( 2011-11-29 09:13:53 -0500 )edit
Ahem, yes this is possible. I see I have to work on my mercurial skills :) Will report back later today.
Stefan Kohlbrecher gravatar image Stefan Kohlbrecher  ( 2011-11-29 17:12:46 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2011-11-30 00:13:32 -0500

Ok, updated it. It now works with a <ArduinoHardware,4,4,128,128> setting (I get chatter topic echoes). With the default nodehandle, I get only sync failed. It appears the hex file is still too large. (It would be great to have a "make size" target btw :) )
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2011-11-28 23:26:37 -0500

Seen: 471 times

Last updated: Nov 30 '11