I’m trying to get RS485 communication on BeagleBone Black with CBB-Serial-r02, but yet unable…
Problem:
I can’t get RS485 to work because the RTS-signal (P8.33) is driven active low, and the CBB-cape needs it high when using RS485 (coupled to DE/RE).
UART4 TX (P9.13) is signaling so the UART as such is working. If I force DE/RE line high, the RS485 is in fact transmitting.
Timing between RTS and TX is critical, so I cannot rely on userspace to do this - Should be in the driver itself.
Tests:
I’ve made the tests with
stty -F /dev/ttyO4 9600 crtscts; while true; do echo Hi >/dev/ttyO4; sleep 1; done
also tried
./linux-serial-test -b 9600 -p /dev/ttyO4 -S -e -q 4 -c
One strange thing I noticed is that when using “echo”, the RTS becomes active for each echo-transmission (passive between each loop iteration) if the CBB-cape is configured for RS232, but RTS becomes active for the entire loop-session when the cape is configured for RS485. I presume this has something to do with CTS and RX, which are electrical active on the cape when in RS232 mode.
State:
Using image: bone-debian-9.5-iot-armhf-2018-10-07-4gb.img.xz flashed and booting of internal flash.
Fully APT-upgraded.
/dev/ttyO4 → /dev/ttyS4
dmesg: 481a8000.serial: ttyS4 at MMIO 0x481a8000 (irq = 34, base_baud = 3000000) is a 8250
Tried quite a few combinations of:
*) uboot_overlay_addr0=/lib/firmware/cape-CBB-Serial-r01.dtbo
*) uboot_overlay_addr0=/lib/firmware/CBB-UART4-RS485-00A0.dtbo
*) uboot_overlay_addr0=/lib/firmware/BB-UART4-RTSCTS-00A0.dtbo
(different addresses when combined).
Only BB-UART4-RTSCTS-00A0.dtbo appears to make a difference - Enables the use of RTS.
I have a logic-analyser and an oscilloscope coupled to the system to see what happens.
Goal:
I need to have RTS P8.33 (alternatively P9.15) active high during a transmission (multiple characters), then go passive low within 3.5 character time (ModBus). I presume this just means that it should go passive low after the last character in the queue has been transmitted.
The RS485 transmitter is active when RTS is high, and passive when RTS is low.
I hope someone can help me out here?
~Per