The core purpose of this solution is to establish a robust, long-distance network, facilitating efficient data exchange
A
A
Hardware Overview
How does it work?
RS485 5 Click is based on the MAX485, low-power, slew-rate-limited transceiver for RS-485 and RS-422 communication from Analog Devices, which draw between 120µA and 500µA of supply current when unloaded or fully loaded with disabled drivers. All parts operate from a single 5V supply. Driver is short-circuit current limited and is protected against excessive power dissipation by thermal shutdown circuitry that places the driver outputs into a high-impedance state. The receiver input has a fail-safe feature that guarantees a logic-high output if the input is open circuit. The MAX485 slew rates are not limited, allowing it to transmit up to 2.5Mbps and half-duplex communication. In general, the maximal transfer
speed is determined by the bus length, longer bus lines will result in less transfer speed. The RS485/422 line should be terminated at both ends in its characteristic impedance and stub lengths off the main line should be kept as short as possible to minimize the reflections. The RS-485/RS-422 standard covers line lengths up to 1220 meters (4000 feet). Excessive output current and power dissipation caused by faults or by bus contention are prevented by two mechanisms. A foldback current limit on the output stage provides immediate protection against short circuits over the whole common-mode voltage range. In addition, a thermal shutdown circuit forces the driver outputs into a high-impedance
state if the temperature rises excessively. There are two 2-pole screw terminals on board (+, B, A, -) for connecting RS422/485 bus twisted pair cable, along with the GND and VCC. The terminal inputs labeled as “A” and “B” are used to connect the bus wires. GND and VCC rails can be used to provide the power supply for another node. Note that the VCC terminal is directly routed to the 5V rail of the mikroBUS™. This Click board™ can be operated only with a 5V logic voltage level. The board must perform appropriate logic voltage level conversion before using MCUs with different logic levels. Also, it comes equipped with a library containing functions and an example code that can be used as a reference for further development.
Features overview
Development board
Clicker 4 for STM32 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 comes with an onboard 32-bit ARM Cortex-M4 microcontroller, the STM32F767BI from STMicroelectronics, four mikroBUS™ sockets for Click board™ connectivity, a USB connector, LED indicators, buttons, a debugger/programmer connector, two 23-pin headers for interfacing with external electronics, and more. Thanks to innovative manufacturing technology, it allows you to build gadgets with
unique functionalities and features quickly. Each part of the Clicker 4 for STM32 development kit contains the components necessary for the most efficient operation of the same board. In addition to the possibility of choosing the Clicker 4 for STM32 programming method, using an external CODEGRIP or mikroProg programmer connected to the onboard JTAG/SWD header, the Clicker 4 board also includes a clean and regulated power supply block. It provides several ways of board-powering; through the USB Type-C (USB-C) connector using a power supply delivered by the USB HOST (i.e., personal computer), USB wall
adapter, or a Li-Po/Li-Ion battery via an onboard battery connector. All communication methods that mikroBUS™ itself supports are on this board (plus USB-DEVICE), including the well-established mikroBUS™ socket, several user-configurable buttons, and LED indicators. Clicker 4 for STM32 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

Architecture
ARM Cortex-M7
MCU Memory (KB)
2048
Silicon Vendor
STMicroelectronics
Pin count
208
RAM (Bytes)
524288
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
1. Application Output - In Debug mode, the 'Application Output' window enables real-time data monitoring, offering direct insight into execution results. Ensure proper data display by configuring the environment correctly using the provided tutorial.

2. UART Terminal - Use the UART Terminal to monitor data transmission via a USB to UART converter, allowing direct communication between the Click board™ and your development system. Configure the baud rate and other serial settings according to your project's requirements to ensure proper functionality. For step-by-step setup instructions, refer to the provided tutorial.

3. Plot Output - The Plot feature offers a powerful way to visualize real-time sensor data, enabling trend analysis, debugging, and comparison of multiple data points. To set it up correctly, follow the provided tutorial, which includes a step-by-step example of using the Plot feature to display Click board™ readings. To use the Plot feature in your code, use the function: plot(*insert_graph_name*, variable_name);. This is a general format, and it is up to the user to replace 'insert_graph_name' with the actual graph name and 'variable_name' with the parameter to be displayed.

