By utilizing a single data line for communication and choosing this type of conversion (1-Wire to UART), you will perform efficient and reliable data transfer without additional wiring
A
A
Hardware Overview
How does it work?
UART 1-Wire Click is based on the DS2480B, a serial to the 1-Wire® driver from Analog Devices. This IC is designed to interface the UART with the 1-Wire® bus directly. It performs data conversion using independent data rates for both interfaces, allowing standard and overdrive communication speeds. Internal timing generators of the DS2480B IC are continuously synchronized with the incoming UART data, which is typically driven by a high-precision crystal oscillator of the host microcontroller (MCU). This allows time-critical 1-Wire® signals to be generated by the DS2480B, significantly reducing the processing load from the host MCU. Many physical parameters of the UART and 1-Wire® buses can be fine-tuned so that the UART 1-Wire click can be accommodated to any UART/RS232 to 1-Wire® signal conversion application. The DS2480B IC can be observed as a complex state machine. UART commands can configure it, so the IC must parse the
incoming data before conversion. The device can be operated in two main operating modes: Command Mode and Data Mode. The Command Mode is the default state after the Power ON event. This mode allows the configuration parameters to be set. However, the DS2480B IC must be initialized before any operation: the 1-Wire® bus reset command should be sent over the TXD line at a fixed rate of 9600 bps. This is used only to calibrate the internal timing generators without performing any action on the 1-Wire® bus. After the initialization, the DS2480B IC can be used normally. The Data Mode converts bytes received at the TXD line into their equivalent 1-Wire® waveforms and reports the responses back to the host MCU through the RXD line. The datasheet of the DS2480B IC illustrates the operating principles of this IC by using the state transition diagram. Along with several examples at the end of the datasheet, it represents a useful starting point for application
development. However, the included mikroSDK-compatible library offers functions that simplify firmware development even more. The DS2480B requires 5V for both the power supply and logic levels. Considering that most MCUs use 3.3V logic levels for UART communication, a level translator had to be added. UART 1-Wire click uses the TXB0106, a bi-directional level translator IC, by Texas Instruments. This IC allows reliable logic voltage level translation, allowing the Click board™ to be used with a wide range of MCUs that use 3.3V logic levels on their UART lines. The 1-Wire® bus can be accessed over the screw terminal on the Click board™. Due to the nature of most 1-Wire® applications, the signal line of the 1-Wire® bus is protected by the DS9503, an integrated ESD Protection Diode with resistors. This IC is specifically designed to be used as Electrostatic Discharge (ESD) protection in 1-Wire® applications.
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
![default](https://cdn.mikroe.com/rent-a-product/request-setup/mcu-cards/mcu-card-18-for-stm32-stm32l041c6.png)
Type
8th Generation
Architecture
ARM Cortex-M0
MCU Memory (KB)
32
Silicon Vendor
STMicroelectronics
Pin count
48
RAM (Bytes)
8192
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Schematic
![UART 1-Wire Click Schematic schematic](https://dbp-cdn.mikroe.com/catalog/click-boards/resources/1ee790b3-043e-6082-b931-0242ac120009/schematic.webp)
Step by step
Project assembly
Track your results in real time
Application Output
After loading the code example, pressing the "DEBUG" button builds and programs it on the selected setup.
![Application Output Step 1](https://dbp-cdn.mikroe.com/cms/shared-resources/1eed554e-d80f-6694-8cb9-02420a000272/AP-Step1.jpg)
After programming is completed, a header with buttons for various actions available in the IDE appears. By clicking the green "PLAY "button, we start reading the results achieved with Click board™.
![Application Output Step 3](https://dbp-cdn.mikroe.com/cms/shared-resources/1eed5550-3c0f-6800-a19f-02420a000272/AP-Step3.jpg)
Upon completion of programming, the Application Output tab is automatically opened, where the achieved result can be read. In case of an inability to perform the Debug function, check if a proper connection between the MCU used by the setup and the CODEGRIP programmer has been established. A detailed explanation of the CODEGRIP-board connection can be found in the CODEGRIP User Manual. Please find it in the RESOURCES section.
![Application Output Step 4](https://dbp-cdn.mikroe.com/cms/shared-resources/1eed5550-d4d0-6b20-a348-02420a000272/AP-Step4.jpg)
Software Support
Library Description
This library contains API for UART 1-Wire Click driver.
Key functions:
uart1wire_write_command
- This function sends an 8-bit command to the click module.uart1wire_read_temperature
- This function reads the temperature from DALLAS one wire temperature sensors.uart1wire_reset
- This function sends a reset pulse signal.
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
* \brief UART1Wire Click example
*
* # Description
* This example reads and processes data from UART 1-Wire clicks.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes the driver and logger.
*
* ## Application Task
* Reads the temperature data from DALLAS temperature sensors and logs the results
* on the USB UART every second.
*
* @note
* Connect only DQ and GND pins to the UART 1-Wire click connector.
*
* \author MikroE Team
*
*/
// ------------------------------------------------------------------- INCLUDES
#include "board.h"
#include "log.h"
#include "uart1wire.h"
#include "string.h"
// ------------------------------------------------------------------ VARIABLES
static uart1wire_t uart1wire;
static log_t logger;
// ------------------------------------------------------ APPLICATION FUNCTIONS
void application_init ( void )
{
log_cfg_t log_cfg;
uart1wire_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.
uart1wire_cfg_setup( &cfg );
UART1WIRE_MAP_MIKROBUS( cfg, MIKROBUS_1 );
uart1wire_init( &uart1wire, &cfg );
Delay_ms( 100 );
}
void application_task ( void )
{
float temp_f;
uint8_t res_flag;
res_flag = uart1wire_read_temperature ( &uart1wire, &temp_f, UART1WIRE_TEMP_SENSOR_RESOLUTION_9BIT );
if ( res_flag == UART1WIRE_OK )
{
log_printf( &logger, " * Temperature: %.2f C\r\n", temp_f );
log_printf( &logger, "------------------------------\r\n" );
Delay_ms( 1000 );
}
}
void main ( void )
{
application_init( );
for ( ; ; )
{
application_task( );
}
}
// ------------------------------------------------------------------------ END