at91sam9261 linux_at91sam9g45_at91sam9260资料(2)

电脑杂谈  发布时间:2017-05-03 09:03:01  来源:网络整理

mode &= 0xfffffff0;

mode |= ATMEL_US_USMODE_RS485; // in drivers/serial/atmel_serial.h

}

将上面的代码插在UART_PUT_MR(port, mode)之前即可

下面是从外国的一个论坛上找到的:关于uart配置成rs485模式的

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.


本文来自电脑杂谈,转载请注明本文网址:
https://www.pc-fly.com/a/dianqi/article-44919-2.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    • 陈成公
      陈成公

      我们家千玺配的棒棒的

    热点图片
    拼命载入中...