CM Panel technical documentation Buy

Using the RS232/485/422 port of CM-Panel POE

CM-Panel POE is equipped with a serial port capable of operating in three different modes: RS232, RS485, and RS422.

Please note that the J15 serial port is physically equal to the POE connector but the signals they carry are vastly different and not interchangeable.
!! Connecting the wrong cables can lead to device malfunctions, data corruption, or even hardware damage !!

The image displayed below illustrates the locations of the J15 serial port connector and SW1 dip switch

The operational mode of the serial port can be selected through a 4-position DIP switch.

Serial port is visible in Linux as /dev/ttyAMA0 device.

Check the file /boot/config.txt to see if these lines are present:

# RS232/RS485/RS422 port on /dev/ttyAMA0 
force_turbo=1
dtoverlay=uart0,txd0_pin=36,rxd0_pin=37,pin_func=6

If not insert them and reboot.

Set the RS232 Mode

Dip switch positions:

SW1 1 OFF
SW1 2 OFF
SW1 3 OFF
SW1 4 OFF

Pinout:

J15 2 RXD
J15 3 GND
J15 6 TXD

Set the RS485 full duplex mode (RS422)

Dip switch positions:

SW1 1 ON
SW1 2 OFF
SW1 3 OFF=No termination - ON=120 ohm termination
SW1 4 OFF=Normal - ON=Limited slew rate limited

Pinout:

J15 2 A
J15 3 GND
J15 4 B
J15 5 Y
J15 6 Z

Set the RS485 half duplex mode

Dip switch positions:

SW1 1 ON
SW1 2 ON
SW1 3 OFF=No termination - ON=120 ohm termination
SW1 4 OFF=Normal - ON=Limited slew rate limited

Pinout:

J15 3 GND
J15 5 A
J15 6 B

RS485 Python example

import RPi.GPIO as GPIO
import serial
import time

DE_pin = 38 # Driver enable pin

GPIO.setmode(GPIO.BCM)
GPIO.setup(DE_pin, GPIO.OUT)

ser = serial.Serial('/dev/ttyAMA0', 115200) 

def send_data(data):
    GPIO.output(DE_pin, GPIO.HIGH)  # Enable sending mode
    ser.write(data.encode())  # Send data
    ser.flush()  # Ensure all data is sent
    GPIO.output(DE_pin, GPIO.LOW)  # Disable sending mode

try:
    send_data("Hello from RS485")  # Send a string
finally:
    GPIO.cleanup()  # Clean up GPIO on exit

Links


Products related

CM-Panel-Basic

Features Index Buy

All-in-one 7 inch touch WiFi terminal powered by Raspberry Pi CM4S
  • 7 inch TFT display 800x480
  • Capacitive touch
  • MIPI Camera connector
  • WiFi @ 2.4 GHz
CM-Panel-POE

Features Index Buy

All-in-one 7 inch touch POE terminal powered by Raspberry Pi CM4S
  • 7 inch TFT display 800x480 pixel
  • Capacitive touch
  • Embedded micro UPS for safe shutdown
  • Power Over Ethernet @ 10/100 Mbit
  • Hi-resolution audio up to 384KHz@32bit
  • Real Time Clock with backup battery
  • 3 USB Host port
  • 1 RS485/422/RS232 port
  • 1 Relay
  • MIPI Camera connector
  • WiFi @ 2.4 GHz (optional)
CM-Home

Features Index Buy

Home Automation board powered by Raspberry Pi CM4S lite module
  • Power-in @ 12 to 24VDC
  • Double opto-isolated RS-485 ports
  • 2 relays
  • 2 USB 2.0 host port
  • Ethernet port at 10/100Mbit
  • MIPI Camera connector
  • Stereo audio out on 3.5 mm jack

Home page CM Panel technical documentation Buy