This solution provides the backbone for modern data networks, ensuring the seamless flow of information across extended distances
A
A
Hardware Overview
How does it work?
RS485 6 Click is based on the THVD1429, a half-duplex RS485 transceiver from Texas Instruments. One of the most important features is surge protection which is achieved by integrating transient voltage suppressor (TVS) diodes in the package. This feature provides a substantial increase in reliability for better immunity to noise transients coupled to the data cable, eliminating the need for external protection components. An RS-485 bus consists of multiple transceivers connecting in parallel to a bus cable. To eliminate line reflections, each cable end is terminated with a termination resistor whose value matches the characteristic impedance of the cable. This method, known as parallel termination, allows for higher data rates over longer cable length. This device supports up to 256 Bus Nodes in one
network with higher data rates up to 20 Mbps, in cases where the interconnect is short enough (or has suitably low attenuation at signal frequencies) to not degrade the data. The THVD1329DT supports several functional modes that can be selected by using RE and DE pins on the mikroBUS connector. To know more how to use these modes take a look at the “Device Functional Modes” table below. For communication with the RS485 6 Click standard UART communication can be used. This device offer several protections for the pins connected to a bus line, such as: Electrostatic Discharge (ESD) Protection against ±16-kV HBM and ±8-kV contact discharge, Electrical Fast Transient (EFT) Protection where inductive loads such as relays, switch contactors, or heavy-duty motors can create high-frequency
bursts during transition and Surge transients that often result from lightning strikes (direct strike or an indirect strike which induce voltages and currents), or the switching of power systems, including load changes and short circuit switching. These transients are often encountered in industrial environments, such as factory automation and power-grid systems. Since this device feature a wide common-mode voltage range which makes them suitable for multi-point applications over long cable runs. This Click board™ can be supplied and interfaced with both 3.3V and 5V without the need for any external components. The onboard SMD jumper labeled as VCC SEL allows voltage selection for interfacing with both 3.3V and 5V microcontrollers.
Features overview
Development board
UNI Clicker is a compact development board designed as a complete solution that brings the flexibility of add-on Click boards™ to your favorite microcontroller, making it a perfect starter kit for implementing your ideas. It supports a wide range of microcontrollers, such as different ARM, PIC32, dsPIC, PIC, and AVR from various vendors like Microchip, ST, NXP, and TI (regardless of their number of pins), four mikroBUS™ sockets for Click board™ connectivity, a USB connector, LED indicators, buttons, a debugger/programmer connector, and two 26-pin headers for interfacing with external electronics. Thanks to innovative manufacturing technology, it allows you to build
gadgets with unique functionalities and features quickly. Each part of the UNI Clicker development kit contains the components necessary for the most efficient operation of the same board. In addition to the possibility of choosing the UNI Clicker programming method, using a third-party programmer or CODEGRIP/mikroProg connected to onboard JTAG/SWD header, the UNI Clicker board also includes a clean and regulated power supply module for the development kit. It provides two ways of board-powering; through the USB Type-C (USB-C) connector, where onboard voltage regulators provide the appropriate voltage levels to each component on the board, or using a Li-Po/Li
Ion battery via an onboard battery connector. All communication methods that mikroBUS™ itself supports are on this board (plus USB HOST/DEVICE), including the well-established mikroBUS™ socket, a standardized socket for the MCU card (SiBRAIN standard), and several user-configurable buttons and LED indicators. UNI Clicker is an integral part of the Mikroe ecosystem, allowing you to create a new application in minutes. Natively supported by Mikroe software tools, it covers many aspects of prototyping 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-M3
MCU Memory (KB)
384
Silicon Vendor
STMicroelectronics
Pin count
144
RAM (Bytes)
49152
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 6 Click driver.
Key functions:
rs4856_generic_read
- Generic read function.rs4856_re_pin_set
- Sets RE pin to high or low staters4856_de_pin_set
- Sets DE pin to high or low state
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 Rs4856 Click example
*
* # Description
* This example reads and processes data from RS485 6 clicks.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes driver.
*
* ## Application Task
* Reads the received data.
*
* ## Additional Function
* - rs4856_process ( ) - The general process of collecting presponce
* that sends a module.
*
* \author MikroE Team
*
*/
// ------------------------------------------------------------------- INCLUDES
#include "board.h"
#include "log.h"
#include "rs4856.h"
#include "string.h"
#define PROCESS_COUNTER 10
#define PROCESS_RX_BUFFER_SIZE 500
#define PROCESS_PARSER_BUFFER_SIZE 500
#define TEXT_TO_SEND "MikroE\r\n"
// ------------------------------------------------------------------ VARIABLES
#define DEMO_APP_RECEIVER
// #define DEMO_APP_TRANSMITER
static rs4856_t rs4856;
static log_t logger;
static char current_rsp_buf[ PROCESS_PARSER_BUFFER_SIZE ];
static uint8_t send_data_cnt = 0;
// ------------------------------------------------------- ADDITIONAL FUNCTIONS
static void rs4856_process ( void )
{
int16_t rsp_size;
uint16_t rsp_cnt = 0;
char uart_rx_buffer[ PROCESS_RX_BUFFER_SIZE ] = { 0 };
uint8_t check_buf_cnt;
uint8_t process_cnt = PROCESS_COUNTER;
// Clear parser buffer
memset( current_rsp_buf, 0 , PROCESS_PARSER_BUFFER_SIZE );
while( process_cnt != 0 )
{
rsp_size = rs4856_generic_read( &rs4856, &uart_rx_buffer, PROCESS_RX_BUFFER_SIZE );
if ( rsp_size > 0 )
{
// Validation of the received data
for ( check_buf_cnt = 0; check_buf_cnt < rsp_size; check_buf_cnt++ )
{
if ( uart_rx_buffer[ check_buf_cnt ] == 0 )
{
uart_rx_buffer[ check_buf_cnt ] = 13;
}
}
log_printf( &logger, "%s\r\n", uart_rx_buffer );
// Storages data in parser buffer
rsp_cnt += rsp_size;
if ( rsp_cnt < PROCESS_PARSER_BUFFER_SIZE )
{
strncat( current_rsp_buf, uart_rx_buffer, rsp_size );
}
// Clear RX buffer
memset( uart_rx_buffer, 0, PROCESS_RX_BUFFER_SIZE );
}
else
{
process_cnt--;
// Process delay
Delay_ms( 100 );
}
}
}
// ------------------------------------------------------ APPLICATION FUNCTIONS
void application_init ( void )
{
log_cfg_t log_cfg;
rs4856_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.
rs4856_cfg_setup( &cfg );
RS4856_MAP_MIKROBUS( cfg, MIKROBUS_1 );
rs4856_init( &rs4856, &cfg );
#ifdef DEMO_APP_RECEIVER
rs4856_re_pin_set( &rs4856, RS4856_PIN_STATE_LOW );
rs4856_de_pin_set( &rs4856, RS4856_PIN_STATE_LOW );
#endif
#ifdef DEMO_APP_TRANSMITER
rs4856_re_pin_set( &rs4856, RS4856_PIN_STATE_HIGH );
rs4856_de_pin_set( &rs4856, RS4856_PIN_STATE_HIGH );
#endif
log_info( &logger, " Start sending info" );
}
void application_task ( void )
{
#ifdef DEMO_APP_RECEIVER
rs4856_process( );
#endif
#ifdef DEMO_APP_TRANSMITER
rs4856_process( );
if ( send_data_cnt == 5 )
{
rs4856_send_command( &rs4856, TEXT_TO_SEND );
send_data_cnt = 0;
}
else
{
send_data_cnt++;
}
#endif
}
void main ( void )
{
application_init( );
for ( ; ; )
{
application_task( );
}
}
// ------------------------------------------------------------------------ END