Carte RS485 2 Click
Carte RS485 2 Click
La carte RS485 2 Click Board™ intègre l'émetteur-récepteur semi-duplex MAX3471 destiné aux applications RS-485/RS-422 alimentées par batterie au lithium.
La carte RS485 2 Click Board™ est conçue pour fonctionner sur une alimentation 3,3 V ou 5 V. Elle communique avec le microcontrôleur cible via l'interface UART avec des fonctionnalités supplémentaires fournies par les broches suivantes sur la ligne MikroBUS : PWM, CS.
Due to its reliability and robustness, the RS485 2 Click Board™ can be used in various applications that require reliable data transfer in various noisy environments, or over a substantial distance, when data rate transfer up to 64 kbps is sufficient. Featuring very low power consumption, it can also be used with the battery powered RS485/422 applications. The RS485 2 Click Board™ can be used for controlling various building automation systems, battery-powered differential communicators, remote meter reading applications, and various other battery operated or portable devices, which need to establish a reliable communication over the RS422/485 bus.
How Does The RS485 2 Click Board™ Work?
The RS485 2 Click Board™ uses the MAX3471, an RS-422/485, half-duplex, differential transceiver for battery-powered systems, from Maxim Integrated. This click is intended to be used as a physical layer device, often referred to as PHY, providing physical interfacing of the MCU TTL level UART lines with the RS422/485 bus. It is well suited for transmitting smaller blocks of data over long distances, using a shielded differential pair, for both TX and RX signals, allowing for half-duplex asynchronous communication. The MAX3471 transceiver consists of a separate driver and receiver sections, with Driver Enable and Receiver Enable pins (#RE and DE), used to enable appropriate sections. Driver section is used to drive the RS422/485 bus with the signal received on the UART RX line labeled as RO on the IC, while the receiver section returns data from the bus back to the MCU via the UART TX line, labeled as DI on the IC in the schematics.
RS422/485 standard only specifies electrical characteristics of the transmitter and the receiver. It does not specify or recommend any communications protocol, only the physical layer. The top layer communication protocol of choice can be used, such as the MODBUS or similar protocols. Therefore the RS485 2 Click Board™ offers UART RX and TX pins, routed to the appropriate mikroBUS™ TX and RX UART pins. These pins are used by the MCU to send data to the RS485 bus, in a form determined by the user protocol. Additional DE and RE pins are routed to the mikroBUS™ CS and PWM pin respectively. These pins are labeled on the Click board™ as DE and RE, the same as on the IC itself. Pull-up and pull-down are used to determine states on these pins when they are left floating.
MAX3471 IC allows data rates up to 64kbps. In general, the maximal transfer speed is determined by the bus length: longer bus lines will result in less transfer speed. The RS485/422 bus needs to be terminated with the resistor on both ends, which is equal to the characteristic impedance of the used cable, in order to prevent line reflections. However, the MAX3471 IC features a reduced slew rate on its driver outputs, resulting with slower speed, but with far more robust signal at the same time, which is immune to EMI and other types of interferences that appear on long lines or connection stubs (unterminated parts of the bus). This IC is also able to work on the unterminated bus, commonly used in low speed and low power systems.
The RS-485 standard specifies that a compliant driver must be able to drive 32 unit loads (UL), where 1 unit load represents a load impedance of approximately 12 kΩ. Since the MAX3471 IC device is 1/8 UL, up to 256 such receivers can be supported by a single driver. In cases when the RS485/422 bus voltage is close to 2.5V, the device is able to drive up to 8 loads, which means that it can drive up to 64 receivers. As the bus voltage rises, more drivers can be added, so that for 5V the device can drive the number of devices specified by the standard.
There are situations on the RS485/422 bus, which might lead to a differential voltage which can increase the current which runs through the driver output. This state is known as the bus contention, and it commonly appears during the initialization, bus fault conditions, or with multiple nodes, which have their drivers active at the same time. The MAX3471 IC provides driver output protection, which limits this current and prevents damage to the driver output stage.
The MAX3471 receiver employs input filtering and input hysteresis to enhance noise immunity when differential signals have very slow rise and fall times. MAX3471 IC features a true fail-safe receiver input, which guarantees a logic HIGH receiver output in cases when the receiver inputs are open or shorted, or when they are connected to a terminated transmission line with all drivers disabled.
There is one 4-pole screw terminal on board (VCC, RX, TX, GND) for connecting RS422/485 bus twisted pair cable, along with the GND and VCC. The jumper labeled as VCC SEL is used to set the operating voltage of the Click board™ to either 3.3V or 5V. GND and VCC rails can be used to provide the power supply for another node. Note that the VCC terminal is directly routed to either 3.3V or 5V rail of the mikroBUS™, depending on the VCC SEL jumper position.
MikroElektronika provides a library that contains functions compatible with the MikroElektronika compilers, which can be used for working with the RS485 2 Click Board™. The library also contains an example application, which demonstrates their use. This example application can be used as a reference for custom designs.
Specifications
Type | RS485 |
Applications | Battery-Powered Differential Communications |
On-board modules | MAX3471 half-duplex transceiver |
Key Features | 1.6µA Supply Current with Receiver Enabled; intended for lithium battery-powered RS-485/RS-422 applications. |
Interface | UART |
Compatibility | mikroBUS |
Click board size | L (57.15 x 25.4 mm) |
Input Voltage | 3.3V or 5V |
Pinout diagram
This table shows how the pinout on the RS485 2 Click Board™ corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
Notes | Pin | Pin | Notes | ||||
---|---|---|---|---|---|---|---|
NC | 1 | AN | PWM | 16 | RE | Receiver output enable, active low | |
NC | 2 | RST | INT | 15 | NC | ||
Driver output enable, active high | DE | 3 | CS | TX | 14 | RX | UART data receive |
NC | 4 | SCK | RX | 13 | TX | UART data transmit | |
NC | 5 | MISO | SCL | 12 | NC | ||
NC | 6 | MOSI | SDA | 11 | NC | ||
Power supply | +3.3V | 7 | 3.3V | 5V | 10 | +5V | Power supply |
Ground | GND | 8 | GND | GND | 9 | GND | Ground |
Jumpers and settings
Designator | Name | Default Position | Default Option | Description |
---|---|---|---|---|
JP1 | VCC SEL | Left | 3V3 | Power Supply Voltage Selection 3V3/5V, left position 3V3, right position 5V |
Software Support
We provide a demo application for the RS485 2 Click Board™ on our LibStock page, as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.
Library Description
Library initializes and defines GPIO driver and performs control of device voltage.
For more details check the documentation.
Key Functions
void rs485_2_writeByte(uint8_t input)
- Write Single Byte.uint8_t rs485_2_readByte()
- Read Single Byte.uint8_t ras485_2_byteReady()
- Check for new byte received.
Example Description
The application is composed of three sections:
- System Initialization - Initializes UART module.
- Application Initialization - Driver intialization.
- Application Task - (code snippet) - Checks if new data byte has been received in the RX buffer (ready for reading), and if it has then it reads one byte from the RX buffer. Otherwise, the application task writes the message data via UART.
void applicationTask() { char tmp; uint8_t rdyFlag; // RECEIVER - UART polling rdyFlag = rs485_2_byteReady(); if (1 == rdyFlag) { tmp = rs485_2_readByte(); mikrobus_logWrite( &tmp, _LOG_BYTE ); } // TRANSMITER - TX each 2 sec for (tmp = 0; tmp < 9; tmp++) { rs485_2_writeByte( MESSAGE_DATA[tmp] ); mikrobus_logWrite( "MESSAGE SENT", _LOG_LINE ); } Delay_ms(2000); }
The full application code and ready to use projects can be found on our LibStock page.
Other mikroE Libraries used in this example:
- UART
Additional Notes and Information
Depending on the development board you are using, you may need USB UART click, USB UART 2 click or RS232 click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.
mikroSDK
The RS485 2 Click Board™ is supported by mikroSDK - MikroElektronika Software Development Kit. To ensure proper operation of mikroSDK compliant click board demo applications, mikroSDK should be downloaded from the LibStock and installed for the compiler you are using.
Software Support
We provide a demo application for the RS485 2 Click Board™ on our LibStock page, as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.
Library Description
Library initializes and defines GPIO driver and performs control of device voltage.
For more details check the documentation.
Key Functions
void rs485_2_writeByte(uint8_t input)
- Write Single Byte.uint8_t rs485_2_readByte()
- Read Single Byte.uint8_t ras485_2_byteReady()
- Check for new byte received.
Example Description
The application is composed of three sections:
- System Initialization - Initializes UART module.
- Application Initialization - Driver intialization.
- Application Task - (code snippet) - Checks if new data byte has been received in the RX buffer (ready for reading), and if it has then it reads one byte from the RX buffer. Otherwise, the application task writes the message data via UART.
void applicationTask() { char tmp; uint8_t rdyFlag; // RECEIVER - UART polling rdyFlag = rs485_2_byteReady(); if (1 == rdyFlag) { tmp = rs485_2_readByte(); mikrobus_logWrite( &tmp, _LOG_BYTE ); } // TRANSMITER - TX each 2 sec for (tmp = 0; tmp < 9; tmp++) { rs485_2_writeByte( MESSAGE_DATA[tmp] ); mikrobus_logWrite( "MESSAGE SENT", _LOG_LINE ); } Delay_ms(2000); }
The full application code and ready to use projects can be found on our LibStock page.
Other mikroE Libraries used in this example:
- UART
Additional Notes and Information
Depending on the development board you are using, you may need USB UART click, USB UART 2 click or RS232 click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.
mikroSDK
The RS485 2 Click Board™ is supported by mikroSDK - MikroElektronika Software Development Kit. To ensure proper operation of mikroSDK compliant click board demo applications, mikroSDK should be downloaded from the LibStock and installed for the compiler you are using.
Carte RS485 2 Click
Frequently Asked Questions
Have a Question?
Be the first to ask a question about this.