Using AVRDUDE with BUB and BBB

Problems uploading, serial connections, BUBs, P4, FTDI cables, etc
Post Reply
repco
Posts: 10
Joined: Wed Dec 16, 2009 2:54 am

Using AVRDUDE with BUB and BBB

Post by repco » Wed Mar 10, 2010 2:38 am

Thanks for the replies from others concerning my quest to use my BUB to program my BBB with code generated by avrstudio.

Finally i have had success. And want to leave these notes about it.

***********************

some observations about using avrdude to program via USB-BUB to BBB

First i finally found some useful examples at ladayada.net. But that after some study of avrdude.

Under her xbee and upgrading older arduino pages she gave some good examples of
avrdude being used.

Second i had to find the upload speed of the BBB bootloader. Which ladyada also
stated in the upgrade hack as being 57600 for the 328p bootloader.

Since I have Arduino-0017 and winavr-20090313 in my system both have copies of avrdude.exe and using avrdude
presented a problem. Which version to use? Which config file to use?

That was solved by trying both. However, after using the version in winavr that
became the Windows default, or at least its config file did. Using it never worked. Instead I got the error message: avrdude: stk500_getsync(): not in sync: resp=0x00.

To make things easier on me i copied my hex files into the Arduino folder under hardware\tools\avr\bin
containing avrdude. But this still failed because it would use the avrdude.conf file in winavr. So i also copied the arduino version avrdude.conf from arduino\hardware\tools\acr\etc into hardware\tools\avr\bin. This way avrdude did not go find the
default config version in winavr. Which would crash saying that it found an unknown character "a". ????

I assume the arduino version of avrdude.conf is optimized for use with arduino, especially for the USB_com port. It worked flawlessly when i used it.

The arduino avrdude is in: arduino-0017\hardware\tools\avr\bin

The corresponding avrdude.conf is in arduino-0017\hardware\tools\avr\etc

I moved that to the ...\avr\bin folder along with my test hex files.

Then with my directory set to this folder in a command prompt window i used:

avrdude -c stk500v1 -b 57600 -P COM4 -p m328p -u -U flash:w:blink_alt.hex <cr>

and it loads just like when using the Arduino IDE.

Now i can load via USB anytime, without ISP.

rep

bperrybap
Posts: 42
Joined: Wed Jun 03, 2009 3:17 am
Location: Dallas, TX

Re: Using AVRDUDE with BUB and BBB

Post by bperrybap » Sun Mar 14, 2010 1:02 am

I have both the same packages you have: Same WinAVR rev and the same rev of Arduino.
While I did have to find the bootloader source code to identify the serial port speed,
once I got the baud rate correct correct,
I never had any trouble downloading nor did have to do hacking on any of the files
or paths to get avrdude to program a BBB board with either the Arduino IDE or
when using the WinAVR version of avrdude directly.

I am however using a slightly different command line when calling avrdude directly.

I use:
avrdude -p atmega328p -P COM7 -c avrisp -b 57600 -U flash:w:main.hex

I don't use the "stk500v1" programmer type.

But I also don't use AVRstudio, I write my own makefiles.
With the exception of the comport name, the same makefile and
avrdude options work on linux as well.

I've not had any issues with the Arduino IDE loading new flash images.

Kind of sounds like the hardware auto reset wasn't working properly.
That avrdude error you were seeing is what you will see if the auto reset is not working.

I've seen a s/w hack in avrdude to toggle the DTR line so that reseting the AVR does
not depend on the hardware Arduino autoreset hack which also depends on the OS com port hardware settings.
Maybe that s/w avrdude hack is in the distributed version of avrdude that comes with Arduino.
There is a better version of avrdude floating around out there that has an actual "arduino" programmer type
defined in it that knows how to toggle DTR properly rather than a quick and dirty hack to toggle the DTR line.


--- bill

repco
Posts: 10
Joined: Wed Dec 16, 2009 2:54 am

Re: Using AVRDUDE with BUB and BBB

Post by repco » Fri Mar 19, 2010 1:16 am

Are you using the USB BUB or the ISP interface?

rep

bperrybap
Posts: 42
Joined: Wed Jun 03, 2009 3:17 am
Location: Dallas, TX

Re: Using AVRDUDE with BUB and BBB

Post by bperrybap » Sat Mar 20, 2010 2:38 am

I am using the BUB board with my BBB board. No cuts or jumpers on the BUB. Just the 6 pin female header soldered in.
There is a photo of my setup over on the Exhibition forum:
http://forum.moderndevice.com/phpBB3/vi ... f=14&t=193

My PC is running Vista (unfortunately).
I also have the advanced option setting "Set RTS on close" selected.
Its been a while so I can't remember but on either Vista or Linux, on one of them,
when they say "RTS" they actually mean "DTR".

The avrdude that I run directly from my makefiles is the one that comes with WinAVR not the one that
came with the Arduino IDE.
When I use the Arduino IDE, I'm not sure which avrdude the Arduino IDE runs,
but I'm betting it runs the one that was bundled with the Arduino IDE.

--- bill

Post Reply