我们的超宽带 (UWB) 收发器在双向测距和到达时间差 (TDOA) 系统中设立了新的标准,确保10厘米的精度,适用于室内定位、资产管理等应用。
A
A
硬件概览
它是如何工作的?
UWB Click 基于 Qorvo 的 DWM1000,这是一款符合 UWB 标准的无线收发模块。模块上集成了射频组件、Qorvo UWB 收发器和其他组件。DWM1000 使 UWB 通信和测距功能的集成变得经济高效且复杂度降低,大大加快了设计实现速度。该模块使实时定位系统 (RTLS) 中的对象定位精度达到室内 10cm,数据传输速率高达 6.8 Mbps,得益于相干接收器技术,通信范围可达 300m。模块包含一个板载的 38.4 MHz 参考晶体,在生产过程中已修剪,以使用收发器的内部芯片晶体修剪电路将初始频率误差降低到约 2 ppm。DWM1000 模块通过标准 SPI 串行接口与 MCU 通信,最大 SPI 频率为 20 MHz。该模块还具有多个 GPIO 引脚,其中两个用于驱动 LED 指示灯,通知用户
使用的收发器配置(TX 或 RX)。此外,它具有复位和中断引脚,连接到 mikroBUS™ 的 INT 和 RST 引脚。当电源接通 DWM1000 时,作为其上电序列的一部分,内部电路将 RST 引脚拉低。RST 保持低电平,直到模块上的晶体振荡器上电并且其输出适用于设备的其余部分,此时 RST 变为高电平。RST 引脚也可以用作输出,在加电时重置外部电路,作为系统启动的一部分。Always-On (AON) 存储器可用于在芯片电压调节器禁用时保留 DWM1000 配置数据的最低功耗操作状态下。根据最终使用的应用程序和系统设计,可能需要调整 DWM1000 设置。为了帮助进行这种调整,可以启用几种内置功能,例如连续波 TX 和连续包传输。为了最大化范围,DWM1000
的发射功率谱密度 (PSD) 应设置为将在其使用的地理区域内允许的最大值。由于模块包含集成天线,发射功率只能通过空中测量。DWM1000 提供了调整发射功率的功能,这些调整可用于在符合法规光谱掩模的同时最大化发射功率。此 Click board™ 使用 SPI 通信接口。它设计为仅在 3.3V 逻辑电平下运行。在将 Click board™ 用于 5V 逻辑电平的 MCU 之前,应进行适当的逻辑电压电平转换。有关 DWM1000 功能、电气规格和典型性能的更多信息,请参阅附带的数据手册。然而,该 Click board™ 配备了一个包含易于使用的功能和用法示例的库,可以用作开发的参考。
功能概述
开发板
EasyPIC v8 是一款专为快速开发嵌入式应用的需求而特别设计的开发板。它支持许多高引脚计数的8位PIC微控制器,来自Microchip,无论它们的引脚数量如何,并且具有一系列独特功能,例如首次集成的调试器/程序员。开发板布局合理,设计周到,使得最终用户可以在一个地方找到所有必要的元素,如开关、按钮、指示灯、连接器等。得益于创新的制造技术,EasyPIC v8 提供了流畅而沉浸式的工作体验,允许在任何情况下、任何地方、任何时候都能访问。
EasyPIC v8 开发板的每个部分都包含了使同一板块运行最高效的必要组件。除了先进的集成CODEGRIP程 序/调试模块,该模块提供许多有价值的编程/调试选项和与Mikroe软件环境的无缝集成外,该板还包括一个干净且调节过的开发板电源供应模块。它可以使用广泛的外部电源,包括电池、外部12V电源供应和通过USB Type-C(USB-C)连接器的电源。通信选项如USB-UART、USB DEVICE和CAN也包括在内,包括 广受好评的mikroBUS™标准、两种显示选项(图形和
基于字符的LCD)和几种不同的DIP插座。这些插座覆盖了从最小的只有八个至四十个引脚的8位PIC MCU的广泛范围。EasyPIC v8 是Mikroe快速开发生态系统的一个组成部分。它由Mikroe软件工具原生支持,得益于大量不同的Click板™(超过一千块板),其数量每天都在增长,它涵盖了原型制作和开发的许多方面。
微控制器概述
MCU卡片 / MCU

建筑
PIC
MCU 内存 (KB)
64
硅供应商
Microchip
引脚数
28
RAM (字节)
3896
使用的MCU引脚
mikroBUS™映射器
“仔细看看!”
Click board™ 原理图

一步一步来
项目组装
实时跟踪您的结果
应用程序输出
1. 应用程序输出 - 在调试模式下,“应用程序输出”窗口支持实时数据监控,直接提供执行结果的可视化。请按照提供的教程正确配置环境,以确保数据正确显示。