Software Support
Library Description
This library contains API for RS485 5 Click driver.
Key functions:
rs4855_generic_write
- Generic write function.rs4855_set_de_state
- Sets DE pin to high or low state.rs4855_set_re_state
- Sets RE 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 Rs4855 Click example
*
* # Description
* This example reads and processes data from RS485 5 clicks.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes the driver and enables the selected mode.
*
* ## Application Task
* Depending on the selected mode, it reads all the received data or sends the desired message
* every 2 seconds.
*
* ## Additional Function
* - rs4855_process ( ) - The general process of collecting the received data.
*
* \author MikroE Team
*
*/
// ------------------------------------------------------------------- INCLUDES
#include "board.h"
#include "log.h"
#include "rs4855.h"
#include "string.h"
#define PROCESS_RX_BUFFER_SIZE 500
#define TEXT_TO_SEND "MikroE\r\n"
// ------------------------------------------------------------------ VARIABLES
#define DEMO_APP_RECEIVER
// #define DEMO_APP_TRANSMITTER
static rs4855_t rs4855;
static log_t logger;
// ------------------------------------------------------- ADDITIONAL FUNCTIONS
static void rs4855_process ( void )
{
int32_t rsp_size;
char uart_rx_buffer[ PROCESS_RX_BUFFER_SIZE ] = { 0 };
uint8_t check_buf_cnt;
rsp_size = rs4855_generic_read( &rs4855, uart_rx_buffer, PROCESS_RX_BUFFER_SIZE );
if ( rsp_size >= strlen( TEXT_TO_SEND ) )
{
log_printf( &logger, "Received data: " );
for ( check_buf_cnt = 0; check_buf_cnt < rsp_size; check_buf_cnt++ )
{
log_printf( &logger, "%c", uart_rx_buffer[ check_buf_cnt ] );
}
}
Delay_ms ( 100 );
}
// ------------------------------------------------------ APPLICATION FUNCTIONS
void application_init ( void )
{
log_cfg_t log_cfg;
rs4855_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.
rs4855_cfg_setup( &cfg );
RS4855_MAP_MIKROBUS( cfg, MIKROBUS_1 );
rs4855_init( &rs4855, &cfg );
Delay_ms ( 100 );
#ifdef DEMO_APP_RECEIVER
rs4855_set_re_state( &rs4855, RS4855_PIN_STATE_LOW );
rs4855_set_de_state( &rs4855, RS4855_PIN_STATE_LOW );
log_info( &logger, "---- Receiver mode ----" );
#endif
#ifdef DEMO_APP_TRANSMITTER
rs4855_set_re_state( &rs4855, RS4855_PIN_STATE_HIGH );
rs4855_set_de_state( &rs4855, RS4855_PIN_STATE_HIGH );
log_info( &logger, "---- Transmitter mode ----" );
#endif
}
void application_task ( void )
{
#ifdef DEMO_APP_RECEIVER
rs4855_process( );
#endif
#ifdef DEMO_APP_TRANSMITTER
rs4855_generic_write( &rs4855, TEXT_TO_SEND, 8 );
log_info( &logger, "---- Data sent ----" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
#endif
}
int main ( void )
{
/* Do not remove this line or clock might not be set correctly. */
#ifdef PREINIT_SUPPORTED
preinit();
#endif
application_init( );
for ( ; ; )
{
application_task( );
}
return 0;
}
// ------------------------------------------------------------------------ END
/*!
* \file
* \brief Rs4855 Click example
*
* # Description
* This example reads and processes data from RS485 5 clicks.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes the driver and enables the selected mode.
*
* ## Application Task
* Depending on the selected mode, it reads all the received data or sends the desired message
* every 2 seconds.
*
* ## Additional Function
* - rs4855_process ( ) - The general process of collecting the received data.
*
* \author MikroE Team
*
*/
// ------------------------------------------------------------------- INCLUDES
#include "board.h"
#include "log.h"
#include "rs4855.h"
#include "string.h"
#define PROCESS_RX_BUFFER_SIZE 500
#define TEXT_TO_SEND "MikroE\r\n"
// ------------------------------------------------------------------ VARIABLES
#define DEMO_APP_RECEIVER
// #define DEMO_APP_TRANSMITTER
static rs4855_t rs4855;
static log_t logger;
// ------------------------------------------------------- ADDITIONAL FUNCTIONS
static void rs4855_process ( void )
{
int32_t rsp_size;
char uart_rx_buffer[ PROCESS_RX_BUFFER_SIZE ] = { 0 };
uint8_t check_buf_cnt;
rsp_size = rs4855_generic_read( &rs4855, uart_rx_buffer, PROCESS_RX_BUFFER_SIZE );
if ( rsp_size >= strlen( TEXT_TO_SEND ) )
{
log_printf( &logger, "Received data: " );
for ( check_buf_cnt = 0; check_buf_cnt < rsp_size; check_buf_cnt++ )
{
log_printf( &logger, "%c", uart_rx_buffer[ check_buf_cnt ] );
}
}
Delay_ms ( 100 );
}
// ------------------------------------------------------ APPLICATION FUNCTIONS
void application_init ( void )
{
log_cfg_t log_cfg;
rs4855_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.
rs4855_cfg_setup( &cfg );
RS4855_MAP_MIKROBUS( cfg, MIKROBUS_1 );
rs4855_init( &rs4855, &cfg );
Delay_ms ( 100 );
#ifdef DEMO_APP_RECEIVER
rs4855_set_re_state( &rs4855, RS4855_PIN_STATE_LOW );
rs4855_set_de_state( &rs4855, RS4855_PIN_STATE_LOW );
log_info( &logger, "---- Receiver mode ----" );
#endif
#ifdef DEMO_APP_TRANSMITTER
rs4855_set_re_state( &rs4855, RS4855_PIN_STATE_HIGH );
rs4855_set_de_state( &rs4855, RS4855_PIN_STATE_HIGH );
log_info( &logger, "---- Transmitter mode ----" );
#endif
}
void application_task ( void )
{
#ifdef DEMO_APP_RECEIVER
rs4855_process( );
#endif
#ifdef DEMO_APP_TRANSMITTER
rs4855_generic_write( &rs4855, TEXT_TO_SEND, 8 );
log_info( &logger, "---- Data sent ----" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
#endif
}
int main ( void )
{
/* Do not remove this line or clock might not be set correctly. */
#ifdef PREINIT_SUPPORTED
preinit();
#endif
application_init( );
for ( ; ; )
{
application_task( );
}
return 0;
}
// ------------------------------------------------------------------------ END
/*!
* \file
* \brief Rs4855 Click example
*
* # Description
* This example reads and processes data from RS485 5 clicks.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes the driver and enables the selected mode.
*
* ## Application Task
* Depending on the selected mode, it reads all the received data or sends the desired message
* every 2 seconds.
*
* ## Additional Function
* - rs4855_process ( ) - The general process of collecting the received data.
*
* \author MikroE Team
*
*/
// ------------------------------------------------------------------- INCLUDES
#include "board.h"
#include "log.h"
#include "rs4855.h"
#include "string.h"
#define PROCESS_RX_BUFFER_SIZE 500
#define TEXT_TO_SEND "MikroE\r\n"
// ------------------------------------------------------------------ VARIABLES
#define DEMO_APP_RECEIVER
// #define DEMO_APP_TRANSMITTER
static rs4855_t rs4855;
static log_t logger;
// ------------------------------------------------------- ADDITIONAL FUNCTIONS
static void rs4855_process ( void )
{
int32_t rsp_size;
char uart_rx_buffer[ PROCESS_RX_BUFFER_SIZE ] = { 0 };
uint8_t check_buf_cnt;
rsp_size = rs4855_generic_read( &rs4855, uart_rx_buffer, PROCESS_RX_BUFFER_SIZE );
if ( rsp_size >= strlen( TEXT_TO_SEND ) )
{
log_printf( &logger, "Received data: " );
for ( check_buf_cnt = 0; check_buf_cnt < rsp_size; check_buf_cnt++ )
{
log_printf( &logger, "%c", uart_rx_buffer[ check_buf_cnt ] );
}
}
Delay_ms ( 100 );
}
// ------------------------------------------------------ APPLICATION FUNCTIONS
void application_init ( void )
{
log_cfg_t log_cfg;
rs4855_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.
rs4855_cfg_setup( &cfg );
RS4855_MAP_MIKROBUS( cfg, MIKROBUS_1 );
rs4855_init( &rs4855, &cfg );
Delay_ms ( 100 );
#ifdef DEMO_APP_RECEIVER
rs4855_set_re_state( &rs4855, RS4855_PIN_STATE_LOW );
rs4855_set_de_state( &rs4855, RS4855_PIN_STATE_LOW );
log_info( &logger, "---- Receiver mode ----" );
#endif
#ifdef DEMO_APP_TRANSMITTER
rs4855_set_re_state( &rs4855, RS4855_PIN_STATE_HIGH );
rs4855_set_de_state( &rs4855, RS4855_PIN_STATE_HIGH );
log_info( &logger, "---- Transmitter mode ----" );
#endif
}
void application_task ( void )
{
#ifdef DEMO_APP_RECEIVER
rs4855_process( );
#endif
#ifdef DEMO_APP_TRANSMITTER
rs4855_generic_write( &rs4855, TEXT_TO_SEND, 8 );
log_info( &logger, "---- Data sent ----" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
#endif
}
int main ( void )
{
/* Do not remove this line or clock might not be set correctly. */
#ifdef PREINIT_SUPPORTED
preinit();
#endif
application_init( );
for ( ; ; )
{
application_task( );
}
return 0;
}
// ------------------------------------------------------------------------ END