Atmega Serial Print not working properly

Hi,
My Atmega(88,168,328) serial sometimes print correct and sometimes print corrupted character.
**For example: U���503::'���3**

I try to add a small capacitor of its TX but still the same. I use baudrate 9600 and its bootloader is 8mhz internal.

Hi,
Can you please post a test code that produces this problem?

It does this on a UNO as well?

Thanks.. Tom.. :smiley: :+1: :coffee: :australia:

What core do you use? The Arduino AVR core doesn't support an 8MHz internal resonator configuration.

I use this:

This core doesn't support any of your MCUs:

When you're opening the serial monitor, are you selecting 9600 baud rate there too? This type of garbage often occurs due to baud rate mismatch.

Sorry, I also use Atmega16 and Atmega32 and Atmega8

Directly select 9600. Yes, I understand that wrong baudrate will cause garbage data.

Hi,
How are you connecting the PC running the monitor to the various varieties of Atmega you have?

Thanks.. Tom.. :smiley: :+1: :coffee: :australia:

One by one.

Sorry no, what I mean is how are you wiring them?
What is the connection, are you using USB to rs232 or FTDI interface between the controller and the PC?

Tom... :smiley: :+1: :coffee: :coffee: :coffee: :coffee: :coffee: :australia:

I use this kind of USB/TTL

Please post the wiring diagram or schematics of your setup. Also post the code you used for testing.

I use separate power sources. I think problem is with voltage. When I apply more than 3.3volts(3.5v and above) to the Atmega, the Serial print correctly. but if the voltage is 3.2v or something, it'll start print corrupted string. I don't understand why too, anyhow, i stick to 3.5v or more.

The USB-Serial link says;

Functions:
Automatic recovery fuse: intelligent anti-burn, equipped with 500mA automatic recovery insurance, automatic disconnection of current over 500mA, protect your device and USB port, even if it is short circuit will not affect, after the circuit is normal, you can restore the link.
CP2102 chip: USB interface chip CP2102, high stability and high performance, communication speed up to 2Mbps.
The TTL level is compatible with the 3V3 level standard. It comes with 5V and 3.3V, 4.2V power output ports, which can supply power to the MCU system. The DTR/RTS output interface can be reserved, and the level of the two pins can be overridden through the serial port. When some MCUs download the program, the reset can be completed automatically.
Two-color LED indicator: The indicator light is red and blue respectively to indicate the working status of the module. The TX and RX lamps will flash when there is data transmission, and the transmission status is clearly visible.
3V3/4V2 output selection switch: defaults to output 3.3V from V0 port, short circuit 3V3/4V2, output 4.2V from V0 port, 5V interface directly output 5V.

So the 3V3 might be a bit unreliable.
OR
Have you set the output selection switch?

Tom... :smiley: :+1: :coffee: :australia:

My guess: missing decoupling. I repeat myself: Show us the wiring diagram/schematics of your setup!

And couple of images of your project so we can see your component layout.

Thanks.. Tom.. :smiley: :+1: :coffee: :australia::santa:

Hi,
I connect 3.4v and GND of my external power source to VCC/GND pin of Atmega. RX0/TX0 of Atmega to USB/TTL and connect USB/TTL's GND Pin to Atmega's GND pin.

If I supply below 3.4v, Serial will be garbage.

As I guessed: missing decoupling. Of course given that micro-description is the complete circuit. If not: I repeat, provide complete schematics of your setup!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.