2. UART 终端 - 使用UART Terminal通过USB to UART converter监视数据传输,实现Click board™与开发系统之间的直接通信。请根据项目需求配置波特率和其他串行设置,以确保正常运行。有关分步设置说明,请参考提供的教程。

3. Plot 输出 - Plot功能提供了一种强大的方式来可视化实时传感器数据,使趋势分析、调试和多个数据点的对比变得更加直观。要正确设置,请按照提供的教程,其中包含使用Plot功能显示Click board™读数的分步示例。在代码中使用Plot功能时,请使用以下函数:plot(insert_graph_name, variable_name);。这是一个通用格式,用户需要将“insert_graph_name”替换为实际图表名称,并将“variable_name”替换为要显示的参数。

软件支持
库描述
该库包含 UWB Click 驱动程序的 API。
关键功能:
uwb_set_mode
- 此功能设置设备的工作模式。uwb_get_transmit_status
- 此功能获取传输状态。uwb_start_transceiver
- 此功能启动设备通信。
开源
代码示例
完整的应用程序代码和一个现成的项目可以通过NECTO Studio包管理器直接安装到NECTO Studio。 应用程序代码也可以在MIKROE的GitHub账户中找到。
/*!
* \file
* \brief Uwb Click example
*
* # Description
* UWB Click sends and receive data, depending on the selected device mode.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes the driver and configures the click board for the selected mode.
*
* ## Application Task
* Depending on the selected mode, it reads all the received data or sends the desired message
* every 2 seconds.
*
* \author MikroE Team
*
*/
// ------------------------------------------------------------------- INCLUDES
#include "board.h"
#include "log.h"
#include "uwb.h"
// ------------------------------------------------------------------ VARIABLES
static uwb_t uwb;
static log_t logger;
// Device mode setter - selects the module working mode RX(receiver)/TX(transmitter)
static uint8_t dev_mode = UWB_MODE_TX;
// Transmit buffers
static uint8_t data_tx_1[ 7 ] = "MikroE";
static uint8_t data_tx_2[ 10 ] = "UWB click";
// Transmit length read var
static uint16_t temp_len = 0;
// Recieved data buffer
static uint8_t transmit_data[ 256 ] = { 0 };
// Dev_status var
static uint8_t dev_status = { 0 };
// ------------------------------------------------------ APPLICATION FUNCTIONS
void application_init ( void )
{
log_cfg_t log_cfg;
uwb_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.
uwb_cfg_setup( &cfg );
UWB_MAP_MIKROBUS( cfg, MIKROBUS_1 );
uwb_init( &uwb, &cfg );
Delay_ms ( 100 );
uwb_enable ( &uwb );
Delay_ms ( 100 );
uint8_t id_raw[ 4 ] = { 0 };
uwb.offset = UWB_SUB_NO;
uwb_generic_read( &uwb, UWB_REG_DEV_ID, &id_raw[ 0 ], 4 );
uint16_t tag_data = ( ( uint16_t ) id_raw[ 3 ] << 8 ) | id_raw[ 2 ];
if ( UWB_TAG != tag_data )
{
log_printf( &logger, " ***** ERROR ***** \r\n" );
for ( ; ; );
}
uwb_set_mode( &uwb, UWB_MODE_IDLE );
//-----------------------------------------------------
// Setting device mode and interrupt for that mode as well as clearing dev_status reg.
uwb_set_mode( &uwb, dev_mode );
uwb_int_mask_set( &uwb );
uwb_clear_status( &uwb );
// Setting device address and network ID
log_printf( &logger, " ******************** \r\n" );
if ( UWB_MODE_RX == dev_mode )
{
uwb_set_dev_adr_n_network_id( &uwb, 6, 10 );
log_printf( &logger, " ***** RECEIVER ***** \r\n" );
}
else if ( UWB_MODE_TX == dev_mode )
{
uwb_set_dev_adr_n_network_id( &uwb, 5, 10 );
log_printf( &logger, " **** TRANSMITER **** \r\n" );
}
log_printf( &logger, " ******************** \r\n" );
Delay_ms ( 100 );
// Setting default configuartion and tuning device for that configuration
uwb_use_smart_power( &uwb, UWB_LOW );
uwb_frame_check( UWB_LOW );
uwb_frame_filter( &uwb, UWB_LOW );
uwb_set_transmit_type( &uwb, &UWB_TMODE_LONGDATA_RANGE_LOWPOWER[ 0 ] );
uwb_set_channel( &uwb, UWB_CHANNEL_5 );
uwb_tune_config( &uwb );
Delay_ms ( 100 );
if ( UWB_MODE_RX == dev_mode )
{
// Setup for first receive
uwb_set_mode( &uwb, UWB_MODE_IDLE );
uwb_set_bit ( &uwb, UWB_REG_SYS_CFG, 29, UWB_HIGH );
uwb_set_bit ( &uwb, UWB_REG_SYS_CFG, 30, UWB_HIGH );
uwb_set_bit ( &uwb, UWB_REG_SYS_CFG, 31, UWB_HIGH );
uwb_set_mode( &uwb, UWB_MODE_RX );
uwb_clear_status( &uwb );
uwb_start_transceiver( &uwb );
}
else if ( UWB_MODE_TX == dev_mode )
{
// Setup for first transmit
uwb_set_mode( &uwb, UWB_MODE_IDLE );
uwb_clear_status( &uwb );
uwb_set_transmit( &uwb, &data_tx_1[ 0 ], 6 );
uwb_set_mode( &uwb, UWB_MODE_TX );
uwb_start_transceiver( &uwb );
log_printf( &logger, " - Transmit 1 done - \r\n" );
}
log_printf( &logger, " ***** APP TASK ***** \r\n" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
}
void application_task ( void )
{
dev_status = uwb_get_qint_pin_status( &uwb );
if ( UWB_MODE_RX == dev_mode )
{
if ( dev_status )
{
// Reading transmitted data, logs it and resetting to receive mode
uwb_set_mode( &uwb, UWB_MODE_IDLE );
uwb_clear_status( &uwb );
temp_len = uwb_get_transmit_len( &uwb );
uwb_get_transmit( &uwb, &transmit_data[ 0 ], temp_len );
log_printf( &logger, "Received data: %s\r\n", transmit_data );
log_printf( &logger, " - Receive done - \r\n" );
uwb_set_mode( &uwb, UWB_MODE_RX );
uwb_start_transceiver( &uwb );
}
}
else if ( UWB_MODE_TX == dev_mode )
{
if ( dev_status )
{
// Transmits data, resetting to transmit mode and sets 2sec delay
uwb_set_mode( &uwb, UWB_MODE_IDLE );
uwb_clear_status( &uwb );
uwb_set_transmit( &uwb, &data_tx_2[ 0 ], 9 );
uwb_set_mode( &uwb, UWB_MODE_TX );
uwb_start_transceiver( &uwb );
log_printf( &logger, " - Transmit 2 done - \r\n" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
uwb_set_mode( &uwb, UWB_MODE_IDLE );
uwb_clear_status( &uwb );
uwb_set_transmit( &uwb, &data_tx_1[ 0 ], 6 );
uwb_set_mode( &uwb, UWB_MODE_TX );
uwb_start_transceiver( &uwb );
log_printf( &logger, " - Transmit 1 done - \r\n" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
}
}
}
int main ( void )
{
/* Do not remove this line or clock might not be set correctly. */
#ifdef PREINIT_SUPPORTED
preinit();
#endif
application_init( );
for ( ; ; )
{
application_task( );
}
return 0;
}
// ------------------------------------------------------------------------ END
/*!
* \file
* \brief Uwb Click example
*
* # Description
* UWB Click sends and receive data, depending on the selected device mode.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes the driver and configures the click board for the selected mode.
*
* ## Application Task
* Depending on the selected mode, it reads all the received data or sends the desired message
* every 2 seconds.
*
* \author MikroE Team
*
*/
// ------------------------------------------------------------------- INCLUDES
#include "board.h"
#include "log.h"
#include "uwb.h"
// ------------------------------------------------------------------ VARIABLES
static uwb_t uwb;
static log_t logger;
// Device mode setter - selects the module working mode RX(receiver)/TX(transmitter)
static uint8_t dev_mode = UWB_MODE_TX;
// Transmit buffers
static uint8_t data_tx_1[ 7 ] = "MikroE";
static uint8_t data_tx_2[ 10 ] = "UWB click";
// Transmit length read var
static uint16_t temp_len = 0;
// Recieved data buffer
static uint8_t transmit_data[ 256 ] = { 0 };
// Dev_status var
static uint8_t dev_status = { 0 };
// ------------------------------------------------------ APPLICATION FUNCTIONS
void application_init ( void )
{
log_cfg_t log_cfg;
uwb_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.
uwb_cfg_setup( &cfg );
UWB_MAP_MIKROBUS( cfg, MIKROBUS_1 );
uwb_init( &uwb, &cfg );
Delay_ms ( 100 );
uwb_enable ( &uwb );
Delay_ms ( 100 );
uint8_t id_raw[ 4 ] = { 0 };
uwb.offset = UWB_SUB_NO;
uwb_generic_read( &uwb, UWB_REG_DEV_ID, &id_raw[ 0 ], 4 );
uint16_t tag_data = ( ( uint16_t ) id_raw[ 3 ] << 8 ) | id_raw[ 2 ];
if ( UWB_TAG != tag_data )
{
log_printf( &logger, " ***** ERROR ***** \r\n" );
for ( ; ; );
}
uwb_set_mode( &uwb, UWB_MODE_IDLE );
//-----------------------------------------------------
// Setting device mode and interrupt for that mode as well as clearing dev_status reg.
uwb_set_mode( &uwb, dev_mode );
uwb_int_mask_set( &uwb );
uwb_clear_status( &uwb );
// Setting device address and network ID
log_printf( &logger, " ******************** \r\n" );
if ( UWB_MODE_RX == dev_mode )
{
uwb_set_dev_adr_n_network_id( &uwb, 6, 10 );
log_printf( &logger, " ***** RECEIVER ***** \r\n" );
}
else if ( UWB_MODE_TX == dev_mode )
{
uwb_set_dev_adr_n_network_id( &uwb, 5, 10 );
log_printf( &logger, " **** TRANSMITER **** \r\n" );
}
log_printf( &logger, " ******************** \r\n" );
Delay_ms ( 100 );
// Setting default configuartion and tuning device for that configuration
uwb_use_smart_power( &uwb, UWB_LOW );
uwb_frame_check( UWB_LOW );
uwb_frame_filter( &uwb, UWB_LOW );
uwb_set_transmit_type( &uwb, &UWB_TMODE_LONGDATA_RANGE_LOWPOWER[ 0 ] );
uwb_set_channel( &uwb, UWB_CHANNEL_5 );
uwb_tune_config( &uwb );
Delay_ms ( 100 );
if ( UWB_MODE_RX == dev_mode )
{
// Setup for first receive
uwb_set_mode( &uwb, UWB_MODE_IDLE );
uwb_set_bit ( &uwb, UWB_REG_SYS_CFG, 29, UWB_HIGH );
uwb_set_bit ( &uwb, UWB_REG_SYS_CFG, 30, UWB_HIGH );
uwb_set_bit ( &uwb, UWB_REG_SYS_CFG, 31, UWB_HIGH );
uwb_set_mode( &uwb, UWB_MODE_RX );
uwb_clear_status( &uwb );
uwb_start_transceiver( &uwb );
}
else if ( UWB_MODE_TX == dev_mode )
{
// Setup for first transmit
uwb_set_mode( &uwb, UWB_MODE_IDLE );
uwb_clear_status( &uwb );
uwb_set_transmit( &uwb, &data_tx_1[ 0 ], 6 );
uwb_set_mode( &uwb, UWB_MODE_TX );
uwb_start_transceiver( &uwb );
log_printf( &logger, " - Transmit 1 done - \r\n" );
}
log_printf( &logger, " ***** APP TASK ***** \r\n" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
}
void application_task ( void )
{
dev_status = uwb_get_qint_pin_status( &uwb );
if ( UWB_MODE_RX == dev_mode )
{
if ( dev_status )
{
// Reading transmitted data, logs it and resetting to receive mode
uwb_set_mode( &uwb, UWB_MODE_IDLE );
uwb_clear_status( &uwb );
temp_len = uwb_get_transmit_len( &uwb );
uwb_get_transmit( &uwb, &transmit_data[ 0 ], temp_len );
log_printf( &logger, "Received data: %s\r\n", transmit_data );
log_printf( &logger, " - Receive done - \r\n" );
uwb_set_mode( &uwb, UWB_MODE_RX );
uwb_start_transceiver( &uwb );
}
}
else if ( UWB_MODE_TX == dev_mode )
{
if ( dev_status )
{
// Transmits data, resetting to transmit mode and sets 2sec delay
uwb_set_mode( &uwb, UWB_MODE_IDLE );
uwb_clear_status( &uwb );
uwb_set_transmit( &uwb, &data_tx_2[ 0 ], 9 );
uwb_set_mode( &uwb, UWB_MODE_TX );
uwb_start_transceiver( &uwb );
log_printf( &logger, " - Transmit 2 done - \r\n" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
uwb_set_mode( &uwb, UWB_MODE_IDLE );
uwb_clear_status( &uwb );
uwb_set_transmit( &uwb, &data_tx_1[ 0 ], 6 );
uwb_set_mode( &uwb, UWB_MODE_TX );
uwb_start_transceiver( &uwb );
log_printf( &logger, " - Transmit 1 done - \r\n" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
}
}
}
int main ( void )
{
/* Do not remove this line or clock might not be set correctly. */
#ifdef PREINIT_SUPPORTED
preinit();
#endif
application_init( );
for ( ; ; )
{
application_task( );
}
return 0;
}
// ------------------------------------------------------------------------ END