UART0 for RS485 Hall Duplex, RTS pin not works

JAHTKELD
Posts: 12
Joined: Tue Jul 02, 2019 8:51 am

UART0 for RS485 Hall Duplex, RTS pin not works

Postby JAHTKELD » Sun Jan 23, 2022 9:43 am

Hello:

I have write a task for working with a RS485 transceiver with a RTS pin for flow control.

I test my task over uart1, and works fine (I have a RS485 transceiver at uart1 and other over uart0)

I have disabled all log at uart0 and change form uart1 to uart0 (also change the pin out) but over uart0 the RTS pin doesn´t change

dosen´t made the flow control.

If I use uart mode as only uart (not haff duplex) and change the RTS pin with uart_set_rts, I can send data, but I can get receiver data yet.

Anyone know with the RST pin doesn´t work at uart0 for flow control with half_duplex mode configuration?
Thakns

Code: Select all

#define UART_REMOTO UART_NUM_0
#define TXD0_PIN (1)
#define RXD0_PIN (3)
#define RTS0_PIN (22)

void init_comuremoto() {
    const uart_config_t uart_config = {
        .baud_rate = 9600,
        .data_bits = UART_DATA_8_BITS,
        .parity = UART_PARITY_DISABLE,
        .stop_bits = UART_STOP_BITS_1,
        .flow_ctrl = UART_HW_FLOWCTRL_DISABLE,
		.rx_flow_ctrl_thresh = 122
    };

    uart_param_config(UART_REMOTO, &uart_config);
    uart_set_pin(UART_REMOTO, TXD0_PIN, RXD0_PIN, RTS0_PIN, UART_PIN_NO_CHANGE);
    uart_driver_install(UART_REMOTO, RERX_BUF_SIZE * 2, 0, 0, NULL, 0);
    uart_set_mode(UART_REMOTO, UART_MODE_RS485_HALF_DUPLEX);
    xTaskCreate(remoto_task, "remto_task", 1024*5, NULL, configMAX_PRIORITIES-1, NULL);
}

Who is online

Users browsing this forum: Google [Bot] and 355 guests