Uart as RS485 ccardimx28js


i’m trying to use my Uart1 as RS485 (and Modbus RTU).

Using an RS232 to RS485 Converter works fine.

No i want to implement the RS485 on my sutomboard. Therefor i have to use a chip converter. This chips needs a Pin for switching between sending an receiving.

My suggestions:

  1. Driving this Pin with a gpio before and after sending data. But how to check if all my data is sucessfully send?

  2. Using serial RTS Pin. I found some code on the net, but it return -1.

“rs485conf.flags |= SER_RS485_ENABLED;
rs485conf.delay_rts_before_send = 0x00000004;
ioctl(fd, TIOCSRS485, &rs485conf);”

Can someone help to drive my uart as Rs485?


I think you are trying to implement a Half Duplex RS485 solution on ccwimx28. Are you using Digi Embedded Linux or Digi Embedded Yocto? DEL implementation for ccwimx28 does not support half duplex RS485. you might need to build an adapter to go from full to half duplex:

DEY has support for Half Duplex RS484 in Kernel 3.10 only