Hi,
I am using i.MX6 Solo X based custom board (kernel used : - 4.14.200). I have external RS485 transceiver chip connected to the UART2 port of the processor and trying to handle RE/DE pins of the chip in the standard imx6 uart driver (drivers/tty/serial/imx.c) .
I am putting the 485 transceiver in transmit mode (RE=DE=1) in imx_start_tx() function and i can see the data is getting transmitted over AIO bus.
To put the 485 transceiver in receive mode (RE/DE=0), i have added logic in imx_stop_tx() function.
Unfortunately, uart does not receive any data which means imx_stop_tx() function did not get called.
When imx_stop_tx() api gets called...? Or in which api of the driver, i should handle the RE/DE pins to put into receive mode after the transmission is complete...?
Is there any to handle the RS485 chip in the imx6sx uart driver......? Please let me know.
Below is the code snippet for reference
static void imx_start_tx(struct uart_port *port)
{
if(port->line ==1) // For UART2 only
{//485 transmit mode
gpio_direction_output(RE_PIN,1);
gpio_direction_output(DE_PIN,1);
}
.....
}
static void imx_stop_tx(struct uart_port *port)
{
if(port->line ==1) // For UART2 only
{ // 485 receive mode
gpio_direction_output(RE_PIN,0);
gpio_direction_output(DE_PIN,0);
}
....
}
I already tried configuring i.MX6SX uart driver for RS485 in dts file....but it did not worked. CTS pin was not toggling while sending/receiving the data. I observed that imx uart driver does not parses the rs485 related properties (like rs485-rts-active-high etc) mentioned in dts. Also RS485 mode did not get enabled.
Moreover, in our board 2 GPIO pins are connected to the RE and DE pins of the 485 transceiver chip. So i am trying to handle gpio pins in imx uart driver which is same as that of handling CTS pin (routed to 485 chip RE/DE pins) in driver.
I went through the driver code, CTS pin is toggled in imx_start_tx and imx_stop_tx functions of the imx uart driver only, but it seems imx_stop_tx() function does not get called.
Link provided has i.MX6 UL processor based board not i.MX6SX.