The RS485 transceiver is the linchpin for secure and high-speed data transmission, making it indispensable in today's interconnected world
A
A
Hardware Overview
How does it work?
RS485 4 Click is based on the ADM2795E, an integrated dual channel RS485 driver/receiver, with the ICoupler® isolation technology, made by Analog Devices. This integrated circuit features integrated galvanic isolation elements, providing the required isolation level. RS485 level signals are encoded into waveforms that are used to energize primary windings of the integrated transformers. At the secondary windings, the induced waveforms are decoded back into their original values and routed to the UART pins, with the appropriate TTL signal levels. The same working principle is applied in the opposite direction. This way, the digital signals are effectively conducted through the isolation barrier. Output lines are
internally routed through a set of transient filters, ESD suppressors, surge protection components, etc., replacing the complete set of commonly used external components (TVS diodes, TIPS®…). This reduces the number of reasonably expensive external protection components, cutting the time to market. There are also some other protections, such as miswiring protection, tolerance for up to ±42V on RS485 bus lines, etc. RX and TX UART lines from the mikroBUS™ are routed to RXD and TXD pins of the ADM2795E. The CS pin of the mikroBUS™ is routed to the DE pin of the ADM2795E. It is used to activate the RS485 transmission driver. Similarly, RST pin of the mikroBUS™ is routed to the RE pin of the
ADM2795E, and it is used to activate the receiver. Logic HIGH level on the DE pin activates the transmitter, and thus the UART TX session, while LOW logic level on the RE pin activates the receiver, and thus the UART RX session. The inverted logic on these pins is not a result of a random decision: they could be connected to a single point and driven by a single MCU pin: when there is a LOW level, the driver is disabled, while the receiver is enabled. This is not the case at this Click board™, as it is made for general use. However, in the case of most commonly used half-duplex communication topology, this can be very useful, reducing the number of required MCU pins.
Features overview
Development board
Arduino UNO is a versatile microcontroller board built around the ATmega328P chip. It offers extensive connectivity options for various projects, featuring 14 digital input/output pins, six of which are PWM-capable, along with six analog inputs. Its core components include a 16MHz ceramic resonator, a USB connection, a power jack, an
ICSP header, and a reset button, providing everything necessary to power and program the board. The Uno is ready to go, whether connected to a computer via USB or powered by an AC-to-DC adapter or battery. As the first USB Arduino board, it serves as the benchmark for the Arduino platform, with "Uno" symbolizing its status as the
first in a series. This name choice, meaning "one" in Italian, commemorates the launch of Arduino Software (IDE) 1.0. Initially introduced alongside version 1.0 of the Arduino Software (IDE), the Uno has since become the foundational model for subsequent Arduino releases, embodying the platform's evolution.
Microcontroller Overview
MCU Card / MCU
Architecture
AVR
MCU Memory (KB)
32
Silicon Vendor
Microchip
Pin count
28
RAM (Bytes)
2048
You complete me!
Accessories
Click Shield for Arduino UNO has two proprietary mikroBUS™ sockets, allowing all the Click board™ devices to be interfaced with the Arduino UNO board without effort. The Arduino Uno, a microcontroller board based on the ATmega328P, provides an affordable and flexible way for users to try out new concepts and build prototypes with the ATmega328P microcontroller from various combinations of performance, power consumption, and features. The Arduino Uno has 14 digital input/output pins (of which six can be used as PWM outputs), six analog inputs, a 16 MHz ceramic resonator (CSTCE16M0V53-R0), a USB connection, a power jack, an ICSP header, and reset button. Most of the ATmega328P microcontroller pins are brought to the IO pins on the left and right edge of the board, which are then connected to two existing mikroBUS™ sockets. This Click Shield also has several switches that perform functions such as selecting the logic levels of analog signals on mikroBUS™ sockets and selecting logic voltage levels of the mikroBUS™ sockets themselves. Besides, the user is offered the possibility of using any Click board™ with the help of existing bidirectional level-shifting voltage translators, regardless of whether the Click board™ operates at a 3.3V or 5V logic voltage level. Once you connect the Arduino UNO board with our Click Shield for Arduino UNO, you can access hundreds of Click boards™, working with 3.3V or 5V logic voltage levels.
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Schematic
Step by step
Project assembly
Track your results in real time
Application Output via UART Mode
1. Once the code example is loaded, pressing the "DEBUG" button initiates the build process, programs it on the created setup, and enters Debug mode.
2. After the programming is completed, a header with buttons for various actions within the IDE becomes visible. Clicking the green "PLAY" button starts reading the results achieved with the Click board™. The achieved results are displayed in the Application Output tab.
Software Support
Library Description
This library contains API for RS485 4 Click driver.
Key functions:
rs4854_rx_disable
- Rx disable function.rs4854_tx_enable
- Tx enable function.rs4854_send_command
- Function for send command
Open Source
Code example
This example can be found in NECTO Studio. Feel free to download the code, or you can copy the code below.
/*!
* \file
* \brief Rs4854 Click example
*
* # Description
* This example reads and processes data from RS485 4 clicks.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes driver.
*
* ## Application Task
* Reads the received data.
*
* ## Additional Function
* - rs4854_process ( ) - The general process of collecting presponce
* that sends a module.
*
* \author MikroE Team
*
*/
// ------------------------------------------------------------------- INCLUDES
#include "board.h"
#include "log.h"
#include "rs4854.h"
#include "string.h"
#define PROCESS_COUNTER 10
#define PROCESS_RX_BUFFER_SIZE 500
static uint8_t transmit_msg[] = "MikroE\r\n";
// ------------------------------------------------------------------ VARIABLES
// #define DEMO_APP_RECEIVER
#define DEMO_APP_TRANSMITER
static rs4854_t rs4854;
static log_t logger;
static uint8_t send_data_cnt = 8;
// ------------------------------------------------------- ADDITIONAL FUNCTIONS
static void rs4854_process ( void )
{
int32_t rsp_size;
char uart_rx_buffer[ PROCESS_RX_BUFFER_SIZE ] = { 0 };
uint8_t check_buf_cnt;
rsp_size = rs4854_generic_read( &rs4854, uart_rx_buffer, PROCESS_RX_BUFFER_SIZE );
if ( rsp_size > 0 )
{
for ( check_buf_cnt = 0; check_buf_cnt < rsp_size; check_buf_cnt++ )
{
log_printf( &logger, "%c", uart_rx_buffer[ check_buf_cnt ] );
}
}
}
// ------------------------------------------------------ APPLICATION FUNCTIONS
void application_init ( void )
{
log_cfg_t log_cfg;
rs4854_cfg_t cfg;
/**
* Logger initialization.
* Default baud rate: 115200
* Default log level: LOG_LEVEL_DEBUG
* @note If USB_UART_RX and USB_UART_TX
* are defined as HAL_PIN_NC, you will
* need to define them manually for log to work.
* See @b LOG_MAP_USB_UART macro definition for detailed explanation.
*/
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, "---- Application Init ----" );
// Click initialization.
rs4854_cfg_setup( &cfg );
RS4854_MAP_MIKROBUS( cfg, MIKROBUS_1 );
rs4854_init( &rs4854, &cfg );
#ifdef DEMO_APP_RECEIVER
rs4854_re_pin_set( &rs4854, RS4854_PIN_STATE_LOW );
rs4854_de_pin_set( &rs4854, RS4854_PIN_STATE_LOW );
#endif
#ifdef DEMO_APP_TRANSMITER
rs4854_re_pin_set( &rs4854, RS4854_PIN_STATE_HIGH );
rs4854_de_pin_set( &rs4854, RS4854_PIN_STATE_HIGH );
#endif
}
void application_task ( void )
{
#ifdef DEMO_APP_RECEIVER
rs4854_process( );
#endif
#ifdef DEMO_APP_TRANSMITER
rs4854_generic_write( &rs4854, &transmit_msg[ 0 ], 8 );
Delay_ms( 2000 );
#endif
}
void main ( void )
{
application_init( );
for ( ; ; )
{
application_task( );
}
}
// ------------------------------------------------------------------------ END