Beginner
10 min

Safeguard your RS485 data with ADM2682E and STM32F413ZH

Isolate, elevate, communicate: Unleash the power of RS485!

RS485 Isolator Click with Nucleo 144 with STM32F413ZH MCU

Published Feb 14, 2024

Click board™

RS485 Isolator Click

Dev Board

Nucleo 144 with STM32F413ZH MCU

Compiler

NECTO Studio

MCU

STM32F413ZH

Our RS485 signal isolator empowers your communication network by providing robust isolation, ensuring reliable data transmission in industrial environments

A

A

Hardware Overview

How does it work?

RS485 Isolator Click is based on the ADM2682E, a signal, and a power-isolated RS-485 transceiver with ESD protection from Analog Devices. The signal isolation is implemented on the logic side of the interface, which is achieved by having a digital isolation section and a transceiver section. The applied data to the RX and DE pins are referenced to a logic ground and coupled across an isolated barrier to appear at the transceiver section referenced to the isolated ground. Similarly, the single-ended receiver output signal, referenced to

isolated ground in the transceiver section, is coupled across the isolation barrier to appear at the RX pin referenced to logic ground. RS485 Isolator Click uses a standard 2-Wire UART interface to communicate with the host MCU. There is driver enable input DE, which enables the driver with logic HIGH. The receiver-enable input RE enables the receiver with a LOW logic state. There is also a TERM jumper, which adds a 120R termination resistor at the receiver side of the bus, which minimizes the reflections. The input/output

terminal is properly labeled A and B for receiver input and Z and Y for driver output. This Click board™ can operate with either 3.3V or 5V logic voltage levels selected via the VCC SEL jumper. This way, both 3.3V and 5V capable MCUs can use the communication lines properly. Also, this Click board™ comes equipped with a library containing easy-to-use functions and an example code that can be used as a reference for further development.

RS485 Isolator Click top side image
RS485 Isolator Click bottom side image

Features overview

Development board

Nucleo-144 with STM32F413ZH MCU board offers an accessible and adaptable avenue for users to explore new ideas and construct prototypes. It allows users to tailor their experience by selecting from a range of performance and power consumption features offered by the STM32 microcontroller. With compatible boards, the

internal or external SMPS dramatically decreases power usage in Run mode. Including the ST Zio connector, expanding ARDUINO Uno V3 connectivity, and ST morpho headers facilitate easy expansion of the Nucleo open development platform. The integrated ST-LINK debugger/programmer enhances convenience by

eliminating the need for a separate probe. Moreover, the board is accompanied by comprehensive free software libraries and examples within the STM32Cube MCU Package, further enhancing its utility and value.

Nucleo 144 with STM32F413ZH MCU double side image

Microcontroller Overview

MCU Card / MCU

default

Architecture

ARM Cortex-M4

MCU Memory (KB)

1536

Silicon Vendor

STMicroelectronics

Pin count

144

RAM (Bytes)

327680

You complete me!

Accessories

Click Shield for Nucleo-144 comes equipped with four mikroBUS™ sockets, with one in the form of a Shuttle connector, allowing all the Click board™ devices to be interfaced with the STM32 Nucleo-144 board with no effort. This way, MIKROE allows its users to add any functionality from our ever-growing range of Click boards™, such as WiFi, GSM, GPS, Bluetooth, ZigBee, environmental sensors, LEDs, speech recognition, motor control, movement sensors, and many more. Featuring an ARM Cortex-M microcontroller, 144 pins, and Arduino™ compatibility, the STM32 Nucleo-144 board offers limitless possibilities for prototyping and creating diverse applications. These boards are controlled and powered conveniently through a USB connection to program and efficiently debug the Nucleo-144 board out of the box, with an additional USB cable connected to the USB mini port on the board. Simplify your project development with the integrated ST-Link debugger and unleash creativity using the extensive I/O options and expansion capabilities. 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 STM32 Nucleo-144 board with our Click Shield for Nucleo-144, you can access hundreds of Click boards™, working with 3.3V or 5V logic voltage levels.

Click Shield for Nucleo-144 accessories 1 image

Used MCU Pins

mikroBUS™ mapper

