Gibberish output on serial console, Arduino Pro Mini ATmega 328P

Hello,

I’m a first time user of Arduino, got Arduino Pro Mini board 3.3V 8MHz based on ATmega 328P. Board connected to laptop USB port via USB to Serial breakout board built on the FT232RL FTDI chip.
I use Arduino Web Editor and managed to upload JTAGenum project sketch to the Arduino. The baud rate of the serial console has been set 115200, as required for project code. When I opened terminal and tried run test commands I got just gibberish or garbage characters on the output.

Not sure whether this issue can be caused by incorrect F_CPU settings, or by other reason.
In board description was noted that clone board is ATmega328P 3.3V 8MHz. When I use Arduino Web Editor, it detects this kind of board as ‘16MHz ATmega328’ in FLAVOUR menu. Boards > Arduino Pro or Pro Mini > FLAVOUR > 16MHz ATmega328. When I manually selected 8MHz ATmega328 kind, then connection with board missing (red cross), so I should click on ‘Arduino Pro or Pro Mini’ menu and it sticks back to the ‘16MHz ATmega328’ type.
Can it be chance that board actually is 16MHz, not 8MHz? If yes, how to test board to detect this exactly?

The project have code that cuts clock in half for 3.3v AVR boards, its uncommented:

// For 3.3v AVR boards. Cuts clock in half. Also see cmd in setup()
#define CPU_PRESCALE(n) (CLKPR = 0x80, CLKPR = (n))

void setup(void)
{
// Uncomment for 3.3v boards. Cuts clock in half
// only on avr based arduino & teensy hardware
CPU_PRESCALE(0x01);
Serial.begin(115200);
}

You have not posted the program that produced all the gibberish so how are we supposed to help?

I suggest you write a short program that prints "Hello World" once per second and get that to work properly.

If you think you have programmed an Atmega328 with the wrong CPU speed try setting the baud rate in the serial monitor to half or double what you think it should be.

...R

Hi,
Have you tried different serial monitor screen speeds due to the different clock speed?

Tom.. :slight_smile:

TomGeorge: Hi, Have you tried different serial monitor screen speeds due to the different clock speed?

Tom.. :)

Hi,

The code I tried to run JTAGenum program. It's just my assumption that board is 16MHz, not 8MHz, I'm not fully sure. I will try with 57600 baud rate.

minto:
It’s just my assumption that board is 16MHz, not 8MHz

It would be a good idea to actually know this, don’t you think?
There’s probably a crystal (silvery oval component) on the board - check what’s written on that. This should be your clock speed. After that, set your IDE to the correct speed as otherwise all timing such as millis(), micros(), delay() and the internal clock are also off.

marking on a crystal, seems '80 f.'

minto: The code I tried to run JTAGenum program.

Like I said in Reply #1, just write a short program to test the communication with the Serial Monitor.

...R

I changed the terminal baud rate to 57600 and it works now. The baudrate in project code (115200) and in terminal (57600) didn't match: not clear, what does it mean?

Hi, Probably you have a 8MHz crystal or resonator, rather than a 16Mhz. So clock speed is half that expected.

Tom.. :)

Hi,

It seems that Arduino Create Plugin auto-detect this board incorrectly? It detects it as 16MHz board.

Hi, Where did you purchase the Pro Mini? Is it a clone, or an Arduino product?

Tom.. :)

It is a clone.

Hi, Well I would say its the fact that it is a clone, that gives you the incorrect CPU speed.

I think the create software does not test the 328 to see if it is 16Mhz or 8MHz, but interrogates a register in the 328. The clone manufacturer has been too lazy to rewrite the register, it may even be in the 328 bootloader.

Tom.. :) PS Put a sticker/label on your PCB noting that it is 8MHz.

minto:
I changed the terminal baud rate to 57600 and it works now. The baudrate in project code (115200) and in terminal (57600) didn’t match: not clear, what does it mean?

That’s what I suggested in Reply #1 :slight_smile:

…R

Robin2:
That’s what I suggested in Reply #1 :slight_smile:

…R

Yes, that’s true. But anyway, the clone board works unstable with Arduino Create Plugin. I want to fix this, should I flash a new stock bootloader 8MHz?

minto: Yes, that's true. But anyway, the clone board works unstable with Arduino Create Plugin. I want to fix this, should I flash a new stock bootloader 8MHz?

I don't know what "Arduino Create Plugin" is but it is certainly a good idea to upload a new bootloader if you suspect a problem. Nick Gammon's tutorial explains all.

...R