to change each USART in RS-485 mode, add this line in linux/drivers/serial/atmel_serial.c , in function atmel_set_termios ,
just before the instruction "UART_PUT_MR(port, mode);" that configures the USART mode.
mode |= ATMEL_US_USMODE_RS485; //Take effect for all USART that you configure
or if you want filter for a specific USART, i used the dedicated IRQ number :
if (port->irq == AT91SAM9260_ID_US2) // USART2 is a rs485
{
mode |= ATMEL_US_USMODE_RS485;
}
I don't know if it's the best solution but it works very well.
AT91SAM9260 USART in RS-485 mode
最新推荐文章于 2025-02-26 11:30:23 发布
本文介绍如何在Linux环境下将USART配置为RS-485模式的方法。通过修改atmel_serial.c文件中的atmel_set_termios函数,在指定位置加入一行代码实现模式转换。该方法适用于所有配置的USART,也可通过IRQ号指定特定USART。
2012

被折叠的 条评论
为什么被折叠?



