【发布时间】:2011-06-24 18:59:01
【问题描述】:
我正在为 Linux 上的 ARM AT91SAM9260 板编写 RS485 驱动程序。
当我初始化 UART 时,RTS 信号线变高 (1)。我想这将是并且应该是 RS232 操作模式下的标准行为。然而,在 RS485 模式下,这是不希望的。
我正在使用 arm-arch 部分提供的标准函数来初始化 UART。因此,重要的步骤是:
at91_register_uart(AT91SAM9260_ID_US2, 3, ATMEL_UART_CTS | ATMEL_UART_RTS);
//consisting of:
// >> configure/mux the pins
at91_set_A_periph(AT91_PIN_PB10, 1); /* TXD */
at91_set_A_periph(AT91_PIN_PB11, 0); /* RXD */
if (pins & ATMEL_UART_RTS)
at91_set_B_periph(AT91_PIN_PC8, 0); /* RTS */
if (pins & ATMEL_UART_CTS)
at91_set_B_periph(AT91_PIN_PC10, 0); /* CTS */
// >> associate the clock
axm_clock_associate("usart3_clk", &pdev->dev, "usart");
// >> et voilà
如您所见,
at91_set_B_periph(AT91_PIN_PC8, 0);
RTS 引脚上的上拉电阻未激活。
为什么 UART 将 RTS 设置为高? 只是因为这将是标准 RS232 模式下的行为?
这不是更好的标准吗? UART 保持沉默直到
操作模式是否明确设置?
【问题讨论】:
标签: linux serial-port arm uart