NC
NC
AN
Receiver Enable
PA13
RST
Driver Enable
PA4
CS
NC
NC
SCK
NC
NC
MISO
NC
NC
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
NC
NC
PWM
NC
NC
INT
UART TX
PA9
TX
UART RX
PA10
RX
NC
NC
SCL
NC
NC
SDA
Power Supply
5V
5V
Ground
GND
GND
1

Take a closer look

Click board™ Schematic

RS485 Isolator Click Schematic schematic

Step by step

Project assembly

Click Shield for Nucleo-144 accessories 1 image hardware assembly

Start by selecting your development board and Click board™. Begin with the Nucleo 144 with STM32F413ZH MCU as your development board.

Click Shield for Nucleo-144 accessories 1 image hardware assembly
Nucleo 144 with STM32F446ZE MCU front image hardware assembly
Charger 27 Click front image hardware assembly
Prog-cut hardware assembly
Charger 27 Click complete accessories setup image hardware assembly
Nucleo 144 with STM32F413ZH MCU Access MB 1 - upright/background hardware assembly
Necto image step 2 hardware assembly
Necto image step 3 hardware assembly
Necto image step 4 hardware assembly
Necto image step 5 hardware assembly
Necto image step 6 hardware assembly
STM32F413ZH Nucleo MCU Step hardware assembly
Necto No Display image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Debug Image Necto Step hardware 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.

Software Support

Library Description

This library contains API for RS485 Isolator Click driver.

Key functions:

  • rs485isolator_set_receiver_mode - Set receiver state.

  • rs485isolator_generic_read - Generic read function.

  • rs485isolator_generic_write - Generic write function.

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 RS485 Isolator Click example
 * 
 * # Description
 * This example reads and processes data from RS485 Isolator clicks.
 *
 * The demo application is composed of two sections :
 * 
 * ## Application Init 
 * Initializes driver.
 * 
 * ## Application Task  
 * Depending on the selected mode, it reads all the received data or sends the desired message
 * every 2 seconds.
 * 
 * ## Additional Function
 * - rs485isolator_process ( ) - The general process of collecting the received data.
 * 
 * @note
 * Wire connection guide : Driver(Master)       Slave
 *                                     Y   ->   A
 *                                     Z   ->   B
 * 
 * \author MikroE Team
 *
 */
// ------------------------------------------------------------------- INCLUDES

#include "board.h"
#include "log.h"
#include "rs485isolator.h"
#include "string.h"

// Comment out the line below in order to switch the application mode to receiver
#define DEMO_APP_TRANSMITTER

#define TEXT_TO_SEND "MIKROE - RS485 Isolator click\r\n"

#define PROCESS_RX_BUFFER_SIZE 100

// ------------------------------------------------------------------ VARIABLES

static rs485isolator_t rs485isolator;
static log_t logger;

// ------------------------------------------------------- ADDITIONAL FUNCTIONS

static void rs485isolator_process ( void )
{
    uint8_t uart_rx_buffer[ PROCESS_RX_BUFFER_SIZE ] = { 0 };
    
    int32_t rsp_size = rs485isolator_generic_read( &rs485isolator, uart_rx_buffer, PROCESS_RX_BUFFER_SIZE );

    if ( rsp_size > 0 )
    {  
        log_printf( &logger, "Received data: " );
        
        for ( uint8_t 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 );
        rsp_size = rs485isolator_generic_read( &rs485isolator, uart_rx_buffer, PROCESS_RX_BUFFER_SIZE );
        if ( rsp_size > 0 )
        { 
            for ( uint8_t 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;
    rs485isolator_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.
    rs485isolator_cfg_setup( &cfg );
    RS485ISOLATOR_MAP_MIKROBUS( cfg, MIKROBUS_1 );
    rs485isolator_init( &rs485isolator, &cfg );
    
    log_info( &logger, " Application Task " );
}

void application_task ( void )
{
#ifdef DEMO_APP_TRANSMITTER
    rs485isolator_generic_write( &rs485isolator, TEXT_TO_SEND, strlen ( TEXT_TO_SEND ) );
    log_info( &logger, "---- Data sent ----" );
    Delay_ms( 2000 );
#else
    rs485isolator_process( );
#endif    
}

void main ( void )
{
    application_init( );

    for ( ; ; )
    {
        application_task( );
    }
}

// ------------------------------------------------------------------------ END

Additional Support

Resources

Love this project?

'Buy This Kit' button takes you directly to the shopping cart where you can easily add or remove products.