Lots of garbage on serial with 8 MHz standalone internal oscillator

I have set up ATMega328 standalone with the 8 MHz internal osc bootloader.
Connected it according to this and am able to upload sketches without problem, and the program also does what it should.

But I am getting a lot of garbage characters. Sometimes output is OK though. I have checked and redone wiring but it still does the same. Seems to be better after a reset but quickly distorts.
Could it be that the internal oscillator is not accurate enough to keep the baud rate? I am using standard 9600.
Also did another one the same way previously and it works fine.

Could it be that the internal oscillator is not accurate enough to keep the baud rate?

Yes. But the oscillator can be tuned to better than ±1% which is more than good enough for serial communications.

OK, I guess in this case I should install Bitlash to peek the factory setting and then set a proper OSCCAL in the sketch.

This will help...
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1287558192

It will have to be slightly modified for the 328 processor.

Tried to set OSCCAL in the sketch but was unable to get proper output (yet best at around 128). Not that it is very important, the project will not have communication when finished. Maybe should try to bootload the chip again.

How did you determine the OSCCAL value?

I didnt, just guessed.

Strange, I was unable to bootload it again, althought it went fine when I dropped a new chip in place. And after trying to bootload the chip, it wont accept any sketches either, although the new one does.

Maybe there really is something broken on this? Serial works perfectly on the new chip.

Should try to bootload it again once my breadboard frees up, maybe have to use the high voltage programmer?

Connected it up again to reinstall bootloader, still gives

avrdude: Yikes!  Invalid device signature.
Double check connections and try again, or use -F to override
this check.

Also set up the high voltage programmer ( Arduino-based AVR High Voltage Programmer | MightyOhm ) but that did not help either.

How can I add "-F" to avrdude syntax, could it help?
Strange is that when I have the wrong signature with working chip (328 vs 328P) it prints out the signature but not now...?

Connected it up again to reinstall bootloader

Are you using the Arduino IDE to install the bootloader?

Yes.

Which board do you have selected when you try to burn the bootloader?

I have tried burning the "8 MHz standalone internal oscillator" bootloader, but did try the Uno too when this didnt work.

If any part of burning the bootloader succeeded when Uno was the selected board then any further attempts at serial programming will require an external clock (crystal+caps, resonator, or clock signal on XTAL1). I have no idea if high-voltage parallel programming will require an external clock. I suggest getting an external clock connected before continuing. If nothing else doing that will eliminate it as the problem.

I have a variation of the ArduinoISP sketch that provides a suitable clock signal. If you'd like a copy send me a Personal Message.

That would be easy to check by simply putting the chip on my Uno, if I would accidentally have selected Uno when first trying to reinstall the bootloader.

But I was told that the ISP is able to burn bootloader even if the fuses are set for external oscillator... maybe it wasn't true then? But doesn't the high voltage programming reset that?
Are they set for internal oscillator on a virgin chip?

JanErik:
That would be easy to check by simply putting the chip on my Uno, if I would accidentally have selected Uno when first trying to reinstall the bootloader.

I don't understand.

But I was told that the ISP is able to burn bootloader even if the fuses are set for external oscillator... maybe it wasn't true then?

That is true as long as the processor is correctly clocked. If the fuses are set for an external clock then you must provide an external clock.

But doesn't the high voltage programming reset that?

I have no idea.

Are they set for internal oscillator on a virgin chip?

Internal divided by 8 which typically results in 1 MHz.

I tried to put the chip in the socket on my Uno but it did not work. So it obviously does not have an Uno bootloader installed either.

Perhaps it just got a taste of 12V which I also have on the fan controller board...