How does it work?
UART MUX 2 Click as its foundation uses the MAX399, a precise CMOS analog multiplexer that enables pseudo-multidrop RS232 transmission from Analog Devices. This multiplexer allows multiple channels, in this case, four, to share a single UART interface. It offers fast switching speeds with a transition time of less than 250ns and low on-resistance less than 100Ω while retains CMOS-logic input compatibility and fast switching.
The dual four-to-one multiplexer permits transceiver MAX3221 to form a network with the four remote transceivers connected to terminals labeled as UART0-UART3 located in the upper part of the Click board™. The circuit’s supply-voltage range (3V to 5.5V) makes it compatible with 3V and 5V logic. MAX399 receives its power directly from power terminals of MAX3221, whose ±5.5V outputs come from an internal charge pump. The multiplexer handles rail-to-rail signals, so obtaining its power from MAX3221 ensures that RS232 signals pass directly through, regardless of amplitude.
The UART MUX 2 Click communicates with MCU through MAX3221 using the UART interface for the data transfer. The MAX3221 can run at data rates up to 250 kbps while maintaining RS232-compliant output levels. Channel selection is performed through a set of specific GPIO pins, labeled as A0 and A1 routed on the CS and RST pins of the mikroBUS™ socket. Selecting its channel 1, for instance, enables MAX3221 to communicate with UART0 without being loaded by UART1 to UART3. Pulldown resistors inside the remote transceivers force the outputs of un-selected receivers to a known state.
In addition to a channel selection, this Click board™ also has an automatic power-down feature that can be disabled when ON and OFF pins are high, routed on the PWM and AN pins of the mikroBUS™ socket. Also, it uses the interrupt pin of the mikroBUS™ labeled as INV as an invalid indicator which makes interfacing with the RS232 simple and easy, indicating whether a valid RS232 signal is present not.
This Click board™ can operate with both 3.3V and 5V logic voltage levels selected via the VCC SEL jumper. This way, it is allowed for both 3.3V and 5V capable MCUs to properly use the UART communication lines. However, the 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.
Specifications
Type
Port expander,RS232
Applications
Can be used for a wide range of applications, from industrial and instrumentation to a consumer, communications, data-acquisition systems, and many more.
On-board modules
MAX399 – precise CMOS analog multiplexer that enables pseudo-multidrop RS232 transmission from Maxim Integrated
MAX3221 – RS232 line driver and receiver from Texas Instruments
Key Features
Low power consumption, high precission, rail-to-rail signal handling, operates up to 250 kbps, power-down feature, valid RS232 signal indicator, and more.
Interface
UART
Feature
No ClickID
Compatibility
mikroBUS™
Click board size
M (42.9 x 25.4 mm)
Input Voltage
3.3V or 5V
Pinout diagram
This table shows how the pinout on UART MUX 2 Click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
Onboard settings and indicators
Label | Name | Default | Description |
---|---|---|---|
LD1 | PWR | – | Power LED Indicator |
JP1 | VCC SEL | Left | Logic Level Voltage Selection 3V3/5V: Left position 3V3, Right position 5V |
UART MUX 2 Click electrical specifications
Description | Min | Typ | Max | Unit |
---|---|---|---|---|
Supply Voltage | 3.3 | +30 | V | |
Data Rate | 150 | 250 | – | kbps |
Operating Temperature Range | 0 | +25 | +70 | °C |
Software Support
We provide a library for the UART MUX 2 Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.
Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on mikroE github account.
Library Description
This library contains API for UART MUX 2 Click driver.
Key functions:
uartmux2_cfg_setup
– Config Object Initialization function.uartmux2_init
– Initialization function.uartmux2_default_cfg
– Click Default Configuration function.
Examples description
This library contains API for UART MUX 2 Click driver. This example transmits/receives and processes data from UART MUX 2 clicks. The library initializes and defines the UART bus drivers to transmit or receive data.
The demo application is composed of two sections :
void application_task ( void ) { #ifdef TRANSIVER for ( uart_ch = UARTMUX2_CHANNEL_0; uart_ch <= UARTMUX2_CHANNEL_3; uart_ch++ ) { uartmux2_set_channel( &uartmux2, uart_ch ); Delay_ms( 100 ); uartmux2_send_data( &uartmux2, demo_message ); log_printf( &logger, " UART%u : ", ( uint16_t ) uart_ch ); for ( uint8_t cnt = 0; cnt < 9; cnt ++ ) { log_printf( &logger, "%c", demo_message[ cnt ] ); Delay_ms( 100 ); } Delay_ms( 2000 ); } log_printf( &logger, "------------------rn" ); Delay_ms( 100 ); #endif #ifdef RECIEVER uartmux2_process( ); if ( app_buf_len > 0 ) { log_printf( &logger, "%s", app_buf ); uartmux2_clear_app_buf( ); } #endif }
The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on mikroE github account.
Other mikroE Libraries used in the example:
- MikroSDK.Board
- MikroSDK.Log
- Click.UartMux2
Additional notes and informations
Depending on the development board you are using, you may need USB UART click, USB UART 2 click or RS232 click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.
mikroSDK
This Click board™ is supported with mikroSDK – MikroElektronika Software Development Kit. To ensure proper operation of mikroSDK compliant Click board™ demo applications, mikroSDK should be downloaded from the LibStock and installed for the compiler you are using.
For more information about mikroSDK, visit the official page.