jblumenkamp
Posts: 4
Joined: Sat Aug 11, 2018 11:46 am

Using both UARTs in the Raspberry Pi Compute Module 3?

Sat Oct 20, 2018 2:23 pm

Hello everyone,
I want to use both integrated UARTs in the Raspberry Pi Compute module, but unfortunately I can't get it running... I already enabled the uart in the config.txt, and it appears as /dev/ttyS0. I connected RX and TX (loopback) in order to verify the functionality.
Now, the funny thing is, after a reboot, I can send with echo test > /dev/ttyS0. But as soon as I do cat /dev/ttyS0 in a new terminal window, I can send echo one or two more times, but then echo never terminates. In the cat terminal, nothing appears, i.e. nothing is received. I verified the tx line with an oscilloscope, but nothing is sent. echo keeps running, even if I terminate cat. If I run stty now, it either never terminates or takes longer than in the beginning to terminate...
Here are some information that might be helpful:

/boot/config.txt:

Code: Select all

# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
#disable_overscan=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720

# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800

# Uncomment some or all of these to enable the optional hardware interfaces
dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on

# Uncomment this to enable the lirc-rpi module
#dtoverlay=lirc-rpi

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)
dtparam=audio=on
dtoverlay=pi3-disable-bt
enable_uart=1
dtoverlay=w1-gpio
start_x=1
gpu_mem=128

core_freq=250

#gpio=31=a5
#gpio=32=a5
#gpio=33=a5

dtoverlay=uart1,txd1_pin=32,rxd1_pin=33
/boot/cmdline.txt:

Code: Select all

dwc_otg.lpm_enable=0 console=tty1 root=PARTUUID=5612b652-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
gpio readall: (pin 32 und 33, RX and TX, are registered as ALT5)

Code: Select all

+-----+------+-------+      +-----+------+-------+
| Pin | Mode | Value |      | Pin | Mode | Value |
+-----+------+-------+      +-----+------+-------+
|   0 | IN   | High  |      |  27 | IN   | Low   |
|   1 | IN   | High  |      |  28 | IN   | High  |
|   2 | ALT0 | High  |      |  29 | IN   | High  |
|   3 | ALT0 | High  |      |  30 | IN   | Low   |
|   4 | IN   | High  |      |  31 | IN   | Low   |
|   5 | OUT  | Low   |      |  32 | ALT5 | Low   |
|   6 | OUT  | Low   |      |  33 | ALT5 | Low   |
|   7 | OUT  | Low   |      |  34 | IN   | High  |
|   8 | OUT  | Low   |      |  35 | IN   | High  |
|   9 | IN   | Low   |      |  36 | IN   | High  |
|  10 | IN   | Low   |      |  37 | IN   | Low   |
|  11 | IN   | Low   |      |  38 | IN   | Low   |
|  12 | IN   | Low   |      |  39 | IN   | Low   |
|  13 | IN   | Low   |      |  40 | IN   | Low   |
|  14 | ALT0 | High  |      |  41 | IN   | Low   |
|  15 | ALT0 | Low   |      |  42 | IN   | Low   |
|  16 | IN   | High  |      |  43 | IN   | Low   |
|  17 | IN   | High  |      |  44 | IN   | Low   |
|  18 | IN   | High  |      |  45 | IN   | Low   |
|  19 | IN   | Low   |      |  46 | IN   | High  |
|  20 | IN   | Low   |      |  47 | OUT  | High  |
|  21 | IN   | Low   |      |  48 | ALT0 | Low   |
|  22 | IN   | Low   |      |  49 | ALT0 | High  |
|  23 | IN   | Low   |      |  50 | ALT0 | High  |
|  24 | IN   | Low   |      |  51 | ALT0 | High  |
|  25 | IN   | Low   |      |  52 | ALT0 | High  |
|  26 | IN   | Low   |      |  53 | ALT0 | High  |
+-----+------+-------+      +-----+------+-------+
uname -a:

Code: Select all

Linux forarex-obc 4.14.74-v7+ #1149 SMP Mon Oct 8 17:39:42 BST 2018 armv7l GNU/Linux
stty -F /dev/ttyS0 -a

Code: Select all

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 = 1; time = 0;
-parenb -parodd -cmspar cs8 hupcl -cstopb cread clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel -iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke -flusho -extproc
I am looking forward to any suggestions!
Best,
Jan

EDIT:
Nevermind, it seems to have been a hardware problem with the connected RS485 transceiver. It would still be good to know what options in the config.txt are really required for a proper operation as of now, since I can't really find any information about it.

EDIT2:
stty still does not terminate sometimes. What might be the problem here?

JBDynamics
Posts: 6
Joined: Tue Sep 25, 2018 2:11 pm
Location: Denver, CO, USA

Re: Using both UARTs in the Raspberry Pi Compute Module 3?

Sun Oct 21, 2018 4:22 pm

What does your device tree blob file look like? I'm not 100% sure this would be required, but you may need to roll your own device tree blob: defining function = "uart1" for p32 and p33 with an 8mA drive strength and pullup on the RX pin 33.

You should have something like this:

Code: Select all

[email protected] { function = "uart1";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // TX
[email protected] { function = "uart1";  termination = "pull_up"; drive_strength_mA = < 8 >; }; // RX

Return to “Compute Module”