UART transmitter complete interrupt timing

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

UART transmitter complete interrupt timing

跳至解决方案
2,520 次查看
masatsuguyamada
Contributor II

Hi,
We are using i.MX6 (MCIMX6Q7CVT08AC) on custom board, and trying to make RS-485 communication for Modbus RTU.

RTS pin of RS-485 transceiver (externally attached, ADM2485) is connected to i.MX6 GPIO, and we control the GPIO for half duplex send / receive change.

Controlling GPIO from user process were not stable for real-time use, so we are trying to control GPIO (RS-485 transceiver / RTS) from Linux kernel space, using UART send interrupt.

From our trial, using interrupt handler imx_txint() of i.MX6 serial driver (driver/tty/serial/imx.c), we could see two interrupt by oscilloscope,

(a) Transmit Buffer FIFO empty (UARTx_USR2 / TXEF)
         --> The interrupt was 2 byte earlier from complete sending.

(b) Transmitter Complete (UARTx_USR2 / TXDC)
         --> The interrupt was observed 1.6~4.4ms after complete sending.
               Unfortunately our external Modbus device sends response before this
               interrupt, so RTS control by this interrupt doesn't meet deadline.

***(a)(b)
http://www.nxp.com/assets/documents/data/en/reference-manuals/IMX6DQRM.pdf
p.5263

TXDC_interrupt_timing.png

My question is,
(1) Is there any trigger that we can notice complete transmitting UART data?
      TXDC interrupt corresponds to that?
(2) Can the delay of TXDC (observed 1.6~4.4ms) be shorten by some register setting?


Thanks in advance,
Yamada

标签 (1)
0 项奖励
回复
1 解答
1,958 次查看
masatsuguyamada
Contributor II

Hi Yuri,

Thanks for the advice, I understand the TXDC is the expected trigger,
also I have considered using timer IC for RTS control, so your advice was very helpful.

Regards,
Yamada

在原帖中查看解决方案

0 项奖励
回复
2 回复数
1,958 次查看
Yuri
NXP Employee
NXP Employee

Hello,

  Please look at my comments below.

1.

  Yes, TXDC (Transmitter Complete) bit indicates that the transmit buffer (TxFIFO) and Shift Register is empty;
therefore the transmission is complete.

2.

  I think the scheme You use - with GPIO control under Linux - hardly can meet Modbus requirements.

There are a lot RS232-RS485 automatic converters. These converters contains a fast automatic TX enable

circuit.

Have a great day,
Yuri

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复
1,959 次查看
masatsuguyamada
Contributor II

Hi Yuri,

Thanks for the advice, I understand the TXDC is the expected trigger,
also I have considered using timer IC for RTS control, so your advice was very helpful.

Regards,
Yamada

0 项奖励
回复