2

I'm experimenting with upstream kernel and now I try to get serial console working. I'm getting only garbage symbols when I try to communicate:

enter image description here

I think it is important to notice that I only get garbage when I send something or when RPi send something back, not constantly.

It is also not a baud rate problem because same baud rate is valid when I use default RPi kernel. Therefore it is also not a cable problem, because serial console works well using default kernel or Raspbian OS.

I found out that different parameters like core_freq or enable_uart could help, so I tried them with no success.

Here is my config.txt:

# gpu_mem=64
kernel=Image
core_freq=250
enable_uart=1
arm_64bit=1
initramfs initramfs-linux.img followkernel

and cmdline.txt:

root=UUID=[deleted] rw rootwait console=ttyS1,115200 console=tty1  plymouth.enable=0

Kernel version 5.7

  • 2
    I can't see a question. This is not the correct place to report a kernel bug if that is what you are doing. – joan Jun 6 at 20:38
  • @joan How can I understand if it is a kernel bug or not? That's why I came here, because I get behavior that I can't explain or understand. – aryndin Jun 6 at 23:20
  • There could be many reasons for this behaviour. First and most obvious is the incorrect or not matching baudrate. In both ends of the line should be exactly same frequency - if not, it looks like in your screenshot. – tswaehn Jun 7 at 7:58
  • Another thing could be the overlays in RPI. Please note that there are two options for uart. One is attached over usb the other is a direct hardware uart. Enabling both at the same time offers you clash. – tswaehn Jun 7 at 8:01
  • 1
    @tswaehn please, refer my comment raspberrypi.stackexchange.com/questions/113198/…. Also, how can I "adjust the prescaler for uart?" – aryndin Jun 7 at 10:17
2

Only for the completeness: first check your connection as shown at What is the correct way to connect serial console on RPi4 Model B?. But I believe you are right.

As I see you are experimenting with the 64 bit version of the Raspberry Pi OS in addition with an init ramdisk. First you should verify that your serial console is working as expected. Download the Raspberry Pi OS beta test version and configure it as shown at Run 64-bit Raspberry Pi OS beta test version. In addition to that settings add the option enable_uart=1 to /boot/config.txt before starting it in a RasPi that is able to run 64 bit.

You don't tell us what serial terminal program you are using. I have made very good experience with tio, a tiny, but very stable Terminal IO program, just exactly made for a serial console. I suggest to also use it.

I can confirm that this works on my Raspberry Pi 4B. If it also works on your RasPi then you can be sure that your custom kernel or your initramfs does not work with the serial console.

| improve this answer | |
  • 1
    I have made very good experience with pico, which I prefer to use. – aryndin Jun 7 at 10:15
  • "It is not a baud rate problem because same baud rate is valid when I use default RPi (Raspbian OS) kernel." -- so serial console connected and works as expected. Also it is not a cable (connection) problem, because serial console works well using default kernel or Raspbian OS. Also, look at my config.txt, where I set core_freq=250 and enable_uart=1 – aryndin Jun 7 at 10:20
  • I'm experimenting with arch linux, not raspibian, but I use kernel provided by raspbian as reference, working kernel. – aryndin Jun 7 at 10:26
  • please note that in raspbian the device is named console=serial0; you did use ttyS1 -- could be ok. just guessing. Please also note about dtoverlay options for uart. as there are 2 uarts channels on RPI. – tswaehn Jun 7 at 10:39
  • regarding overlays: raspberrypi.org/documentation/configuration/uart.md – tswaehn Jun 7 at 10:41
1

This is a baud rate problem. You're getting a lot of x and f characters which have ASCII codes of 01111000 and 01100110 - note all bits inside those are repeated twice. The effective baud rate of your Pi should be twice as low as what you think: if your terminal is set to 115200, try setting it to 57600.

Perhaps reading the messages you're receiving (using the right baud rate) will give you a clue about the root cause.

| improve this answer | |
  • I tried even smaller baud rate, 9600 for instance, and then I get the same garbage but at very slow speed :) – aryndin Jul 24 at 13:31
  • Did you try half of the original baud rate? Setting the baud rate too low won't work. – Dmitry Grigoryev Jul 24 at 13:34
0

If hardware loopback works, then it could be clock issue. When using the analog tv out via the 3.5 mm jack on the RasPi4, then the clock gets reduced (see the RasPi documentation about overclocking). The UART seems to work properly only with HDMI output.

| improve this answer | |
  • And what is the solution of the problem? – Ingo Jul 22 at 17:27
  • @Ingo:It seems not possible to use the UART while using the analog tv out. If you want to use an UART, you have to use HDMI out (even if none is connected). – StefanProb Aug 13 at 16:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.