Jump to content

RS485 in UART2 with RTS Pin


MastinZgZ

Recommended Posts

Armbianmonitor:

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!

 

 

Link to comment
Share on other sites

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).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines