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
Nucleo 32 with STM32F031K6 MCU board provides an affordable and flexible platform for experimenting with STM32 microcontrollers in 32-pin packages. Featuring Arduino™ Nano connectivity, it allows easy expansion with specialized shields, while being mbed-enabled for seamless integration with online resources. The
board includes an on-board ST-LINK/V2-1 debugger/programmer, supporting USB reenumeration with three interfaces: Virtual Com port, mass storage, and debug port. It offers a flexible power supply through either USB VBUS or an external source. Additionally, it includes three LEDs (LD1 for USB communication, LD2 for power,
and LD3 as a user LED) and a reset push button. The STM32 Nucleo-32 board is supported by various Integrated Development Environments (IDEs) such as IAR™, Keil®, and GCC-based IDEs like AC6 SW4STM32, making it a versatile tool for developers.
Microcontroller Overview
MCU Card / MCU
Architecture
ARM Cortex-M0
MCU Memory (KB)
32
Silicon Vendor
STMicroelectronics
Pin count
32
RAM (Bytes)
4096
You complete me!
Accessories
Click Shield for Nucleo-32 is the perfect way to expand your development board's functionalities with STM32 Nucleo-32 pinout. The Click Shield for Nucleo-32 provides two mikroBUS™ sockets to add any functionality from our ever-growing range of Click boards™. We are fully stocked with everything, from sensors and WiFi transceivers to motor control and audio amplifiers. The Click Shield for Nucleo-32 is compatible with the STM32 Nucleo-32 board, providing an affordable and flexible way for users to try out new ideas and quickly create prototypes with any STM32 microcontrollers, choosing from the various combinations of performance, power consumption, and features. The STM32 Nucleo-32 boards do not require any separate probe as they integrate the ST-LINK/V2-1 debugger/programmer and come with the STM32 comprehensive software HAL library and various packaged software examples. This development platform provides users with an effortless and common way to combine the STM32 Nucleo-32 footprint compatible board with their favorite Click boards™ in their upcoming projects.
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Schematic
Step by step
Project assembly
Track your results in real time
Application Output via Debug Mode
1. Once the code example is loaded, pressing the "DEBUG" button initiates the build process, programs it on the created setup, and enters Debug mode.
2. After the programming is completed, a header with buttons for various actions within the IDE becomes visible. Clicking the green "PLAY" button starts reading the results achieved with the Click board™. The achieved results are displayed in the Application Output tab.
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