Jump to content

OrangePi R1: UART TX echoes RX data


yozik04

Recommended Posts

Armbianmonitor:

I use OrangePi R1 with connected RS485-TTL module to UART1 (PG6, PG7). RS485 communicates with a heatpump. Heatpump transmits data to RS485 module and I read and decode the data with a program and make some ACK replies.

Everything worked fine for a month till OrangePi Power Adapter died. I have replaced Power Adapter and my program now stopped working. I have already spent couple days debugging.

  • Replaced the cable from the heatpump to RS485-TTL module.
  • Tried to see what is happening on the RS485 line with oscilloscope. Start of the diagram always looks good, but the end is skewed and corrupt. It seems like RS485 tries to send data while it receives and certainly corrupts input data. I was thinking why TX led on RS485 is flashing while I read the data.
  • Blamed the program that it sends data with wrong timings. No. It was not the problem.

 

I have stopped my program and try to read data with simple dumb hexdump -C /dev/ttyS1. When the heatpump sends data I see RX and TX data led on RS485 are flashing. STOP.  What? TX is flashing? Why the hell?
I detach TX pin from the Orange PI board. TX led is silent on RS485. :blink:

Oook... I enable UART2 via armbian-config. Disconnect RS485 TX line from UART1 TX and connect UART1 TX to UART2 RX on the OrangePi.

 

RS485-TTL RX ------> Orange Pi UART1 RX
RS485-TTL TX ---x
Orange Pi UART1 TX -----> Orange Pi UART2 RX

 

Now I am running hexdump -C /dev/ttyS1 on left and hexdump -C /dev/ttyS2 on the right simultaniously.

 

Here is the output:

