Stand-alone DTM application for UART interface.
More...
|
static __INLINE void | nrf_gpio_cfg_output (uint32_t pin_number) |
| Function for configuration of pin to use for UART TX. More...
|
|
static __INLINE void | nrf_gpio_cfg_input (uint32_t pin_number, nrf_gpio_pin_pull_t pull_config) |
| Function for configuration of pin to use for UART RX. More...
|
|
static void | uart_init (void) |
| Function for UART initialization.
|
|
static uint32_t | dtm_cmd_put (uint16_t command) |
| Function for splitting UART command bit fields into separate command parameters for the DTM library. More...
|
|
int | main (void) |
| Function for application main entry. More...
|
|
Pin used for UART Transmit.
Pin used for UART Receive.
#define BITRATE UART_BAUDRATE_BAUDRATE_Baud19200 |
Serial bitrate on the UART
#define MAX_ITERATIONS_NEEDED_FOR_NEXT_BYTE 21 |
Maximum iterations needed in the main loop between stop bit 1st byte and start bit 2nd byte. DTM standard allows 5000us delay between stop bit 1st byte and start bit 2nd byte. As the time is only known when a byte is received, then the time between between stop bit 1st byte and stop bit 2nd byte becomes: 5000us + transmission time of 2nd byte.
Byte transmission time is (Baud rate of 19200): 10bits * 1/19200 = approx. 520 us/byte (8 data bits + start & stop bit).
Loop time on polling UART register for received byte is defined in ble_dtm.c as: UART_POLL_CYCLE = 260 us
The max time between two bytes thus becomes (loop time: 260us / iteration): (5000us + 520us) / 260us / iteration = 21.2 iterations.
This is rounded down to 21.
- Note
- If UART bit rate is changed, this value should be recalculated as well.
Enumerator |
---|
NRF_GPIO_PIN_NOPULL |
Pin pullup resistor disabled.
|
NRF_GPIO_PIN_PULLDOWN |
Pin pulldown resistor enabled.
|
NRF_GPIO_PIN_PULLUP |
Pin pullup resistor enabled.
|
NRF_GPIO_PIN_NOPULL |
Pin pullup resistor disabled.
|
NRF_GPIO_PIN_PULLDOWN |
Pin pulldown resistor enabled.
|
NRF_GPIO_PIN_PULLUP |
Pin pullup resistor enabled.
|
static __INLINE void nrf_gpio_cfg_output |
( |
uint32_t |
pin_number | ) |
|
|
static |
- Parameters
-
[in] | pin_number | The pin to use as TX. |
static __INLINE void nrf_gpio_cfg_input |
( |
uint32_t |
pin_number, |
|
|
nrf_gpio_pin_pull_t |
pull_config |
|
) |
| |
|
static |
- Parameters
-
[in] | pin_number | The pin to use as RX. |
[in] | pull_config | Configuration of pull resistor. |
static uint32_t dtm_cmd_put |
( |
uint16_t |
command | ) |
|
|
static |
- Parameters
-
[in] | command | The packed UART command. |
- Returns
- result status from dtmlib.
This function serves as an adaptation layer between a 2-wire UART interface and the dtmlib. After initialization, DTM commands submitted through the UART are forwarded to dtmlib and events (i.e. results from the command) is reported back through the UART.