Difference between revisions of "MOD-RS485-ISO"
m (→Description) |
(→Hardware) |
||
(24 intermediate revisions by 2 users not shown) | |||
Line 3: | Line 3: | ||
MOD-RS485-ISO is smart RS485 transceiver. Data flow can be controlled via I2C bus. | MOD-RS485-ISO is smart RS485 transceiver. Data flow can be controlled via I2C bus. | ||
+ | === Leds === | ||
+ | The device has two leds: | ||
+ | |||
+ | * '''Green''' - Indicates TX channel is active | ||
+ | * '''Red''' - Indicates RX channel is active | ||
+ | |||
+ | |||
+ | By default both channels are active, so both leds should be on. | ||
+ | |||
+ | === Registers === | ||
+ | |||
+ | Register map starts at address 20h. There are 8 memory registers, that the user can access: | ||
+ | |||
+ | {| class="wikitable" style="text-align: center;" | ||
+ | !colspan="4"|Device registers | ||
+ | |- | ||
+ | !Name | ||
+ | !Address | ||
+ | !Default | ||
+ | !Description | ||
+ | |- | ||
+ | |DeviceID | ||
+ | |20h | ||
+ | |25h | ||
+ | |Device identifier | ||
+ | |- | ||
+ | |Firmware | ||
+ | |21h | ||
+ | |x | ||
+ | |Returns the firmware revision, latest revision is 03h. | ||
+ | |- | ||
+ | |Address | ||
+ | |22h | ||
+ | |22h | ||
+ | |Writing to this register will change slave address of the device. | ||
+ | |- | ||
+ | |Mode | ||
+ | |23h | ||
+ | |00h | ||
+ | |Set device either in pass or bridge mode. 00h is pass mode. 01h is bridge mode. | ||
+ | |- | ||
+ | |Control | ||
+ | |24h | ||
+ | |03h | ||
+ | |Enable/disable RX/TX channel. | ||
+ | |- | ||
+ | |Baudrate | ||
+ | |25h | ||
+ | |12h | ||
+ | |Set default baudrate. Usable only in bridge mode. | ||
+ | |- | ||
+ | |TX | ||
+ | |26h | ||
+ | |x | ||
+ | |Writing byte to this register will send data to RS-485 bus. Usable only in bridge mode. | ||
+ | |- | ||
+ | |RX | ||
+ | |27h | ||
+ | |x | ||
+ | |Reading from this register will return incoming data from RS-485 bus. Usable only in bridge mode. | ||
+ | |} | ||
+ | |||
+ | === Modes of operation === | ||
The device has 2 modes of operation: | The device has 2 modes of operation: | ||
− | * | + | * '''Pass''' - What comes in that comes out, no matter modulation, baudrate, etc. This is the default mode of operation. |
+ | * '''Bridge''' - TX and RX pins are disconnected and all communication is done by the I2C bus. Writing byte to ''tx'' register will send it to RS485 bus. The baudrate is set to 115200. | ||
+ | |||
+ | |||
+ | Additionally you can disable data that goes from/to RS-485 bus. This can be done only by sending I2C message to the board. By default both directions are enabled. | ||
+ | |||
+ | === Control data direction === | ||
+ | By default data is enabled on both TX/RX channels. Writing 24h register can disable each one of them: | ||
+ | |||
+ | {| class="wikitable" style="text-align: center; width: 100%;" | ||
+ | !colspan="8"|Control register | ||
+ | |- | ||
+ | !7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 | ||
+ | |- | ||
+ | |x || x || x || x || x || x || TX || RX | ||
+ | |} | ||
+ | |||
+ | * '''RX''': | ||
+ | ** 0 - Disable RX channel | ||
+ | ** 1 - Enable RX channel | ||
+ | |||
+ | * '''TX''': | ||
+ | ** 0 - Disable TX channel | ||
+ | ** 1 - Enable TX channel | ||
+ | |||
+ | <br> | ||
+ | |||
+ | === Baudrate === | ||
+ | |||
+ | When in bridge mode you can select baudrate from one of the following: | ||
+ | * 00h - 50bps | ||
+ | * 01h - 75bps | ||
+ | * 02h - 110bps | ||
+ | * 03h - 134 bps | ||
+ | * 04h - 150 bps | ||
+ | * 05h - 300 bps | ||
+ | * 06h - 600 bps | ||
+ | * 07h - 1200 bps | ||
+ | * 08h - 1800 bps | ||
+ | * 09h - 2400 bps | ||
+ | * 0Ah - 4800 bps | ||
+ | * 0Bh - 7200 bps | ||
+ | * 0Ch - 9600 bps | ||
+ | * 0Dh - 14400 bps | ||
+ | * 0Eh - 19200 bps | ||
+ | * 0Fh - 38400 bps | ||
+ | * 10h - 57600 bps | ||
+ | * 11h - 76800 bps | ||
+ | * 12h - 115200 bps (default) | ||
+ | * 13h - 128000 bps | ||
+ | * 14h - 230400 bps | ||
+ | * 15h - 500000 bps | ||
+ | * 16h - 576000 bps | ||
+ | * 17h - 1000000 bps | ||
+ | <br> | ||
+ | |||
+ | === FIFO === | ||
+ | When in bridge mode you can read/write data from/to RS-485 bus. The device has 64 bytes FIFO. | ||
+ | Writing to TX register will send data at selected baudrate. If there is available data coming from RS-485 bus it will be stored to RX FIFO. If data is larger than FIFO size ( 64 bytes ), | ||
+ | data will be trunked. Data will be stored in the FIFO until it's read. | ||
+ | |||
+ | If there is no data available in the buffer, reading RX buffer will return 00h. This can be problem if bus data is binary. You can read all 64 bytes and then truncate then by yourself. | ||
+ | |||
+ | === Changing device address === | ||
+ | The device address can be changed. Writing 22h register with new byte will change the address. Device to accept new address PROG jumper must be closed. | ||
+ | |||
+ | === Restoring default parameters === | ||
+ | To revert device to factory settings close PROG jumper and press RST button. | ||
== Documents == | == Documents == | ||
Line 10: | Line 140: | ||
== Hardware == | == Hardware == | ||
− | + | Latest hardware revision is revision C. The latest schematic can be found at the product's web-page. You can find schematics for the previous revision (B) below: | |
+ | |||
+ | https://www.olimex.com/Products/Modules/Interface/MOD-RS485-ISO/resources/MOD-RS485-ISO_Rev_B.sch.pdf | ||
== Software == | == Software == | ||
Line 20: | Line 152: | ||
Older firmware and examples based on older firmware, released by Olimex for MOD-RS485-ISO: | Older firmware and examples based on older firmware, released by Olimex for MOD-RS485-ISO: | ||
− | 1) MOD-RS485-ISO v2 firmware - binary, source, and how-to - [https://www.olimex.com/Products/Modules/Interface/MOD-RS485-ISO/resources/MOD-RS485_FIRMWARE_V2.zip click to download] | + | 1) MOD-RS485-ISO firmware v4 - binary, source, and how-to - [https://www.olimex.com/Products/Modules/Interface/MOD-RS485-ISO/resources/MOD-RS485_FIRMWARE_V4.zip click to download] |
+ | |||
+ | 2) MOD-RS485-ISO v2 firmware - binary, source, and how-to - [https://www.olimex.com/Products/Modules/Interface/MOD-RS485-ISO/resources/MOD-RS485_FIRMWARE_V2.zip click to download] | ||
+ | |||
+ | 3) Demo for OLIMEXINO-328 and MOD-RS485-ISO v2 firmware - binary, source, and how-to - [https://www.olimex.com/Products/Duino/AVR/OLIMEXINO-328/resources/MOD-RS485-ISO+OLIMEXINO-328-V2.zip click to download] | ||
− | + | 4) MOD-RS485-ISO v1 firmware - binary, source, and how-to - [https://www.olimex.com/Products/Modules/Interface/MOD-RS485-ISO/resources/MOD-RS485_FIRMWARE.zip click to download] | |
− | + | 5) MOD-RS485-ISO v1 firmware + OLIMEXINO-328 - C source and HEX for I2C control - [https://www.olimex.com/Products/Duino/AVR/OLIMEXINO-328/resources/OLIMEXINO-328-MOD-RS485-ISO.zip click to download] | |
− | + | 6) MOD-RS485-ISO v1 firmware + PIC-P26J50 demo code - C source and HEX for I2C control - [https://www.olimex.com/Products/Modules/Interface/MOD-RS485-ISO/resources/Demo_MOD-RS485_PIC26J50s.zip click to download] | |
== Projects == | == Projects == |
Latest revision as of 04:59, 27 April 2017
Contents
Description
MOD-RS485-ISO is smart RS485 transceiver. Data flow can be controlled via I2C bus.
Leds
The device has two leds:
- Green - Indicates TX channel is active
- Red - Indicates RX channel is active
By default both channels are active, so both leds should be on.
Registers
Register map starts at address 20h. There are 8 memory registers, that the user can access:
Device registers | |||
---|---|---|---|
Name | Address | Default | Description |
DeviceID | 20h | 25h | Device identifier |
Firmware | 21h | x | Returns the firmware revision, latest revision is 03h. |
Address | 22h | 22h | Writing to this register will change slave address of the device. |
Mode | 23h | 00h | Set device either in pass or bridge mode. 00h is pass mode. 01h is bridge mode. |
Control | 24h | 03h | Enable/disable RX/TX channel. |
Baudrate | 25h | 12h | Set default baudrate. Usable only in bridge mode. |
TX | 26h | x | Writing byte to this register will send data to RS-485 bus. Usable only in bridge mode. |
RX | 27h | x | Reading from this register will return incoming data from RS-485 bus. Usable only in bridge mode. |
Modes of operation
The device has 2 modes of operation:
- Pass - What comes in that comes out, no matter modulation, baudrate, etc. This is the default mode of operation.
- Bridge - TX and RX pins are disconnected and all communication is done by the I2C bus. Writing byte to tx register will send it to RS485 bus. The baudrate is set to 115200.
Additionally you can disable data that goes from/to RS-485 bus. This can be done only by sending I2C message to the board. By default both directions are enabled.
Control data direction
By default data is enabled on both TX/RX channels. Writing 24h register can disable each one of them:
Control register | |||||||
---|---|---|---|---|---|---|---|
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
x | x | x | x | x | x | TX | RX |
- RX:
- 0 - Disable RX channel
- 1 - Enable RX channel
- TX:
- 0 - Disable TX channel
- 1 - Enable TX channel
Baudrate
When in bridge mode you can select baudrate from one of the following:
- 00h - 50bps
- 01h - 75bps
- 02h - 110bps
- 03h - 134 bps
- 04h - 150 bps
- 05h - 300 bps
- 06h - 600 bps
- 07h - 1200 bps
- 08h - 1800 bps
- 09h - 2400 bps
- 0Ah - 4800 bps
- 0Bh - 7200 bps
- 0Ch - 9600 bps
- 0Dh - 14400 bps
- 0Eh - 19200 bps
- 0Fh - 38400 bps
- 10h - 57600 bps
- 11h - 76800 bps
- 12h - 115200 bps (default)
- 13h - 128000 bps
- 14h - 230400 bps
- 15h - 500000 bps
- 16h - 576000 bps
- 17h - 1000000 bps
FIFO
When in bridge mode you can read/write data from/to RS-485 bus. The device has 64 bytes FIFO. Writing to TX register will send data at selected baudrate. If there is available data coming from RS-485 bus it will be stored to RX FIFO. If data is larger than FIFO size ( 64 bytes ), data will be trunked. Data will be stored in the FIFO until it's read.
If there is no data available in the buffer, reading RX buffer will return 00h. This can be problem if bus data is binary. You can read all 64 bytes and then truncate then by yourself.
Changing device address
The device address can be changed. Writing 22h register with new byte will change the address. Device to accept new address PROG jumper must be closed.
Restoring default parameters
To revert device to factory settings close PROG jumper and press RST button.
Documents
Under construction
Hardware
Latest hardware revision is revision C. The latest schematic can be found at the product's web-page. You can find schematics for the previous revision (B) below:
Software
Under construction
Older Firmware releases
Latest firmware is available at the main page of the device. In the wiki one can only find older firmware, that still might be helpful. The projects listed below are no longer officially supported. The best practice is to use the EXACT same compiler as mentioned and in most cases the exact same IDE version as mentioned.
Older firmware and examples based on older firmware, released by Olimex for MOD-RS485-ISO:
1) MOD-RS485-ISO firmware v4 - binary, source, and how-to - click to download
2) MOD-RS485-ISO v2 firmware - binary, source, and how-to - click to download
3) Demo for OLIMEXINO-328 and MOD-RS485-ISO v2 firmware - binary, source, and how-to - click to download
4) MOD-RS485-ISO v1 firmware - binary, source, and how-to - click to download
5) MOD-RS485-ISO v1 firmware + OLIMEXINO-328 - C source and HEX for I2C control - click to download
6) MOD-RS485-ISO v1 firmware + PIC-P26J50 demo code - C source and HEX for I2C control - click to download
Projects
Under construction
FAQ
Under construction