LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware - ARM (https://www.linuxquestions.org/questions/slackware-arm-108/)
-   -   Enable serial device /dev/serial0 (https://www.linuxquestions.org/questions/slackware-arm-108/enable-serial-device-dev-serial0-4175732480/)

Geremia 01-05-2024 05:20 PM

Enable serial device /dev/serial0
 
How do I enable the /dev/ttyAMA0, /dev/ttyS0, or /dev/serial0 devices?

I want to be able to use the GPIO 14 (TXD) and GPIO 15 (RXD) pins on a Raspberry Pi 3:
https://www.raspberrypi.com/document...-Diagram-2.png

Exaga 01-05-2024 09:52 PM

Quote:

Originally Posted by Geremia (Post 6474859)
How do I enable the /dev/ttyAMA0, /dev/ttyS0, or /dev/serial0 devices?

Edit /etc/inittab and modify the section below to enable a serial line:

Code:

# Local serial lines:
#s0:12345:respawn:/sbin/agetty -L ttyAMA0 9600 vt100
#s1:12345:respawn:/sbin/agetty -L ttyS0 9600 vt100
#s2:12345:respawn:/sbin/agetty -L ttyS1 9600 vt100


Geremia 01-05-2024 10:14 PM

Quote:

Originally Posted by Exaga (Post 6474891)
Edit /etc/inittab and modify the section below to enable a serial line:

Editing that alone (and running "init q") doesn't give me a /dev/ttyAMA0, /dev/ttyS0, or /dev/serial0 device.
Don't I need to do something in /boot/config.txt ?

Exaga 01-06-2024 01:17 AM

Quote:

Originally Posted by Geremia (Post 6474894)
Editing that alone (and running "init q") doesn't give me a /dev/ttyAMA0, /dev/ttyS0, or /dev/serial0 device.
Don't I need to do something in /boot/config.txt ?

In your /boot/config.txt file:

Code:

enable_uart=1
After ensuring that is enabled, reboot. Now what is the output of this command?

Code:

root@slackware:~# ls -l /dev/ttyAMA*
For me it's:

Code:

root@iana:~# ls -l /dev/ttyAMA*
crw-rw---- 1 root dialout 204, 74 Jan  6 03:32 /dev/ttyAMA10

I would advise you, given that you're experiencing so many issues by installing Slackware AArch64 with the SARPi installer, to use the official Slackware installer software and follow the instructions on https://docs.slackware.com/slackware...4_bcm2711_rpi4 to ensure complete success. Even though this is intended for the RPi4 it works just as well on a RPi3.

SARPi does work as intended (in most cases) but sometimes requires a little more effort, and knowledge/experience of troubleshooting the Raspberry Pi with regards to configuration settings and such. If all you want to do is get Slackware AArch64 up and running as quickly and easily as possible then the official means and methods is by far the best option. SARPi is a community driven effort for playing around and for when there are no other official options available (e.g. for the Raspberry Pi (1) & 2, etc.).

[EDIT] You will probably also need to disable BlueTooth in your /boot/config.txt file in order to get a serial line working:

Code:

dtoverlay=disable-bt

mralk3 01-06-2024 12:22 PM

Enable serial device /dev/serial0
 
Yes, disable the Bluetooth uart. If it is enabled the serial console will not work on the rpi3.

To connect use gnu screen:
Code:

screen /dev/ttyUSB0 115200
Check dmesg to see if ttyUSB0 is the serial device.

Edit: Typo, lq is hard on a Smart phone!

Geremia 01-06-2024 03:18 PM

I put
Code:

enable_uart=1
dtoverlay=disable-bt

in /boot/config.txt.

Quote:

Originally Posted by Exaga (Post 6474907)
After ensuring that is enabled, reboot. Now what is the output of this command?

Code:

root@slackware:~# ls -l /dev/ttyAMA*
For me it's:

Code:

root@iana:~# ls -l /dev/ttyAMA*
crw-rw---- 1 root dialout 204, 74 Jan  6 03:32 /dev/ttyAMA10


For me, it's:
Code:

root@raspi:~# ls -l /dev/ttyAMA*
crw-rw---- 1 root dialout 204, 64 Dec 31  1969 /dev/ttyAMA0

Why's the date so off?
Code:

root@raspi:~# date
Sat Jan  6 14:17:59 MST 2024

is normal.

Reading hangs:
Code:

$ python3
>>> import serial
>>> port = serial.Serial('/dev/ttyAMA0')
>>> port
Serial<id=0x7f944f29d0, open=True>(port='/dev/ttyAMA0', baudrate=9600, bytesize=8, parity='N', stopbits=1, timeout=None, xonxoff=False, rtscts=False, dsrdtr=False)
>>> port.write(b'AT\r')
3
>>> rcv = port.read(10)


Geremia 01-06-2024 03:22 PM

Quote:

Originally Posted by mralk3 (Post 6475010)
To connect use gnu screen:
Code:

screen /dev/ttyUSB0 115200

I don't have a /dev/ttyUSB0.
Code:

screen /dev/ttyAMA0 115200
hangs.

drmozes 01-07-2024 04:20 AM

Quote:

Originally Posted by Geremia (Post 6474859)
How do I enable the /dev/ttyAMA0, /dev/ttyS0, or /dev/serial0 devices?

I want to be able to use the GPIO 14 (TXD) and GPIO 15 (RXD) pins on a Raspberry Pi 3:
https://www.raspberrypi.com/document...-Diagram-2.png

In Slackware, Serial console support is preconfigured upon setup. Across all Raspberry Pi models, the system utilises /dev/ttyS1 for serial communication. The serial configuration is described at the foot of the Install guide.

Code:

root@mutley:~# slk-hwm-discover
Raspberry Pi 4 Model B Rev 1.4
root@mutley:~# grep -A1 serial /etc/inittab
# Local serial lines:
s0:12345:respawn:/sbin/agetty --keep-baud 115200,38400,9600 ttyS1 vt100
root@mutley:~#

Here's Slackware's RPi4 undergoing testing of Linux 6.6:

Code:

Welcome to Linux 6.6.9-armv8 aarch64 (ttyS1)

mutley login:



All times are GMT -5. The time now is 12:59 PM.