最近拿到1個USBtoRS485,了解相關資訊
- 了解CH341
 - 了解RS232,RS485
 
更新記錄
| item | note | 
|---|---|
| 20161018 | 第一版 | 
目錄
USB2.0 轉 RS485 轉換器
USB2.0 轉 RS485 轉換器
工業級 USB2.0 轉 RS485 轉換器
由CH341(USB bus convert chip)及 SN65HVD3082E(Low-Power RS-485 Transceivers)兩個組成
CH341設定為serial mode,TEN#直接接地,致能UART TX功能 (由TNOW PIN決定: TX/RX)
lsusb
1a86:5523 QinHeng Electronics CH341 in serial mode, usb to serial port converter1
2
3
4
5
6
7
8
9[root@localhost ~]# lsusb
Bus 004 Device 002: ID 8087:8001 Intel Corp.
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 002: ID 8087:8009 Intel Corp.
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 093a:2510 Pixart Imaging, Inc. Optical Mouse
Bus 001 Device 003: ID 1a86:5523 QinHeng Electronics CH341 in serial mode, usb to serial port converter
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
USB转RS485接口
USB转RS485接口
TEN#直接接地所以一直允许 CH341通过串口发送 (TEN#直接接地)
TNOW用于控制 RS485 总线半双工收发器 U5 的收发状态
TNOW Hi : TE(送出UART資料)
TNOW Lo : /RE (接受UART資料)
其它 RS485 SCH
- USB_TTL,USB转TTL,CH341应用
 - 使用FT232RL的RS485: [USB RS485][19]
 
量測RS485
- UART Basics
 - 量測RS485(GND接D-,探棒接D+)
8N1,2400,送出0x33
所以10bit約10x(1000/2400) = 4.16ms
 
RS485
Hi:     D+ - DU    ,(2V~6V)
Lo:       -(D+ - D-)  ,-(2V~6V)
其它相關資料
訊號通訊
- 串列
1個clk產生1個bit
ex. I2C:SCL/SDA, UART:TX/RS - 並列
1個clk產生1個byte(即8bit)
需要多個腳位,不利於用於遠距離傳輸
ex. SPI(Serial Peripheral Interface):SDI,SDO,SCK,CS 
- 在串列資料傳輸裡:
- 單工:
1個時間只有1用處:輸出資料(TX),取得資料(RX)
ex. rs485-2線 - 雙工:
1個時間可以同時輸出資料(TX)及取得資料(RX)
ex. uart, rs485-4線 
 - 單工:
 
RS485 & RS232
- 來源: RS485 & RS232 簡介
 - 常見的通訊標準 : RS232、RS423、RS422、RS485。
 
| 規格 | RS232 | RS423 | RS422 | RS485 | 
|---|---|---|---|---|
| 操作模式 | 單端傳輸 | 單端傳輸 | 差動傳輸 | 差動傳輸 | 
| 線上允許之傳送/接受數目 | 1 Driver/1 Receivers | 1 Driver/10 Receivers | 1 Driver/10 Receivers | 32 Driver/32 Receivers | 
| 最大傳輸距離 | 50 feet (15 m) | 4000 feet (1.2 km) | 4000 feet(1.2 km) | 4000 feet (1.2 km) | 
| 最大傳輸速率 | 20 kb/s | 100 kb/s | 10 Mb/s | 10 Mb/s | 
| 接收端之輸入靈敏度 | ±3 V | ±200 mV | ±200 mV | ±200 mV | 
TIA/EIA-232-F Electrical Specification
- Interface Circuits for TIA/EIA-232-F
 - RS232 電性
 
