4 Software Porting for Other MCUs
The UWB application software runs with a few basic functions that are specific to the target MCU. The user can change the Hardware Abstraction Layer (HAL) to port the application software to other MCUs if an SPI peripheral is available.
The following table describes the HAL functions of the UWB software.
Required Functions | Description |
---|---|
void PLATFORM_delay_ms(uint16_t ms) | Delay function (time in ms) |
void PLATFORM_delay_us(uint16_t us) | Delay function (time in µs) |
void PLATFORM_UWB_init(void) | Initialization of I/O pins, SPI peripheral and power registers |
void PLATFORM_UWB_RST_N_set(uint8_t
pinLevel) | Enables or disables the reset signal |
void PLATFORM_set_V12(uint8_t pinLevel) | Enables or disables 1.25V DC/DC converter |
uint8_t PLATFORM_UWB_read_irq_pin(void) | Reads the IRQ signal |
uint8_t PLATFORM_UWB_read_io_pins(void) | Reads the General Purpose Input/Output (GPIO) pins |
void PLATFORM_UWB_SPI_writeBytes(uint8_t *data, uint16_t
length) | Writes data bytes through the SPI peripheral |
uint8_t *PLATFORM_UWB_SPI_writeReadBytes(uint8_t *data,
uint16_t length) | Writes and reads data bytes via the SPI peripheral |
Optional Functions | Description |
uint8_t PLATFORM_getchar(void) | Reads character from the Debug port (UART peripheral) |
void PLATFORM_putchar(uint8_t data) | Writes character to the Debug port (UART peripheral) |
void PLATFORM_set_LED(uint8_t pinLevel) | Sets LED ON or OFF (optional) |
void PLATFORM_set_error_LED(uint16_t t1, uint16_t
t2) | Sets LED into the Blink mode |
uint8_t PLATFORM_UWB_read_sw1_pin(void) | Reads SW1 button status |
The user can locate these functions in the hal.c
and
hal.h
files. These files also include other functions required to
set up a target MCU.
The uwb_default.h
contains a structure with the default SPI register
values for the ATA8352 device. The user must locate this
structure in the nonvolatile memory, such as flash or EEPROM.
The uwb_driver.c
file includes a
uwb_init_default_register()
function to load these values into a
working copy located in the SRAM, which is modified during the application flow.