WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Serial Console  (Read 13111 times)

Offline M-H

  • Newbie
  • *
  • Posts: 24
Serial Console
« on: June 08, 2017, 06:46:19 PM »
For off grid debugging I need serial access to my pi without relying on networks.
I got myself a ttl serial to USB converter that allows me to plug into the pi directly ( and powering it with 1 extra wire )
In :
Code: [Select]
Linux piCorePlayer320-128 4.9.21-pcpCore #1 Thu Apr 13 19:26:09 EDT 2017 armv6l GNU/LinuxI added
Code: [Select]
/sbin/getty -L ttyAMA0 115200 vt100 &in the start of in /opt/bootlocal.sh
to enable a console before lots of other things are started , and all that works.

But I can not see any ( regular) boot output stating info before the bootlocal.sh is executed.
Can someone enlighten me with the missing part ?
Is it perhaps the picoreplayer kernel ?

Thanks M-H

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11037
Re: Serial Console
« Reply #1 on: June 09, 2017, 04:38:51 AM »
To get that, you have to add the proper console= bootcode.
The only barriers that can stop you are the ones you create yourself.

Offline M-H

  • Newbie
  • *
  • Posts: 24
Re: Serial Console
« Reply #2 on: June 09, 2017, 06:25:18 AM »
Thank you for the reply curaga,

Would this be a part of cmdline.txt  in /mnt/mmcblk0p1 ?
And if so, where can I find more info on those options / syntax etc ?

Greetz M-H

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: Serial Console
« Reply #3 on: June 09, 2017, 06:34:23 AM »

Would this be a part of cmdline3.txt  in /mnt/mmcblk0p1 ?


Or cmdline.txt for RPi3, depending on RPi board you are using.
« Last Edit: June 09, 2017, 07:11:49 AM by bmarkus »
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline Misalf

  • Hero Member
  • *****
  • Posts: 1702
Re: Serial Console
« Reply #4 on: June 09, 2017, 06:53:17 AM »
I believe bmarkus meant to say
cmdline3.txt for RPi3 ...
Download a copy and keep it handy: Core book ;)

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: Serial Console
« Reply #5 on: June 09, 2017, 07:11:20 AM »

Would this be a part of cmdline.txt  in /mnt/mmcblk0p1 ?


Or cmdline.txt for RPi3, depending on RPi board you are using.

Yes, corrected. Thanks!
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11037
The only barriers that can stop you are the ones you create yourself.

Offline M-H

  • Newbie
  • *
  • Posts: 24
Re: Serial Console
« Reply #7 on: June 09, 2017, 03:35:57 PM »
Thanks guys,

As a write-up:

Add
Code: [Select]
console=ttyAMA0,115200to /mnt/mmcblk0p1/cmdline.txt

to enable the boot output over GPIO UART on a pi zero.
In my situation I had to remove other console= statements to get it working properly.

Greetz M-H


Offline patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 705
Re: Serial Console
« Reply #8 on: June 09, 2017, 04:50:51 PM »
Also you can read this, to config the console uart. in the config.txt.

https://www.raspberrypi.org/documentation/configuration/uart.md

Offline M-H

  • Newbie
  • *
  • Posts: 24
Re: Serial Console
« Reply #9 on: June 11, 2017, 05:32:40 PM »
Thanks Patrickg.
Good reading stuff.
I did not realise we had 2 uarts and they swap task based on the Bluetooth usage  in the pi3 /zero-W , until now.

For the piCore cracks; please state if the info in https://www.raspberrypi.org/documentation/configuration/uart.md
is fully valid for the piCore versions.

Regards M-H

Offline kmhill

  • Jr. Member
  • **
  • Posts: 64
Re: Serial Console
« Reply #10 on: September 21, 2017, 01:35:54 AM »
Hi folks;

I'm trying to get serial communications working with my RasPi-zero and having mixed results.

