uwb3 2.1.0.0
main.c File Reference

UWB 3 Click Example. More...

#include "board.h"
#include "log.h"
#include "uwb3.h"

Macros

#define APP_INITIATOR   0
 
#define APP_RESPONDER_1   1
 
#define APP_RESPONDER_2   2
 
#define DEMO_APP   APP_INITIATOR
 
#define INITIATOR_CONFIG   "4 2400 200 25 2 42 01:02:03:04:05:06:07:08 1 0 0 1 2"
 
#define RESPONDER_1_CONFIG   "4 2400 200 25 2 42 01:02:03:04:05:06:07:08 1 0 0 1"
 
#define RESPONDER_2_CONFIG   "4 2400 200 25 2 42 01:02:03:04:05:06:07:08 1 0 0 2"
 
#define APP_BUFFER_SIZE   800
 
#define PROCESS_BUFFER_SIZE   200
 

Functions

void application_init (void)
 
void application_task (void)
 
int main (void)
 

Detailed Description

UWB 3 Click Example.

Description

This example demonstrates the use of an UWB 3 click board by showing the communication between the two click boards.

The demo application is composed of two sections :

Application Init

Initializes the driver and configures the click board for the selected application mode.

Application Task

Reads and processes all incoming ranging block messages and displays them on the USB UART. One click board should be configured to initiator mode and the others to responder 1 or 2. The initiator click displays the address and distance of each responder nodes, while the responder click boards displays the address and distance of the initiator click board.

Additional Function

  • static void uwb3_clear_app_buf ( void )
  • static void uwb3_log_app_buf ( void )
  • static err_t uwb3_process ( uwb3_t *ctx )
  • static err_t uwb3_display_response ( uwb3_t *ctx )
  • static err_t uwb3_parse_ranging_block ( void )
Author
Stefan Filipovic

Macro Definition Documentation

◆ APP_BUFFER_SIZE

#define APP_BUFFER_SIZE   800

◆ APP_INITIATOR

#define APP_INITIATOR   0

◆ APP_RESPONDER_1

#define APP_RESPONDER_1   1

◆ APP_RESPONDER_2

#define APP_RESPONDER_2   2

◆ DEMO_APP

#define DEMO_APP   APP_INITIATOR

◆ INITIATOR_CONFIG

#define INITIATOR_CONFIG   "4 2400 200 25 2 42 01:02:03:04:05:06:07:08 1 0 0 1 2"

INITF/RESPF parameter list and default value Order Config Param Default value Description #1 RFRAME BPRF 4 RFRAME BRFF set as per FiRa spec: 4 - SP3 SFD4Z, 6 - SP3 SFD4A #2 RSTU slot duration 2400 Duration of the slot in RSTU time units. 1ms = 1200 RSTU #3 Block duration ms 200 Duration of the FiRa ranging block in ms #4 Round duration slots 25 Duration of the FiRa ranging round inside the block #5 Ranging Round usage 2 0 - Not used, 1 - SS-TWR, 2 - DS-TWR #6 Session ID 42 Session ID #7 vupper64 01:02:03:04:05:06:07:08 Eight hexadecimal numbers, represented static part of the STS in FiRa standard, Hex values separated by ":" #8 Multi node mode 0 0 for unicast, 1 for multi-node configuration #9 Round hopping 0 0 for no round hopping, 1 for round hopping #10 Initiator address 0 Address of FiRa Initiator, Decimal value 0-65535 #11 Responder address 1 Address of responder or set of addresses for multiple responders, Decimal value 0-65535

◆ PROCESS_BUFFER_SIZE

#define PROCESS_BUFFER_SIZE   200

◆ RESPONDER_1_CONFIG

#define RESPONDER_1_CONFIG   "4 2400 200 25 2 42 01:02:03:04:05:06:07:08 1 0 0 1"

◆ RESPONDER_2_CONFIG

#define RESPONDER_2_CONFIG   "4 2400 200 25 2 42 01:02:03:04:05:06:07:08 1 0 0 2"

Function Documentation

◆ application_init()

void application_init ( void )

< Logger config object.

< 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 LOG_MAP_USB_UART macro definition for detailed explanation.

◆ application_task()

void application_task ( void )

◆ main()

int main ( void )