RS-485 RTS drive RS-485 Tx-enable from Kernel

Hi Panos_Theof
Just sharing my experience as a user who got help from the experts above, once I had my overlay configured correctly, I still had to initialize the UART for RS-485 Tx-enable in my software application. In my case CPP as follows:

	struct serial_rs485 rs485conf;
	rs485conf.flags |= SER_RS485_ENABLED;
	rs485conf.flags &= ~(SER_RS485_RTS_ON_SEND);
	rs485conf.flags |= (SER_RS485_RTS_AFTER_SEND);
	rs485conf.flags |= (SER_RS485_RX_DURING_TX);
	rs485conf.delay_rts_before_send = 0; // Delay before send (milliseconds)
	rs485conf.delay_rts_after_send = 0; // Delay after send (milliseconds)
	if (ioctl (fd, TIOCSRS485, &rs485conf) > -1)	{
		Rs485KernelDriven = true;
	}

I hope this helps you.

1 Like