请教一个串口方面的问题,对熟悉串口通信的人比较简单!!!

blacksmith   2009-4-23 20:14 楼主
做一个数据采集的项目,ARM开发板的串口是五线制异步串口,即只用到了(TX、RX、CTS、RTS、GND)这五根线,而下游数据通过RS232上传的设备要求是9针串口,其说明书上要求DTR设为有效,RTS设为无效,现在ARM板子上DTR引脚没用到怎么办,我现在正在考虑是不是直接给DTR(4脚)加上一个5V左右的外部电压,让它一直处于高电平,不知道这个方法能不能行的通?(开发板上的转换芯片是MAX3232,下游设备上用的什么芯片还不知道,都封装起来了)也就是说ARM上是五线异步串口,而下游设备要求9线制串口,需要DTR和RTS两脚的状态信号,该怎么实现转换,如果要加另外的处理电路,采用什么芯片比较好?

回复评论 (8)

MARK 这个有点不懂
点赞  2009-5-6 19:17
TX、RX、CTS、RTS都可以用232芯片进行转换,可以参考wince开发板的调试串口的接法
点赞  2009-5-7 02:10
你用MAX3232已经足矣,至于用到几条线,一般最少要接两条:TX,RX,这样在通讯时要采用查询方式,如果处理实时信号、单任务,
这是一种很好的选择,如果不单处理串口信息,要多于两条线,可以采用中断等方式。
可能楼主对RS232协议不是很熟,建议在本站下载它的协议:http://d.download.eeworld.net/down/963297/pzlin

这里有个题外话,我在公司做产品时,去了一个同志,嘴很会说,很是显得有本领,当用电脑的RS232接口与ARM的UART通讯时,他说,直接接上就行,我原来用232都是直接接上MCU的UART接口的!
   我问他,连接成功了吗?后来我把协议那篇文章打开,并找到关于电压的规定的那几个字,让他看,并问他:你真的通讯成功了吗? --狂晕!
    我担心因那个协议是英文的,根据吹牛定理,他会不会看懂那几个字也不敢说
点赞  2009-6-2 16:57
楼上的兄弟,我也听人说做过试验232直接连MCU 通信成功,TX,RX线上串个200欧电阻
我也试了下,单字节传输OK了也,也没烧MCU,万幸~~当然产品这么用是找死。

点赞  2009-6-19 16:15
楼上的同志们,我每次都用电脑的RS232接口与ARM的UART通讯,看了半天不太明白你们说的东西。

我用的是开发板,CPU内核是基于ARM的。板子上有这个MAX3232。
点赞  2009-6-19 17:33
DTR:数据终端就绪。可以加一5V电平,使其一直有效。
点赞  2009-6-20 11:12
[url=http://en.wikipedia.org/wiki/RS-232][/url]

Standard details
In RS-232, user data is sent as a time-series of bits. Both synchronous and asynchronous transmissions are supported by the standard. In addition to the data circuits, the standard defines a number of control circuits used to manage the connection between the DTE and DCE. Each data or control circuit only operates in one direction, that is, signaling from a DTE to the attached DCE or the reverse. Since transmit data and receive data are separate circuits, the interface can operate in a full duplex manner, supporting concurrent data flow in both directions. The standard does not define character framing within the data stream, or character encoding.


Voltage levels

Diagrammatic oscilloscope trace of voltage levels for an uppercase ASCII "K" character (0x4b) with 1 start bit, 8 data bits, 1 stop bitThe RS-232 standard defines the voltage levels that correspond to logical one and logical zero levels. Valid signals are plus or minus 3 to 15 volts. The range near zero volts is not a valid RS-232 level; logic one is defined as a negative voltage, the signal condition is called marking, and has the functional significance of OFF. Logic zero is positive, the signal condition is spacing, and has the function ON. The standard specifies a maximum open-circuit voltage of 25 volts; signal levels of ±5 V,±10 V,±12 V, and ±15 V are all commonly seen depending on the power supplies available within a device. RS-232 drivers and receivers must be able to withstand indefinite short circuit to ground or to any voltage level up to ±25 volts. The slew rate, or how fast the signal changes between levels, is also controlled.

Because the voltage levels are higher than logic levels typically used by integrated circuits, special intervening driver circuits are required to translate logic levels. These also protect the device's internal circuitry from short circuits or transients that may appear on the RS-232 interface, and provide sufficient current to comply with the slew rate requirements for data transmission.

Because both ends of the RS-232 circuit depend on the ground pin being zero volts, problems will occur when connecting machinery and computers where the voltage between the ground pin on one end, and the ground pin on the other is not zero. This may also cause a hazardous ground loop.

Unused interface signals terminated to ground will have an undefined logic state. Where it is necessary to permanently set a control signal to a defined state, it must be connected to a voltage source that asserts the logic 1 or logic 0 level. Some devices provide test voltages on their interface connectors for this purpose.


Connectors

Pinouts


The following table lists commonly-used RS-232 signals and pin assignments[4].

Signal Origin DB-25 DE-9
(TIA-574) EIA/TIA 561 Yost
Name Abbrevation DTE DCE
Common Ground G   7 5 4 4,5
Protective Ground PG   1 - -
Transmitted Data TxD ●  2 3 6 3
Received Data RxD  ● 3 2 5 6
Data Terminal Ready DTR ●  20 4 3 2
Data Set Ready DSR  ● 6 6 1 7
Request To Send RTS ●  4 7 8 1
Clear To Send CTS  ● 5 8 7 8
Carrier Detect DCD  ● 8 1 2 7
Ring Indicator RI  ● 22 9 1 -

Signals
Commonly-used signals are:

Transmitted Data (TxD)  
Data sent from DTE to DCE.
Received Data (RxD)  
Data sent from DCE to DTE.
Request To Send (RTS)  


Cables


Conventions
RTS/CTS handshaking

3-wire and 5-wire RS-232

Seldom used features


Signal rate selection


Loopback testing


Timing signals
Secondary channel

Signal Pin


Related standards

Other serial interfaces similar to RS-232:

RS-422 (a high-speed system similar to RS-232 but with differential signaling)
RS-423 (a high-speed system similar to RS-422 but with unbalanced signaling)
RS-449 (a functional and mechanical interface that used RS-422 and RS-423 signals - it never caught on like RS-232 and was withdrawn by the EIA)
RS-485 (a descendant of RS-422 that can be used as a bus in multidrop configurations)
MIL-STD-188 (a system like RS-232 but with better impedance and rise time control)
EIA-530 (a high-speed system using RS-422 or RS-423 electrical properties in an EIA-232 pinout configuration, thus combining the best of both; supersedes RS-449)
TIA-574 (standardizes the 9-pin D-subminiature connector pinout for use with EIA-232 electrical signalling, as originated on the IBM PC/AT)
SpaceWire (high-speed serial system designed for use on board spacecraft)
点赞  2009-6-25 14:57
若是用MAX3232那就只要RX,TX,GND就够了,其它两个脚是没用的,因为MAX3232没那两个脚.
点赞  2009-7-1 11:29
电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 京公网安备 11010802033920号
    写回复