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
Fusion for TIVA v8 is a development board specially designed for the needs of rapid development of embedded applications. It supports a wide range of microcontrollers, such as different 32-bit ARM® Cortex®-M based MCUs from Texas Instruments, regardless of their number of pins, and a broad set of unique functions, such as the first-ever embedded debugger/programmer over a WiFi network. The development board is well organized and designed so that the end-user has all the necessary elements, such as switches, buttons, indicators, connectors, and others, in one place. Thanks to innovative manufacturing technology, Fusion for TIVA v8 provides a fluid and immersive working experience, allowing access
anywhere and under any circumstances at any time. Each part of the Fusion for TIVA v8 development board contains the components necessary for the most efficient operation of the same board. An advanced integrated CODEGRIP programmer/debugger module offers many valuable programming/debugging options, including support for JTAG, SWD, and SWO Trace (Single Wire Output)), and seamless integration with the Mikroe software environment. Besides, it also includes a clean and regulated power supply module for the development board. It can use a wide range of external power sources, including a battery, an external 12V power supply, and a power source via the USB Type-C (USB-C) connector.
Communication options such as USB-UART, USB HOST/DEVICE, CAN (on the MCU card, if supported), and Ethernet is also included. In addition, it also has the well-established mikroBUS™ standard, a standardized socket for the MCU card (SiBRAIN standard), and two display options for the TFT board line of products and character-based LCD. Fusion for TIVA v8 is an integral part of the Mikroe ecosystem for rapid development. Natively supported by Mikroe software tools, it covers many aspects of prototyping and development thanks to a considerable number of different Click boards™ (over a thousand boards), the number of which is growing every day.
Microcontroller Overview
MCU Card / MCU
Type
8th Generation
Architecture
ARM Cortex-M4
MCU Memory (KB)
1024
Silicon Vendor
Texas Instruments
Pin count
128
RAM (Bytes)
262144
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Click board™ Schematic
Step by step
Project assembly
Track your results in real time
Application Output
This Click board can be interfaced and monitored in two ways:
Application Output
- Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
UART Terminal
- Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.
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
The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.
/*!
* \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