I looked in cmdline.txt and found that in the current TC, the bootcode for the console is already there. I then inserted the /sbin/getty line at tthe end of the bootlocal.sh file, as described earlier in the thread.

I connected a USB-serial adapter from a netbook running Win7 and TeraTerm-Pro to the RasPi-zero. Upon booting I see the various boot messages (good sign), then nothing. Then, when I press keys on the netbook, the characters are echoed back. I double-checked that the local-echo feature is disabled, so it appears that the RasPi-zero is echoing characters back.

Please, any ideas?

Offline kmhill

  • Jr. Member
  • **
  • Posts: 64
Re: Serial Console
« Reply #11 on: September 22, 2017, 09:22:39 PM »
Hi folks, I went back and rechecked prior notes. Jefferee mentioned in a thread started on August 16, 2017, that in the bootlocal.sh file he commented out the stock serial terminal startup and on a machine he's using as a server, that he added a line to start an external script

/opt/serialtty.sh &

I typed in his script but also inserted at the top an echo command (echo "Hello from serialtty.sh") to verify that the script actually starts. Then I used chmod +x to make the script executable.

So, now when the RasPi boots, I can see from the serial terminal that the serialtty.sh script is executed, but again, once the system is booted, all I'm seeing is characters being echoed back... I'm still stuck.



Offline kmhill

  • Jr. Member
  • **
  • Posts: 64
Re: Serial Console
« Reply #12 on: September 22, 2017, 11:34:29 PM »
Just made progress... In digging about I found a comment about ttyAMA0 versus ttyS0. Apologies, I missed that before... So, to check what device file is in use when the file is booted, I used echo to send a message back from the RasPi-zero. So, the message made it back to the terminal...(yippee).

$ echo "Hello!" > /dev/ttyS0

So, I guessed that in booting, the kernel ignores the named device file. In the cmdline.txt file I changed the console boot code to the following and found that the system boots the same way...

console=ttyS0,115200

Next, I changed in /opt/serialtty.sh the reference to /dev/ttyAMA0 to /dev/ttyS0
So, now when I reboot I see the login prompt. To honor this moment, I went to the screen, keyboard, and mouse, and used sudo passwd tc to assign a new password. The serial port appears to work now...

Yeah!  Krista

--------------------- serialtty.sh follows, modified version

#!/bin/sh

echo "serialtty.sh"

# Start serial terminal on Raspberry Pi
while :
do
  /sbin/getty -L /dev/ttyS0 115200 vt100
done
« Last Edit: September 23, 2017, 03:51:02 PM by Rich »

Offline patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 705
Re: Serial Console
« Reply #13 on: September 23, 2017, 01:54:32 AM »
Yeah and one more thing, you may also do it like the linux way, remove the startserialtty.sh and serialtty.sh
Edit the correct file that start the console terminal... like this threads.

But be careful to edit this files... so you don't cut out your self from console.

http://forum.tinycorelinux.net/index.php/topic,20701.msg129231.html#msg129231

http://forum.tinycorelinux.net/index.php/topic,20831.msg130117.html#msg130117

http://forum.tinycorelinux.net/index.php/topic,19810.msg129729.html#msg129729
« Last Edit: September 23, 2017, 02:18:34 AM by patrikg »

Offline kmhill

  • Jr. Member
  • **
  • Posts: 64
Re: Serial Console
« Reply #14 on: September 23, 2017, 01:22:17 PM »
Hi patrikg, just had my first try and:
  • In bootlocal.sh I commented out the call to serialtty.sh
  • used sudo editor to edit /etc/inittab
  • In /etc/inittab there was already a line for tty1, no idea why that's there
    tty1::respawn:/sbin/getty -nl /sbin/autologin 38400 tty1
  • I inserted a new line into  /etc/inittab
    ttyS0::respawn:/sbin/getty -L 115200 /dev/ttyS0 vt100
  • added /etc/inittab to the system backup list
  • there is a console output line that I don't understand yet
    login[1046] : root login on 'tty1'

I'm sure that I'm missing something