WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Pi4B serial console  (Read 477 times)

Offline gh

  • Newbie
  • *
  • Posts: 5
Pi4B serial console
« on: July 19, 2022, 01:36:17 AM »
Appologies in advance for my poor linux skills, I am trying to get a serial console on the Pi4B I can get console output during the boot sequence but anything I type uin the console is echoed back and backspace becomes ^H, it is like there  is no command processor.
I tried also uart3 and see the same behaviour with uart0 and uart3

in config.txt under [ALL] I have:
Code: [Select]
dtoverlay=disable-bt
enable_uart=1
dtoverlay=uart3

in cmdline.txt I have:
Code: [Select]
console=tty1
console=ttyAMA1,9600

here is the console output on boot from uart3
Code: [Select]
Booting Core 13.0.3
Running Linux Kernel 5.10.16-piCore-v7l.
Checking boot options... Done.
Starting udev daemon for hotplug support... Done.
Scanning hard disk partitions to create /etc/fstab
Setting Language to C Done.
Skipping rtc as requested from the boot command line.
Possible swap partition(s) enabled.
Loading extensions... Done.
Setting keymap to us Done.
Restoring backup files from /mnt/mmcblk0p2/tce/mydata.tgz -
Done.
Setting hostname to box Done.
login[913]: root login on 'tty1'

^H

the ^H above is from my typing a backspace
I am missing something, ssh login works fine, any thoughts?
Kind regards
gh

    [EDIT]:  Added code tags.  Rich
« Last Edit: July 19, 2022, 05:26:23 AM by Rich »

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 10364
Re: Pi4B serial console
« Reply #1 on: July 19, 2022, 05:28:51 AM »
Hi gh
Please use  Code Tags  when posting commands and responses seen in a terminal. To use  Code Tags  click on the  #  icon
above the reply box and paste your text between the  Code Tags  as shown in this example:

Quote
[code][   36.176529] pcm512x 1-004d: Failed to get supply 'AVDD': -517
[   36.176536] pcm512x 1-004d: Failed to get supplies: -517
[   36.191753] pcm512x 1-004d: Failed to get supply 'AVDD': -517[/code]

It will appear like this in your post:
Code: [Select]
[   36.176529] pcm512x 1-004d: Failed to get supply 'AVDD': -517
[   36.176536] pcm512x 1-004d: Failed to get supplies: -517
[   36.191753] pcm512x 1-004d: Failed to get supply 'AVDD': -517

Code Tags  serve as visual markers between what you are trying to say and the information you are posting. They also preserve
spacing so column aligned data displays properly. Code tags also automatically add horizontal and or vertical scrollbars
to accommodate long lines and listings.

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 842
Re: Pi4B serial console
« Reply #2 on: July 19, 2022, 05:36:10 AM »
Did you start a session on the serial console?

Offline gh

  • Newbie
  • *
  • Posts: 5
Re: Pi4B serial console
« Reply #3 on: July 19, 2022, 07:31:37 AM »
understood about the code tags, appologies.
I tried the return key, the key is echoed back to my terminal but there is no prompt and no linux commands work at all

Offline patrikg

  • Sr. Member
  • ****
  • Posts: 495
Re: Pi4B serial console
« Reply #4 on: July 19, 2022, 07:46:14 AM »
Take a look at this thread to the links, to see if something is you can use to problem solving.

http://forum.tinycorelinux.net/index.php/topic,25430.msg162778.html#msg162778

And you can search in this forum for uart and serial, but i think you can get best result of reading the
raspberry pi own forum site, link in the thread above.


Offline gh

  • Newbie
  • *
  • Posts: 5
Re: Pi4B serial console
« Reply #5 on: July 19, 2022, 08:15:24 AM »
Thanks Patrikg, that fixed it, editing /etc/inittab and adding the required tty entry did the trick
here's the edit if anybody else has this issue, this example works on both serial0 and serial3
Code: [Select]
tty2::respawn:/sbin/getty 9600 ttyAMA0 vt100
tty3::respawn:/sbin/getty 9600 ttyAMA1 vt100

Thanks Guys
Kind regards
GH

Offline patrikg

  • Sr. Member
  • ****
  • Posts: 495
Re: Pi4B serial console
« Reply #6 on: July 19, 2022, 01:21:21 PM »
You welcome, thanks for telling me and the forums members that your problem was solved.

And your linux skills are more than average.
Even if you follow my commands for unpacking and packing the initrd. And edit the file inside.
bmarcus has also make a script (startserialtty) for serial tty for picore, but i think this way is more correct.
You don't need to spawn some shell for spawning some tty, waste of memory.
Here some thread talking about it.

http://forum.tinycorelinux.net/index.php/topic,23404.msg146663.html#msg146663

And if you want more debug on uart you can also modify the bootcode.bin file for more fun.

I found the following documentation about enabling more debug during booting:

https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#bootcode-bin-uart-enable

It tells me to query

Code: (bash) [Select]
$ strings bootcode.bin | grep BOOT_UART
BOOT_UART=0

To enable UART from bootcode.bin use:

Code: (bash) [Select]
sed -i -e "s/BOOT_UART=0/BOOT_UART=1/" bootcode.bin
« Last Edit: July 19, 2022, 01:44:16 PM by patrikg »