This is my first Atmega project so I have following questions:

1. Do I have to connect all those gnds and vcc's?
2. In programming I used Vcc Reset Gnd Tx Rx SClk of USART0 is that okay?
3. I didn't used external clock generator (quarks) because I'm planning to use inside clock?
4. Is there any fundamental circuits or pins that must be connected to work simple code? (I connected only Vccs and Gnds)
5. Is there simple circuit that tests if the atmega 128 is working or not without programming it?
['https://electronics.stackexchange.com/questions/206967', 'https://electronics.stackexchange.com', 'https://electronics.stackexchange.com/users/89445/']
1. Yes. It is also recommended to place a 100nF capacitor as close to VCC and GND of every pair. On most modern devices you will see VCC/GND placed next to each other to make that easier.
2. Normally a microcontroller is programmed in-circuit via a specific port. On Atmega's this is usually some sort of SPI port (called ISP) along with RESET. On more modern devices it is a "TWI port". It's often pretty well described in the datasheet. Via this port you can write and erase the device memories, and set fuses. However, you also need a specific hardware tool (often made by the vendor as well; sometimes you can get third-party ones - but watch out for software support!).

Because of these limitations (unusual hardware connection, hardware tools, etc.) people write bootloaders. E.g. on the Arduino platform the ATMEGA can be partially reprogrammed via a serial port. However the ATMEGA needs to be preprogrammed with this bootloader software in order to do this. The preprogramming must be done via ISP.

3. This is fine in most cases. Just want to point out a few things:

	* Do not set the AVR ISP communication speed too high. I am not sure of the exact oscillator to clock ratio, but a too fast speed will corrupt data and fuses.
	* Corrupt fuses can turn off the ISP port (no more reprogramming via ISP!), tell the chip to use an external oscillator (bricking it if it's not there!), etc.
4. Pull RESET high via a pull-up resistor to make the chip run.
Connect all VCC/GND pairs, including AVCC/AGND.
Sometimes if there is a AREF pin, you need to place a 100nF capacitor to GND as well.
5. No, not automatically. But this is often called a blinky test. If you can upload a blinky test you have verified that you can: 

	* access the chip
	* write memories
	* chip boots your program
	* oscillator is running

Then it's a case of figuring out if the oscillator speed is correct, and then you can start writing some real code.
@1: Yes, you have to connect all VCC and GND pins. This includes AVCC and AGND.

@2: Does the device run your program? Did the programmer return any error code?

@4: Connect a decoupling capacitor for every single VCC pin. Rule of thumb 100nF ceramic.

@5: Some devices may support JTAG testing or similar debug interface (debugWIRE), but I doubt that qualifies for "simple".