Hi,

Here is sample of UART4 RS485:
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-UART4-COM0";
version = "00A0";

// resources this cape uses
exclusive-use =
"P9.13", // uart4_txd
"P9.11", // uart4_rxd
"P8.35", // uart4_de/re
"gpio0_8",

"uart4"; // hardware ip used

/*
* Free up the pins used by the cape from the pinmux helpers.
*/
fragment@0 {
target = <&ocp>;
__overlay__ {
P9_13_pinmux { status = "disabled"; }; /* P9_13: gpmc_wpn.uart4_txd_mux2 */
P9_11_pinmux { status = "disabled"; }; /* P9_11: gpmc_wait0.uart4_rxd_mux2
*/
P8_35_pinmux { status = "disabled"; }; /* P8_35: PIN_OUTPUT_PULLDOWN |
MUX_MODE7 (GPIO0_8) */
};
};

fragment@1 {
target = <&am33xx_pinmux>;
__overlay__ {
bb_uart4_rs485_pins: pinmux_bb_uart4_rs485_pins {
pinctrl-single,pins = <
BONE_P9_13 (PIN_OUTPUT | MUX_MODE6) /* P9_13: gpmc_wpn.uart4_txd_mux2 */
BONE_P9_11 (PIN_INPUT  | MUX_MODE6) /* P9_11: gpmc_wait0.uart4_rxd_mux2 */
BONE_P8_35 0x07 /* P8_35: PIN_OUTPUT_PULLDOWN | MUX_MODE7 (GPIO0_8) */
>;
};
};
};

fragment@2 {
target = <&uart4>;
__overlay__ {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&bb_uart4_rs485_pins>;
rs485-rts-delay = <0 0>;

rts-gpio = <&gpio0 8 1>; /*  GPIO_ACTIVE_HIGH>; */
rs485-rts-active-high;
linux,rs485-enabled-at-boot-time;
};
};
};

Regards,
Atique

On Tue, Jan 19, 2021 at 7:19 PM Jørgen Sirum <[email protected]> wrote:

> 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
>
>
> --
> For more options, visit http://beagleboard.org/discuss
> ---
> You received this message because you are subscribed to the Google Groups
> "BeagleBoard" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beagleboard/cfc7f9c4-2c72-44ff-976e-2ec69db2c7efn%40googlegroups.com
> <https://groups.google.com/d/msgid/beagleboard/cfc7f9c4-2c72-44ff-976e-2ec69db2c7efn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Regards,
Atique u Rehman

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/CAOzcuAhYErGXdvaOz%3Dx-Aasw36Fd9-JCGCvqhgLPgP1p3WbxiA%40mail.gmail.com.

Reply via email to