Struggling to get RS485 to work with overlays
I have been using kernel 3.8.13 (enabling RS485 with python script) with no issues but wanted to upgrade into the modern world.
Used default image and did the steps suggested in this post:
https://groups.google.com/g/beagleboard/c/nMtRpdWSJu0/m/USjb8sF-AgAJ
- Swapped from CONFIG_SERIAL_8250_OMAP to CONFIG_SERIAL_OMAP and rebuild
- Used BB-UART4-RS485-00A0.dts but modified it to be for UART1 and the direction pin I am using
Everything else is untouched
BB-UART1-RS485-00A0.dts:
/dts-v1/;
/plugin/;
#include <dt-bindings/board/am335x-bbw-bbb-base.h>
#include <dt-bindings/pinctrl/am33xx.h>
/ {
compatible = “ti,beaglebone”, “ti,beaglebone-black”, “ti,beaglebone-green”;
// identification
part-number = “BB-UART1-RS485”;
version = “00A0”;
// resources this cape uses
exclusive-use =
“P9.24”, // uart1_txd
“P9.26”, // uart1_rxd
“P8.14”, // uart1_de/re
“gpio0_26”,
“uart1”; // hardware ip used
/*
- Helper to show loaded overlays under: /proc/device-tree/chosen/overlays/
*/
fragment@0 {
target-path=“/”;
overlay {
chosen {
overlays {
BB-UART1-RS485-00A0 = TIMESTAMP;
};
};
};
};
/*
- Free up the pins used by the cape from the pinmux helpers.
*/
fragment@1 {
target = <&ocp>;
overlay {
P9_24_pinmux { status = “disabled”; };
P9_26_pinmux { status = “disabled”; };
P8_14_pinmux { status = “disabled”; };
};
};
fragment@2 {
target = <&am33xx_pinmux>;
overlay {
bb_uart1_rs485_pins: pinmux_bb_uart1_rs485_pins {
pinctrl-single,pins = <
BONE_P9_24 (PIN_OUTPUT | MUX_MODE6)
BONE_P9_26 (PIN_INPUT | MUX_MODE6)
BONE_P8_14 0x07
;
};
};
};
fragment@3 {
target = <&uart1>;
overlay {
status = “okay”;
pinctrl-names = “default”;
pinctrl-0 = <&bb_uart1_rs485_pins>;
rs485-rts-delay = <0 0>;
rts-gpio = <&gpio0 26 1>; /* GPIO_ACTIVE_HIGH>; */
rs485-rts-active-high;
linux,rs485-enabled-at-boot-time;
};
};
};
/boot/uEnv.txt:
enable_uboot_overlays=1
uboot_overlay_addr0=/lib/firmware/BB-UART1-RS485-00A0.dtbo
disable_uboot_overlay_video=1
disable_uboot_overlay_audio=1
disable_uboot_overlay_wireless=1
disable_uboot_overlay_adc=1
When I boot:
[ 0.460625] 44e09000.serial: ttyO0 at MMIO 0x44e09000 (irq = 30, base_baud = 3000000) is a OMAP UART0
[ 0.472149] 48022000.serial: ttyO1 at MMIO 0x48022000 (irq = 31, base_baud = 3000000) is a OMAP UART1
But it doesnt work.
If I use the normal overlay BB-UART1-00A0.dtbo and swap the direction pin manually it works.
Any help would be very appreciatied!
Jørgen