Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

RS485 in UART2 with RTS Pin

Featured Replies

Hello,

I am making a board coupled to a NanoPi Neo Core, and a RS485 converter to its UART2.

The chip is a MAX1478 and I use the RTS (PA2).

 

this is my armbianEnv

verbosity=1
bootlogo=false
disp_mode=1920x1080p60
overlay_prefix=sun8i-h3
overlays=cpu-clock-1.2GHz-1.3v i2c0 i2c1 uart1 uart2 usbhost0 usbhost1 usbhost2
rootdev=UUID=a37457d6-57d2-4f17-a684-157b1a309a73
rootfstype=ext4
user_overlays=neo-core-stable-mac double-spi ds1307
param_uart2_rtscts=1
param_uart3_rtscts=1
usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u

 

if i run the command,

cat /proc/tty/driver/serial  |head -8
uart:16550A mmio:0x01C28800 irq:53 tx:120 rx:0 RTS|DTR
command

mbpoll -a139 -b9600 -t3 -c2 -m rtu -R  /dev/ttyS2 -l 500
mbpoll 1.4-12 - FieldTalk(tm) Modbus(R) Master Simulator
Copyright © 2015-2019 Pascal JEAN, https://github.com/epsilonrt/mbpoll
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions; type 'mbpoll -w' for details.

Protocol configuration: Modbus RTU
Slave configuration...: address = [139]
                        start reference = 1, count = 2
Communication.........: /dev/ttyS2,       9600-8E1
                        t/o 1.00 s, poll rate 500 ms
Data type.............: 16-bit register, input register table

-- Polling slave 139... Ctrl-C to stop)
Read input register failed: Connection timed out
-- Polling slave 139... Ctrl-C to stop)
Read input register failed: Connection timed out
-- Polling slave 139... Ctrl-C to stop)
Read input register failed: Connection timed out
-- Polling slave 139... Ctrl-C to stop)
Read input register failed: Connection timed out
-- Polling slave 139... Ctrl-C to stop)
Read input register failed: Connection timed out
-- Polling slave 139... Ctrl-C to stop)

 

Apparently it is in RTS mode, it sends but it seems that it cannot receive. I do not know if it could be a failure that it does not change the sending / receiving.

I have to activate something else for the RS485 to work? How can I see if the RTS is working well?

 

 

@martinayotte talk about a patch but i dont know if it can work in my kernel.

Thanks in advance!

 

 

I suggest you check if UART2 RTS is working on this hardware/software first. You can connecting some state indicator (LED, voltmeter, ...) to its pin and manual change RTS state (eg. Ctrl-A Ctrl-G in picocom).

 

If RTS work OK you can try my patch. I'm not familiar with NanoPi Neo Core and I don't know how serial hardware is on its chip, so if it's not compatible with 8250_dw patch will not work. To use my patch you must build your own kernel image (https://docs.armbian.com/Developer-Guide_Build-Preparation/) with applying this patch (put it to "patch/kernel/sunxi-current" should do this).

Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.