How does it work?
RS485 Click 3.3V is based on the SN75HVD12, an RS-485 transceiver from Texas Instruments. It is a tristate differential line driver and differential input line receiver. It is intended to be used as a physical layer device, often called PHY, providing physical interfacing of the MCU TTL level UART lines with the RS422/485 bus. It is well suited for transmitting smaller data blocks over long distances, using a twisted differential signal pair for both TX and RX signals, allowing for half-duplex asynchronous communication. The SN75HVD12 transceiver consists of separate driver and receiver sections, with Driver Enable and Receiver Enable pins used to enable the appropriate sections. The driver section drives the RS422/485 bus with the signal received on the UART RX line, while the receiver section returns data from the bus back to the MCU via the UART TX line.
RS422/485 standard only specifies the 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, such as the MODBUS or similar protocols, can be used. Therefore, RS485 Click 3.3V offers UART RX and TX pins routed to the appropriate mikroBUS™ TX and RX UART pins. The MCU uses these pins to send data to the RS485 bus in a form determined by the user protocol.
The SN75HVD12 IC allows signaling data rates up to 32Mbps. However, the bus length determines the maximal transfer speed: longer bus lines will result in less transfer speed. The RS422/RS485 bus needs to be terminated with the resistor on both ends (so-called parallel termination) equal to the characteristic impedance of the cable used to prevent line reflections. The RS485 standard prescribes using a twisted pair cable as the data bus. Twisted pair cable tends to cancel common-mode noise and cause cancellation of the magnetic fields generated by the current flowing through each wire, thereby reducing the effective inductance of the pair.
The Click board™ is equipped with a jumper that can be used to route the termination resistor of 120 Ω between the bus lines. It is also equipped with two more jumpers, labeled as BIAS ENABLE. These jumpers enable bus biasing by using pull-up and pull-down resistors between the bus differential lines and VCC/GND, respectively, preventing certain faulty conditions when no drivers are enabled on the bus, in addition to existing IC protection.
RS485 Click 3.3V uses a standard 2-Wire UART interface to communicate with the host MCU with commonly used UART RX and TX lines. Receiver output enable (RE) and driver output enable (DE) pins of the SN75HVD12 are joined together and routed to the R/T pin of the mikroBUS™ socket. When left floating, a pull-down resistor determines the states on these pins, so you have to enable the device by writing a HIGH logic state. Note that DE and RE pins use opposite signal polarities for the active state, making it possible to drive them with a single MCU pin. When a HIGH logic level is applied to the R/T pin, the transmitter becomes activated, while the receiver is deactivated at the same time – and vice versa. The R/T pin acts as a communication direction pin in this configuration.
This Click board™ can be operated only with a 3.3V logic voltage level. The board must perform appropriate logic voltage level conversion before using MCUs with different logic levels. However, the Click board™ comes equipped with a library containing functions and an example code that can be used as a reference for further development.
Specifications
Type
RS485
Applications
Can be used for the development of low-power RS-485 systems, digital motor control devices, utility meters, chassis-to-chassis interconnections, electronic security stations, and more
On-board modules
SN75HVD12 – RS-485 transceiver from Texas Instruments
Key Features
Meets EIA RS-485 standard, high speed, low-current standby mode, thermal shutdown protection, glitch-free power-up and power-down protection for hot-plugging applications, wide bus voltage common-mode range, and more
Interface
UART
Feature
No ClickID
Compatibility
mikroBUS™
Click board size
M (42.9 x 25.4 mm)
Input Voltage
3.3V
Pinout diagram
This table shows how the pinout on RS485 click 3.3V corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
Onboard settings and indicators
Label | Name | Default | Description |
---|---|---|---|
LD1 | PWR | – | Power LED indicator |
J2 | BIAS ENABLE | – | Pull-up resistor enable the positive bus line (non-inverted line) |
J3 | BIAS ENABLE | – | Pull-down resistor enable the negative bus line (inverted line) |
J4 | TERM | – | Termination resistor enable |
RS485 click 3.3V electrical specifications
Description | Min | Typ | Max | Unit |
---|---|---|---|---|
Supply Voltage | – | 3.3 | – | V |
Bus Common Mode Range | -7 | – | 12 | V |
Signaling Data Rate | 1 | – | 32 | Mbps |
Software Support
We provide a library for the RS485 Click as well as a demo application (example), developed using MIKROE compilers. The demo can run on all the main MIKROE development boards.
Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended), downloaded from our LibStock™ or found on Mikroe github account.
Library Description
This library contains API for RS485 Click driver.
Key functions
-
Generic write function.
-
Generic read function.
-
Send command
Example Description
This example reads and processes data from RS485 clicks.
void application_task ( void )
{
#ifdef DEMO_APP_RECEIVER
rs485_process( );
#endif
#ifdef DEMO_APP_TRANSMITER
rs485_send_command( &rs485, TEXT_TO_SEND );
rs485_process( );
Delay_ms( 2000 );
#endif
}
The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended), downloaded from our LibStock™ or found on Mikroe github account.
Other Mikroe Libraries used in the example:
- MikroSDK.Board
- MikroSDK.Log
- Click.Rs485
Additional notes and informations
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. UART terminal is available in all MIKROE compilers.
mikroSDK
This Click board™ is supported with mikroSDK – MIKROE 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.
For more information about mikroSDK, visit the official page.