# Raspberry Pi 3B+ UART serial port connection



## serjsk8 (Mar 28, 2020)

Hello,
I have Raspberry Pi 3B+ with FreeBSD 12.1-RELEASE r354233 GENERIC  arm64 installed on it.
And I tried to connect to serial port and see the boot process and have access to terminal.
I had connected USB-RS232 adapter (PL2303), USB port to my laptop and DB9 port to UART Pins: Pin8(TX), Pin10(RX) and Pin6(GRN) on RPi 3B+.
I have an adapter like this USB 2,0 - RS-232 (9-pin) DB9 Cable FTDI Chipset
After connect DB9 port to UART Pins on the adapter has turned on Green LED.
On my Raspberry Pi 3B+ I have this configuration:

```
# dmesg | grep uart
uart0: <PrimeCell UART (PL011)> mem 0x7e201000-0x7e201fff irq 25 on simplebus0
uart0: console (115200,n,8,1)
```


```
# cat /etc/ttys | grep ttyu0
ttyu0    "/usr/libexec/getty std.9600"    vt100    on  secure
#ttyu0    "/usr/libexec/getty 3wire"    vt100    onifconsole  secure
```


```
#cat /boot/loader.conf
boot_multicons="YES"
boot_serial="YES"
comconsole_speed="9600"
console="comconsole,vidconsole"
```


```
# cat /boot/msdos/config.txt 
arm_control=0x200
dtparam=audio=on,i2c_arm=on,spi=on
dtoverlay=mmc
dtoverlay=pwm
dtoverlay=pi3-disable-bt
device_tree_address=0x4000
kernel=u-boot.bin
baudrate=9600
console=ttyu0,9600
```

That's makes me think that something is wrong, ttyu0 don't show me some information

```
# stty -a < /dev/ttyu0
^C
```



On my Laptop side:


```
# stty -a -F /dev/ttyUSB0

speed 9600 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>;
start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O;
min = 100; time = 2;
```


```
# setserial -g /dev/ttyUSB0
/dev/ttyUSB0, UART: 16654, Port: 0x0000, IRQ: 0
```

Now I reboot RPi and in my Laptop y connect to ttyUSB0 like this:

```
screen /dev/ttyUSB0 9600
```
I can see junk characters y nothing more:

```
�`P��'oĎ7�473���ag�f� ��"
                         &�("
```
When I connected again I have only black screen.

I have lost some configuration in the part of RPi 3B+?

Best regards,


----------



## Phishfry (Mar 28, 2020)

serjsk8 said:


> uart0: console (115200,n,8,1)


Well the uart is showing 115200. Why are you using 9600 baud in your settings?
The special characters you are showing are a tell.


----------



## serjsk8 (Mar 29, 2020)

Hello *Phishfry,*
Yes, I want to try use 9600 Baud Rate.
Because in the future I want to use UART pins for connect some peripheral device.
I have thought that with my settings I have changed Baud Rate to 9600
You are right, my config has not worked.


----------



## msplsh (Mar 29, 2020)

firmware/README at master · raspberrypi/firmware
					

This repository contains pre-compiled binaries of the current Raspberry Pi  kernel and modules, userspace libraries, and bootloader/GPU firmware. - firmware/README at master · raspberrypi/firmware




					github.com
				




I set these things in config.txt for 115200, maybe this will help you go in the right direction

```
init_uart_clock=3000000
    (IDK if you need this one anymore with core_freq and pi3-disable-bt which is in there by default)
enable_uart=1
core_freq=250
```


----------



## serjsk8 (Mar 30, 2020)

I tried to leave everything with 115200 Baud Rate.

```
# dmesg | grep uart
uart0: <PrimeCell UART (PL011)> mem 0x7e201000-0x7e201fff irq 25 on simplebus0
uart0: console (115200,n,8,1)


# cat /boot/loader.conf
boot_multicons="YES"
boot_serial="YES"
comconsole_speed="115200"
console="comconsole,vidconsole"

# cat /etc/ttys | grep ttyu0
ttyu0    "/usr/libexec/getty 3wire.115200"    vt100    on  secure

# cat /boot/msdos/config.txt
arm_control=0x200
dtparam=audio=on,i2c_arm=on,spi=on
dtoverlay=mmc
dtoverlay=pwm
dtoverlay=pi3-disable-bt
device_tree_address=0x4000
kernel=u-boot.bin
```

Before ttyu0 don't show me some information.
It's was like this:

```
# stty -a < /dev/ttyu0
^C
```

I had initialized communications port parameters:

```
stty -f /dev/ttyu0.init -icanon -isig -echo echoe echok echoke echoctl -icrnl -ixany -imaxbel ignpar -opost -onlcr -oxtabs cs8 -parenb -hupcl clocal
```
And now I can see Baud Rate and etc.

```
# stty -a < /dev/ttyu0
speed 115200 baud; 0 rows; 0 columns;
lflags: -icanon -isig -iexten -echo -echoe -echok -echoke -echonl
    -echoctl -echoprt -altwerase -noflsh -tostop -flusho -pendin
    -nokerninfo -extproc
iflags: -istrip -icrnl -inlcr -igncr -ixon -ixoff -ixany -imaxbel -ignbrk
    -brkint -inpck -ignpar -parmrk
oflags: -opost onlcr -ocrnl tab3 -onocr -onlret
cflags: cread cs8 -parenb -parodd hupcl clocal -cstopb -crtscts -dsrflow
    -dtrflow -mdmbuf
```

But still have the same junk characters.

Hello *msplsh,*



msplsh said:


> init_uart_clock=3000000 (IDK if you need this one anymore with core_freq and pi3-disable-bt which is in there by default) enable_uart=1 core_freq=250



I have not understood that part well.


----------



## eldaemon (Mar 31, 2020)

I just connected to a Pi 2 B today. No issues at all with 12.1 and I didn't have to configure anything. I got garbage characters until I hooked up the ground. I didn't hookup power.


----------



## msplsh (Mar 31, 2020)

serjsk8 said:


> I have not understood that part well.



You need those in config.txt to yank the bluetooth off the UART and put the serial port on there.  They've obviously updated the docs since then, but I don't know if the RPi build has picked up the changes.


----------

