AVR breadboard prototype strange behavior

Go To Last Post
7 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello Everyone,

I'm hoping someone can help me solve this problem. I have an ATMEGA16L attached to a breadboard, and I am trying to send RS232 data (via software UART), to either the TX pin on the STK500 or the RX pin on the STK500 (which echoes the data to the terminal). The good news is that sending the data to the TX pin or the RX pin on the dev board works when I have the 10 pin ISP cable connected, and the serial cable plugged in! The bad news is that everything goes haywire when I unplug the ISP! The test program I wrote on the STK500 flashes the leds when data is received on the RX pin before it echoes the data to the terminal. When the ISP is plugged in, the leds are stable and only flash when I am sending data. When I unplug the ISP, the lights flash constantly, like there is data being sent across, when its not, and the data echoed is garbage.

I've attached a schematic and a picture of the breadboard. The program running on the ATMEGA16L sends a single character to across pin PD7 while PA0 is low (when the black button in the upper right is pressed).

Any theories on why this only works when the ISP is connected? Is the ISP supplying some extra voltage, or maybe providing some kind of voltage filtering? Maybe it's providing some extra grounding? I know I'm missing something simple here, but just can't figure out what it is. I'll be glad to try any suggestions, and let you all know what works.

If anyone is wondering why I'm using software UART on the ATMEGA16L, the reason is because I was using a AT90S2343, but I fried it by hooking up a 9v battery directly to it by mistake. I'm a novice user, and am learning pretty much by trial and error at this point. I had the same strange behavior with the AT90S2343, but at one point I got it to work by touching one of the ground wires! Even thought I'm a beginner, I don't think this would be a good design strategy.

Thanks,

Chris

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Do you also have a ground commection in addition to the Tx and Rx?

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Good question. Where would I have the ground connection? I have the ATMEGA16L connected to ground through the GND pin, and the ISP has 4 connections to ground. Also, the switch on PA0 connects to ground when it is pushed, as well as the reset switch. Do I need an additional ground connection somewhere?

Chris

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You need to run ground from breadboard to ground on stk500

Isn't the AVCC is feeding the PortA , so you need to connect that on to 5v , and also a 0.1uf to ground from that pin

/Bingo

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Both Jim and Bingo got it right! I did not have a connection from GND on the breadboard to GND on the STK500. Once I added that, everything worked great! Thanks you all for your help, I hope I can return the favor some day. I'm pretty impressed. This was my first posting to the forum, and my problem was solved in less than an hour, by two people!

Chris

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Glad to hear you got it working. However you still should make some of the other suggestions, that were made above. AVCC should be connected to VCC, especially if you are using PORTA. PORTA's output drivers are powered from AVCC The GND on the opposite side of the chip (same side as AVCC) also needs to be connected to GND to ensure proper operation.

In short, always connect all VCC's and GND's on a part, these ARE NOT optional connections.

Writing code is like having sex.... make one little mistake, and you're supporting it for life.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for the advice. I'll add the avcc and gnd connections as well. I was using PA0 as an input, not really as an output, with the pull up resistor on, and checking the status, that's probably why it was working for me. I didn't know that all power and ground connections need to be hooked up on the AVR in order for it to work correctly. My thought was that If I wasn't using the AVCC I could ignore it, but that doesn't seem to be the case at all.

Chris