00002e80  00 00 af a9 00 00 4e a8  0a 00 49 a8 87 00 ff ff  |......N...I.....|                      │00000bd0  5c 5e 40 20 69 5e 40 49  5c 5e 40 20 6b 5e 40 4b  |\^@ i^@I\^@ k^@K|
00002e90  00 00 ab bb 00 00 b4 b7  ff 00 df 5c 00 20 ee 00  |...........\. ..|                      │00000be0  5c 5e 40 20 6b 5e 40 4b  5c 5e 40 20 6b 5e 40 4b  |\^@ k^@K\^@ k^@K|
00002ea0  ce 5c 00 20 ee 00 ce 5c  00 20 ee 00 ce 5c 00 20  |.\. ...\. ...\. |                      │00000bf0  5c 5e 40 20 69 5e 40 49  5c 5e 40 20 69 5e 40 49  |\^@ i^@I\^@ i^@I|
00002eb0  ee 00 ce 5c 00 20 ee 00  ce 5c 00 20 ee 00 ce 5c  |...\. ...\. ...\|                      │00000c00  5c 5e 40 20 69 5e 40 49  5c 5e 40 20 ee 5e 40 ce  |\^@ i^@I\^@ .^@.|
00002ec0  00 20 6b 00 4b 5c 00 20  6b 00 4b 5c 00 20 6b 00  |. k.K\. k.K\. k.|                      │00000c10  5c 5e 40 20 ee 5e 40 ce  5c 5e 40 20 ee 5e 40 ce  |\^@ .^@.\^@ .^@.|
00002ed0  4b 5c 00 20 69 00 49 5c  00 20 69 00 49 5c 00 20  |K\. i.I\. i.I\. |                      │*
00002ee0  69 00 49 5c 00 20 6b 00  4b 5c 00 20 6b 00 4b 5c  |i.I\. k.K\. k.K\|                      │00000c30  5c 5e 40 20 ee 5e 40 ce  5c 5e 40 20 6b 5e 40 4b  |\^@ .^@.\^@ k^@K|
00002ef0  00 20 6b 00 4b 5c 00 20  69 00 49 5c 00 20 69 00  |. k.K\. i.I\. i.|                      │00000c40  5c 5e 40 20 6b 5e 40 4b  5c 5e 40 20 6b 5e 40 4b  |\^@ k^@K\^@ k^@K|
00002f00  49 5c 00 20 69 00 49 5c  00 20 6b 00 4b 5c 00 20  |I\. i.I\. k.K\. |                      │00000c50  5c 5e 40 20 69 5e 40 49  5c 5e 40 20 69 5e 40 49  |\^@ i^@I\^@ i^@I|
00002f10  6b 00 4b 5c 00 20 6b 00  4b 5c 00 20 69 00 49 5c  |k.K\. k.K\. i.I\|                      │00000c60  5c 5e 40 20 69 5e 40 49  5c 5e 40 20 6b 5e 40 4b  |\^@ i^@I\^@ k^@K|
00002f20  00 20 69 00 49 5c 00 20  69 00 49 5c 00 20 6b 00  |. i.I\. i.I\. k.|                      │00000c70  5c 5e 40 20 6b 5e 40 4b  5c 5e 40 20 6b 5e 40 4b  |\^@ k^@K\^@ k^@K|
00002f30  4b 5c 00 20 6b 00 4b 5c  00 20 6b 00 4b 5c 00 20  |K\. k.K\. k.K\. |                      │00000c80  5c 5e 40 20 69 5e 40 49  5c 5e 40 20 69 5e 40 49  |\^@ i^@I\^@ i^@I|
00002f40  69 00 49 5c 00 20 69 00  49 5c 00 20 69 00 49 5c  |i.I\. i.I\. i.I\|                      │00000c90  5c 5e 40 20 69 5e 40 49  5c 5e 40 20 6d 0a 0a 5e  |\^@ i^@I\^@ m..^|
00002f50  00 20 ee 00 ce 5c 00 20  ee 00 ce 5c 00 20 ee 00  |. ...\. ...\. ..|                      │00000ca0  41 21 5b 46 31 32 35 35  2d 31 32 20 52 22 5c 5e  |A![F1255-12 R"\^|
00002f60  ce 5c 00 20 ee 00 ce 5c  00 20 ee 00 ce 5c 00 20  |.\. ...\. ...\. |                      │00000cb0  40 20 6d 0a 0a 5e 41 21  5b 46 31 32 35 35 2d 31  |@ m..^A![F1255-1|
00002f70  ee 00 ce 5c 00 20 6b 00  4b 5c 00 20 6b 00 4b 5c  |...\. k.K\. k.K\|                      │00000cc0  32 20 52 22 5c 5e 40 20  6d 0a 0a 5e 41 21 5b 46  |2 R"\^@ m..^A![F|
00002f80  00 20 6b 00 4b 5c 00 20  69 00 49 5c 00 20 69 00  |. k.K\. i.I\. i.|                      │00000cd0  31 32 35 35 2d 31 32 20  52 22 5c 5e 40 20 6b 5e  |1255-12 R"\^@ k^|
00002f90  49 5c 00 20 69 00 49 5c  00 20 6b 00 4b 5c 00 20  |I\. i.I\. k.K\. |                      │00000ce0  40 4b 5c 5e 40 20 6b 5e  40 4b 5c 5e 40 20 6b 5e  |@K\^@ k^@K\^@ k^|
00002fa0  6b 00 4b 5c 00 20 6b 00  4b 5c 00 20 69 00 49 5c  |k.K\. k.K\. i.I\|                      │00000cf0  40 4b 5c 5e 40 20 69 5e  40 49 5c 5e 40 20 69 5e  |@K\^@ i^@I\^@ i^|
00002fb0  00 20 69 00 49 5c 00 20  69 00 49 5c 00 20 6d 0a  |. i.I\. i.I\. m.|                      │00000d00  40 49 5c 5e 40 20 69 5e  40 49 5c 5e 40 20 68 50  |@I\^@ i^@I\^@ hP|
00002fc0  01 21 5b 46 31 32 35 35  2d 31 32 20 52 22 5c 00  |.![F1255-12 R"\.|                      │00000d10  4f 9c 43 5e 40 50 9c 5e  53 5e 40 bc 5e 40 5e 40  |O.C^@P.^S^@.^@^@|
00002fd0  20 6d 0a 01 21 5b 46 31  32 35 35 2d 31 32 20 52  | m..![F1255-12 R|                      │00000d20  44 9c ea ff fd a7 08 20  08 fc 61 9c e1 5e 40 48  |D...... ..a..^@H|
00002fe0  22 5c 00 20 6d 0a 01 21  5b 46 31 32 35 35 2d 31  |"\. m..![F1255-1|                      │00000d30  9c 5e 4f 5e 41 4c 9c 5e  4f 5e 41 ad a9 5e 5e 5e  |.^O^AL.^O^A..^^^|
00002ff0  32 20 52 22 5c 00 20 6b  00 4b 5c 00 20 6b 00 4b  |2 R"\. k.K\. k.K|                      │00000d40  40 4d 9c 2e 5e 42 4e 9c  f5 5e 41 c1 b7 5e 40 67  |@M..^BN..^A..^@g|
00003000  5c 00 20 6b 00 4b 5c 00  20 69 00 49 5c 00 20 69  |\. k.K\. i.I\. i|                      │00000d50  be 5e 40 5e 40 80 a8 5e  40 5e 40 af a9 5e 40 5e  |.^@^@..^@^@..^@^|
00003010  00 49 5c 00 20 69 00 49  5c 00 20 68 50 4f 9c 43  |.I\. i.I\. hPO.C|                      │00000d60  40 4e a8 0a 0a 5e 40 49  a8 87 5e 40 ff ff 5e 40  |@N...^@I..^@..^@|
00003020  00 50 9c 13 00 bc 00 00  44 9c ea ff fd fc 61 9c  |.P......D.....a.|                      │00000d70  5e 40 ab bb 5e 40 5e 40  b4 b7 ff 5e 40 c1 5c 5e  |^@..^@^@...^@.\^|
00003030  e1 00 48 9c 0f 01 4c 9c  0f 01 ad a9 1e 00 4d 9c  |..H...L.......M.|                      │00000d80  40 20 68 50 4f 9c 43 5e  40 50 9c 5e 53 5e 40 bc  |@ hPO.C^@P.^S^@.|
00003040  2e 02 4e 9c f5 01 c1 b7  00 67 be 00 00 80 a8 00  |..N......g......|                      │00000d90  5e 40 5e 40 44 9c ea ff  fd a7 08 20 08 fc 61 9c  |^@^@D...... ..a.|
00003050  00 af a9 00 00 4e a8 0a  00 49 a8 87 00 ff ff 00  |.....N...I......|                      │00000da0  e1 5e 40 48 9c 5e 4f 5e  41 4c 9c 5e 4f 5e 41 ad  |.^@H.^O^AL.^O^A.|
00003060  00 ab bb 00 00 b4 b7 ff  00 c1 5c 00 20 68 50 4f  |..........\. hPO|                      │00000db0  a9 5e 5e 5e 40 4d 9c 2e  5e 42 4e 9c f5 5e 41 c1  |.^^^@M..^BN..^A.|
00003070  9c 43 00 50 9c 13 00 bc  00 00 44 9c ea ff fd fc  |.C.P......D.....|                      │00000dc0  b7 5e 40 67 be 5e 40 5e  40 80 a8 5e 40 5e 40 af  |.^@g.^@^@..^@^@.|
00003080  61 9c e1 00 48 9c 0f 01  4c 9c 0f 01 ad a9 1e 00  |a...H...L.......|                      │00000dd0  a9 5e 40 5e 40 4e a8 0a  0a 5e 40 49 a8 87 5e 40  |.^@^@N...^@I..^@|
00003090  4d 9c 2e 02 4e 9c f5 01  c1 b7 00 67 be 00 00 80  |M...N......g....|                      │00000de0  ff ff 5e 40 5e 40 ab bb  5e 40 5e 40 b4 b7 ff 5e  |..^@^@..^@^@...^|
000030a0  a8 00 00 af a9 00 00 4e  a8 0a 00 49 a8 87 00 ff  |.......N...I....|                      │00000df0  40 c1 5c 5e 40 20 68 50  4f 9c 43 5e 40 50 9c 5e  |@.\^@ hPO.C^@P.^|
000030b0  ff 00 00 ab bb 00 00 b4  b7 ff 00 c1 5c 00 20 68  |............\. h|                      │00000e00  53 5e 40 bc 5e 40 5e 40  44 9c ea ff fd a7 08 20  |S^@.^@^@D...... |
000030c0  50 4f 9c 43 00 50 9c 13  00 bc 00 00 44 9c ea ff  |PO.C.P......D...|                      │00000e10  08 fc 61 9c e1 5e 40 48  9c 5e 4f 5e 41 4c 9c 5e  |..a..^@H.^O^AL.^|
000030d0  fd fc 61 9c e1 00 48 9c  0f 01 4c 9c 0f 01 ad a9  |..a...H...L.....|                      │00000e20  4f 5e 41 ad a9 5e 5e 5e  40 4d 9c 2e 5e 42 4e 9c  |O^A..^^^@M..^BN.|
000030e0  1e 00 4d 9c 2e 02 4e 9c  f5 01 c1 b7 00 67 be 00  |..M...N......g..|                      │00000e30  f5 5e 41 c1 b7 5e 40 67  be 5e 40 5e 40 80 a8 5e  |.^A..^@g.^@^@..^|

 

As you can see, some data from the heatpump is transferred to UART2 RX. How this happens and why?
I do not have any soft running that would transmit any data to UART1 TX.

 

$ uname -a
Linux orangepi 4.19.20-sunxi #5.75 SMP Sat Feb 9 19:02:47 CET 2019 armv7l armv7l armv7l GNU/Linux

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.2 LTS
Release:	18.04
Codename:	bionic

$ dmesg | grep -i ttyS
[    0.000000] Kernel command line: root=UUID=b2d9e1e3-4ce6-4649-a3d5-05a98256c539 rootwait rootfstype=ext4 console=tty1 console=ttyS0,115200 hdmi.audio=EDID:0 disp.screen0_output_mode=1920x1080p60 panic=10 consoleblank=0 loglevel=1 ubootpart=84a76ae0-01 ubootsource=mmc usb-storage.quirks=0x2537:0x1066:u,0x2537:0x1068:u   sunxi_ve_mem_reserve=0 sunxi_g2d_mem_reserve=0 sunxi_fb_mem_reserve=16 cgroup_enable=memory swapaccount=1
[    2.676312] console [ttyS0] disabled
[    2.696564] 1c28000.serial: ttyS0 at MMIO 0x1c28000 (irq = 38, base_baud = 1500000) is a U6_16550A
[    2.696662] console [ttyS0] enabled
[    2.718325] 1c28400.serial: ttyS1 at MMIO 0x1c28400 (irq = 39, base_baud = 1500000) is a U6_16550A
[    2.743016] 1c28800.serial: ttyS2 at MMIO 0x1c28800 (irq = 40, base_baud = 1500000) is a U6_16550A

I do not have anything installed on the Orange Pi. All is default that comes with armbian.

 

I am lost. Please help. :wacko:

Link to comment
Share on other sites

5 hours ago, yozik04 said:

I am lost. Please help. :wacko:

I'm lost too ... I've have no idea why that is happening ... :wacko:

Did you try to move the whole RS485 setup on UART2 and confirmed that it is working properly there ?

Link to comment
Share on other sites

Hi,

 

It it a Nibe F1255 you have ?

 

Not 100% sure I understood the question but RS485 is multidrop and the same wires are used for RX and TX. The bus master decides via the communication protocoll what unit on the bus that are allowed to send. Other units are listening.

 

Details on the communication protocoll:

5C - 1st byte i data frame sent by busmaster.

00 - 2nd  byte

xx - Unit ID - the ID of the unit that the bussmaster is addressing (e.g. 20 for Modbus 40)

xx - Command - the command that the busmaster would like the Unit ID to execute

xx - Length - lengt of data frame

........

xx - Checksum - last byte in the frame is an XOR checksum

 

Good luck or check

https://sites.google.com/view/myheatpump

 

/ Per

Edited by Per Abrahamsson
Spelling
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines