Upgrade your designs with our advanced Analog-To-Digital converter and achieve precision like never before
A
A
Hardware Overview
How does it work?
ADC 20 Click is based on the TLA2518, a small, eight-channel, multiplexed, 12-bit, 1-MSPS, analog-to-digital converter (ADC) from Texas Instruments. The TLA2518 has an internal oscillator for the ADC conversion process and supports averaging multiple data samples with a single conversion start. Also, the built-in programmable averaging filters, which output a 16-bit result for enhanced resolution, help reduce noise from the analog inputs and the number of data samples required to be read by the host MCU. The analog input channel selection can be auto-sequenced to simplify the digital interface with the host MCU. This Click board™ communicates with MCU through a standard SPI interface, supporting all four SPI-compatible protocols (SPI Mode 0, 1, 2, and 3) to access
the device, and operates at clock rates up to 60MHz for all configurations and information management and acquiring conversion results. As mentioned, the TLA2518 powers up in Manual mode and can be configured into either of three operational modes by writing the configuration registers for the desired mode. The Manual mode allows the host MCU to directly select the analog input channel, while in the second, the On-the-Fly mode of operation, the analog input channel is set using the first five bits on the SDI signal without waiting for the CS rising edge. This way, the ADC samples the newly selected channel on the CS edge, and there is no latency between the channel selection and the ADC output data. In the third Auto-Sequence mode, the internal channel sequencer
switches the multiplexer to the next analog input channel after every conversion. In addition to the fact that all eight channels, also including channels on the side headers, can be used as analog input pins, this board allows for some channels, in this case, channels CH0, CH1, CH6, and CH7 of the TLA2518 to be configured as digital inputs, open-drain digital outputs, and push-pull digital outputs. 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. 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.
Features overview
Development board
Fusion for ARM 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 ARM® Cortex®-M based MCUs regardless of their number of pins, and a broad set of unique functions, such as the first-ever embedded debugger/programmer over WiFi. 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 ARM v8 provides a fluid and immersive working experience, allowing access anywhere and under any
circumstances at any time. Each part of the Fusion for ARM 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 ARM 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)
2048
Silicon Vendor
STMicroelectronics
Pin count
216
RAM (Bytes)
262144
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Schematic
Step by step
Project assembly
Track your results in real time
Application Output via UART Mode
1. Once the code example is loaded, pressing the "FLASH" button initiates the build process, and programs it on the created setup.
2. After the programming is completed, click on the Tools icon in the upper-right panel, and select the UART Terminal.
3. After opening the UART Terminal tab, first check the baud rate setting in the Options menu (default is 115200). If this parameter is correct, activate the terminal by clicking the "CONNECT" button.
4. Now terminal status changes from Disconnected to Connected in green, and the data is displayed in the Received data field.
Software Support
Library Description
This library contains API for ADC 20 Click driver.
Key functions:
adc20_read_data
This function reads two bytes of data by using SPI serial interface.adc20_set_gpo_value
This function sets the gpo value for the selected channels.adc20_read_gpio_value
This function reads the gpio pins value.
Open Source
Code example
This example can be found in NECTO Studio. Feel free to download the code, or you can copy the code below.
/*!
* @file main.c
* @brief ADC 20 Click example
*
* # Description
* This example demonstrates the use of ADC 20 click board by displaying the state of 8 channels
* configured as analog inputs (CH2-CH5), digital inputs (CH0-CH1) and digital outputs (CH6-CH7).
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes the driver and performs the click default configuration.
*
* ## Application Task
* Starts the auto sequence mode, reads the 12bit ADC value from analog input channels (CH2-CH5) and
* displays the values converted to voltage on the USB UART. After that, stops auto sequence mode and
* toggles the state of digital output pins (CH6-CH7), then reads and displays the state of all GPIO pins.
*
* @author Stefan Filipovic
*
*/
#include "board.h"
#include "log.h"
#include "adc20.h"
static adc20_t adc20;
static log_t logger;
void application_init ( void )
{
log_cfg_t log_cfg; /**< Logger config object. */
adc20_cfg_t adc20_cfg; /**< Click config object. */
/**
* 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.
adc20_cfg_setup( &adc20_cfg );
ADC20_MAP_MIKROBUS( adc20_cfg, MIKROBUS_1 );
if ( SPI_MASTER_ERROR == adc20_init( &adc20, &adc20_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( ADC20_ERROR == adc20_default_cfg ( &adc20 ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
void application_task ( void )
{
adc20_start_auto_sequence ( &adc20 );
for ( uint8_t ch_id = ADC20_CHANNEL_ID_2; ch_id <= ADC20_CHANNEL_ID_5; ch_id++ )
{
uint16_t adc_data = 0;
if ( ADC20_OK == adc20_read_data ( &adc20, &adc_data ) )
{
float voltage = ( float ) ( adc_data >> ADC20_ADC_OFFSET ) / ADC20_RES_12BIT * ADC20_VREF_3V3;
log_printf ( &logger, " AIN%u: %.2f V\r\n", ( adc_data & ADC20_CHANNEL_ID_MASK ), voltage );
}
}
adc20_stop_auto_sequence ( &adc20 );
static uint8_t out_logic_state = ADC20_GPIO_VALUE_LOW;
if ( ADC20_OK == adc20_set_gpo_value ( &adc20, ( ADC20_CHANNEL_6 | ADC20_CHANNEL_7 ), out_logic_state ) )
{
uint8_t gpio_value = 0;
if ( ADC20_OK == adc20_read_gpio_value ( &adc20, &gpio_value ) )
{
log_printf ( &logger, " GPIO state: 0x%.2X\r\n", gpio_value );
}
}
out_logic_state = !out_logic_state;
log_printf ( &logger, "\r\n" );
Delay_ms ( 1000 );
}
void main ( void )
{
application_init( );
for ( ; ; )
{
application_task( );
}
}
// ------------------------------------------------------------------------ END