Author Options:

UART programming for AVR Butterfly help Answered

Hey everyone, I need help with programming the AVR Butterfly with an FM transmitter code that I found on the net. I have all the pieces soldered together (nothing exploded or smoked) and I am trying to upload a file, however, I cannot get it to connect to the BASIC Stamp adapter from serial-to-UART.

What I have:
Basic Stamp Adapter
AVR Butterfly
(Butterfly is being programmed through the UART ports)

I am using AVR Studio 4 to upload the code, but it will neither confirm that the serial cable is there nor after doing the holding-the-joystick process to tell the butterfly to go into programming mode for the program to see it. Am I doing something wrong? Or is there an easier program to upload the code?

I also have Visual Studios '05 and the Basic Stamp program from the Parallax website. If its any good to say, I also have the USBTinyISP programmer that can connect to the ISP ports on the Butterfly.

Any help would be appreciated!


Ok, I finally got it to work, seems that after i press the joystick down during the connection part, I need to let it go. Got the code to upload and is now broadcasting!

I am looking for the code for the butterfly broadcaster. I have the avr butterfly and the fm transmitter, but I cannot find the code. Can you help me to locate the code? THANKS


8 years ago

Those USB-to-serial adapters--they attach to a COM port, yes? Do you know which one?

In AVR Studio, when you invoke "Program AVR" -> "Connect", you can chose the COM port...

Here's a more complete document on programming the butterfly...

Also, have you used the ISP programmer (USBTinyISP) previously? 'Cause you can over-write the bootloader in the Butterfly, which would cause it to ignore the serial programming connection.

I did select which port it was in, but it would bring me back to the window to select a port and programmer type (like STK500 or AVRISP, etc.). So Im assuming it did not connect to it if I keep getting rerouted back to the selection window.

I have used the USBTinyISP before (ONLY once) when I was uploading a code into an ATTiny13 through either AVRdude or WinAVR (can't remember which). All I remember when I used the USBTiny was typing commands into the window with the black background (cant remember the term for it). However, I do not remember the process to do it, so I would rather see if AVR Studio wil be easier to program with.

Did you try checking the serial connection with a terminal prog, as outlined in that link above? Might tell you if the USB/serial interface is working correctly.

I've never used a Butterfly, but have programmed several different AVRs with ISP interfaces (I have an STK500 and a Dragon, as well as my clunkly old DAPA interface.)

From the docs, it looks like you shouldn't go through the "Program AVR" menu, but instead "AVR prog" from the tools menu. That one should automatically recognize the serial connection.

You're using a program prewritten for the butterfly? It should be compiled for the ATmega169, yes?

There must be a procedure for replacing the standard firmware via the ISP port, if the RS232 port fails...

 I have tried using both AVR studio 4 and AVRdude (using the RS232 connection) and followed all the steps (of both processes) but I could not get the code to upload. Not sure if one of the hardware pieces I have is not right or I am seriously missing a step somewhere.

Does the RS232 connection have to be null?

Null cable or not, the three connections are explicit--RXD, TXD, GND. They're present on both standard and null cables (but two are swapped.)

That document above--it details how to verify the serial connection with terminal software (Hyperterminal, but any software will do.) Look at the "Testing the Connection" section...

If the serial test doesn't work, then programming won't, either.

In that case, first check your cable and the three wired connections. I'd try it with a standard serial port, too (serial cards are cheap.) A PCMCIA serial card for a laptop might be expensive, though.

 So if the 2 pins (I'm thinking they are the RXD and TXD pins) are switched, then I need to make an adapter to switch the two? Will that affect  the hardware at all (smoking or cause software errors)? 

When I used HyperTerminal from the PDF file, I could not type in anything and make it show on the Butterfly (even though I changed both the program settings for the port AND the port settings on the computer itself). It said it was connected but I couldn't communicate with it.

I don't know if you need an adapter or not--I don't know how you've got it connected now. But it looks pretty straight-forward. Maybe switching the pins will fix it.

Have you tried all the "ENTER NAME" stuff mentioned in the docs? The demo program might not respond to serial input in any other way...

 Yes I have tried that and I even attempted on my laptop, but it still does not work. Only other option I can do now without buying something is trying to connect straight to rs232 on the board (instead of using the BS1 adapter) since i have the serial connector port lying around.

Worst-case, you can still use the ISP port to program the butterfly...

True. I will see what happens once I get the time to get to it.