I’m building a small board based on an ATMega128 (yay, lots and lots of I/O pins) and I have a question about general electronics practice.
The chip has three GND pins and two VCC pins, which seem to be connected internally when measured with a continuity checker (respectively, not to each other, of course!). Now, if I were designing a PCB for this chip, of course I would connect all of these externally as well, but I’m working with a TQFP breakout board, and it would be very convenient for me to use these pins separately. For example, regulated voltage in to one set of VCC/GND, programming header connected to another set. Although thinking about it then I would be drawing current through the chip to the programmer, which is probably not the best design choice aside from whether I connect the GND and VCC pins externally.
Of course I can’t find anything about this in the data sheet (not that I read all 391 pages in detail or anything), so its down to a question of practice. Does a good ECE connect externally what appears to be connected internally, even without explicit instructions to do so, or should I just use them as is convenient to me?
I generally like having good ground connections, so depending on the connection inside the chip wouldn’t qualify for me. But, what are you risking? If, worst case, you need to replace the AVR, that’s not that big of a deal, and it might be worth the gamble. I would treat it similarly to other general practices, like adding bypass caps: it’s not worth calculating exactly what you need, so just sprinkle some on; if you can’t put on as many as you would like, be ready to check that if things don’t work as expected.
Well I guess I’ll never know if it would have been enough. I wired everything up but I couldn’t program it, so I connected all the grounds and VCCs externally, and still couldn’t program it. I was afraid that since they were made to be compatible with the older ATMega103’s, maybe the 128’s came old-style with only parallel programming enabled (what a pain), so I turned to the datasheet.
It turns out that the MISO and MOSI SPI pins on the ATMega128 are not used for SPI programming. Instead, two special pins PDI and PDO are used, which also happen to be TX and RX of USART0. What the heck?!? It even still uses the SPI SCK pin! Anyway, it’s working now. Sheesh!
Answered my own question seven months later:
No, the internal connections are not always enough. Yes, you really should connect all of the GND and VCC pins (and AVCC too) externally to power and ground. Its one of those things that you can get away with for a long time, but that will come back to bite you at the worst time if you don’t do it.
I’m working on a prototype board with an ATMega324p, and I lazily only connected the VCC and GND pins on the side with the programming pins. Everything was fine for a while, then I started having phantom instances of the chip not executing code. The board is buried deep in a stack of other devices, and I just took it apart and put it back together five times looking for the problem, then I had a burst of inspiration. I have brown-out detection turned on (since I’m bootloading code onto it), and it occurred to me that what was happening looked like a brown-out, but was totally unpredictable. That got me thinking about those unconnected VCC and GND pins, and I found this AVRFreaks thread (posted since my original question). Duh, how did I think the brown-out detector was reading the VCC voltage without the ADC being powered? I’m surprised it ever worked at all.
I know I could probably just turn off brown-out detection and leave AVCC disconnected, but now I’m thinking about other problems that might crop up. Debugging take so much time, and adding a few wires takes so little. That’s the last time I leave any of those pins floating!