Weird characters in serial minitor[SOLVED]

Once I uploaded the UltrasonicDisplayOnTerm to Arduberry, I opened the minicom serial monitor. However, instead of receiving readings as numbers, I received some weird characters. Does anyone know what happened and how to solve this?

It might be that the baud rate is incorrectly/different on the Serial monitor that on the Arduberry. An easy way to check this would be to write a sketch on the Arduberry which prints something like “Hello” on the serial port at 9600 baud and then open minicom with minicom -s and set up the Serial port to work at 9600 baud in minicom and see that it works properly.

-karan

I have uploaded readanalogvoltage program, it still has the same issue. I have checked that the configuration of minicom and it is indeed 9600. Our programs are also 9600 (see first attachment).

update today: I wrote a simple ‘Hello World’ program in Arduino IDE. I found that when I change the baud of serial monitor to 1200 while keeping the code in sketch to use Serial.begin(9600), the Hello world gets printed correctly. Otherwise, the output on serial monitor are garbled, this also happens when I keep both serial monitor and sketch as 9600. I think there is a clock mismatch between the serial monitor and sketch. I am suspecting that the clock rate in the boards.txt configuration for arduino is incorrect for atmega328. Atmega328 has a max 20MHZ but in the boards.txt it only says 12MHZ (see second attachment). I am using the Raspberry Image from Dexter and all the software are up to date using the update program came with Dexter raspberry image.

Do you think it is the problem with boards.txt (/usr/share/arduino/hardware/arduino) configuration? If so, how should I change it?

Really good point. You might try changing the .fcpu line to 16000000L; the oscillator is set to 16 mhz.

I’m going to have to find my Arduberry and give this a shot, but that and the fuse settings on the Arduberry should be the standard Arduino fuses:

low_fuses=0xff
high_fuses=0xde
extended_fuses=0x05

Thanks John. I have made the change in the boards.txt, saved the file, restarted respberry, but the issue remains the same. When I use 9600 baud in sketch, the serial monitor only works if I set it to 1200 baud, otherwise, the serial monitor will show garbled content. I am now guessing that probably I need to do something to apply the changes. I double check the boards.txt and I confirm that it does have the new values, but still nothing in serial monitor changed.

Just realized the images of the configs that I attached below is for a different board. I did the change for the Arduino Uno board as well, nothing changed at all. Same issue.

Below are the old values in the boards.txt. I have already updated them with the values you suggested.
Old values
.fcpu = 12000000L
low_fuses=0xE7
high_fuses=0xDA
extended_fuses=0x07

Can you check in the Tools->Boards option in the Arduino IDE and check which board you are using. You should also try selecting the Arduino UNO as the board in the Tools->Boards section and see if that helps.

Hi Karan, I am using the Arduino Uno boards always. As you can see from my screen shots above, I am always using Arduino Uno boards with ttySO port.

Can you run these 3 commands in the terminal: avrdude -c gpio -p m328p -U lfuse:w:0xFF:m, then avrdude -c gpio -p m328p -U hfuse:w:0xDA:m and finally this:
avrdude -c gpio -p m328p -U efuse:w:0x05:m and see if it works any better. Can you post the screenshots of what you get after running the commands here too if it does not work.

Hi Karan! Thank you very much, these 3 commands did their magic. It is working now :slight_smile: When I select 9600 baud rate I get the correct display! Attached are the screenshots after running the commands.