| state | interface voltage | 
|---|---|
| 輸出資料為1 | -5V ~ -15V | 
| 輸出資料為0 | +5V ~ +15V | 
| 接受資料為0 | 3V ~ 15V | 
| 接受資料為1 | -3V ~ -15V | 
介面使用一根信號線和一根信號返回線而構成共地的傳輸形式,
這種共地傳輸容易產生共模干擾,所以抗雜訊干擾性弱Each line should have a minimum load of 3 kΩ and a maximum load of 7 kΩ which usually is part of the receiver circuit.
- driven voltage
- a logic 0 is represented by a driven voltage between 5 V and 15 V
 - a logic 1of between –5 V and –15 V.
 
 - At the receiving end,
- a voltage between 3 V and 15 V represents a 0
 - a voltage of between –3 V and –15 V represents a 1
 
 - Voltages between ±3 V are undefined and lie in the transition region (當訊號為+/-3V之間,為有問題區段)
 - This effectively gives a 2-V minimum noise margin at the receiver
 
- RS232不能設定超過20K(即最大設定19200)
 - 232 specifies a maximum slew rate of the signal at the output of the driver to be 30 V/μs
 - This restriction, together with the  fact  that  the  drivers  and  receivers  use  a  common  signal  ground  and  the
associated noise introduced by the ground current, severely limits the maximum data throughput. - uart的訊息裡可有共模的雜訊(common signal)
當傳輸快到一定程度就會吃到預留的2V空間,,此問題當線長及線的電感/電阻大時也常發生
不過依spec的電容及長度,,最大就是20K 
EIA-485
- EIA-485(过去叫做RS-485或者RS4851)是隶属于OSI模型物理层的电气特性规定为2线,半双工,多点通信的标准
 - RS-485介面是採用平衡驅動器和差分接收器的組合,抗共模幹能力增強,即抗雜訊干擾性好
 - 介面信號電平比RS-232降低了,就不易損壞介面電路的晶片,且該電平與TTL電平相容,可方便與TTL電路連接。
 - 工业RS-485电缆分为有保护套、无保护套、双绞线、非屏蔽双绞线,符合美国22-24AWG线规的电缆特性阻抗为120Ω
 - The 485 is a balanced (differential) digital transmission line interface developed to improve on the
TIA/EIA-232 (referred to hereafter as 232) limitations- High signaling rate – up to 50M bits/s
 - Longer line length – up to 1200 meters
 - Differential transmission – fewer noise emissions
 - Multiple drivers  and receivers
 
 
RS-485 Transceivers (SN65HVD3082E)
USB bus convert chip CH341
- 工業級 USB2.0 轉 RS485 轉換器
 - CH341相關資料下載
 - USB bus convert chip CH341
CH341 is a USB bus convert chip, providing UART, printer port, parallel and synchronous serial with
2-wire or 4-wire through USB bus.
 
提供下列4種模式:
| mode | note | 
|---|---|
| uart mode | serial transfer enable, serial receive in ready etc. | 
| printer port mod | Standard USB printer port used to upgrade parallel printer, conforms to relevant USB specification. | 
| parallel mode | CH341 gives out 8-bit parallel in EPP or MEM mode. | 
| Synchronous serial | 2-wire (SCL, SDA) | 
| 4-wire (CS, SCK/CLK, MISO/SDI/DIN and MOSI/SDO/DOUT) interface | 
EPP(memory read/write mode)
MEM mode(memory read/write mode)
參考
- 串並列傳輸應用
 - Interface Circuits for TIA/EIA-232-F
 - RS-232 wiki
 - EIA-485
 - RS485 & RS232 簡介
 - RS485通信介面
 - RS-485设计指南 (TI:SLLA272B-2008.05)
 - Interface Circuits for TIA/EIA-485
 - rs485
 - USB 总线转接芯片 CH341
 - ch341 kernel patch: kernel ch341
 - LTC485
 - USB bus convert chip CH341
 - 工業級 USB2.0 轉 RS485 轉換器
 - CH341相關資料下載
 - USB_TTL,USB转TTL,CH341应用
 - 使用FT232RL的RS485: [USB RS485]
 - UART Basics
 - CH341