nRF51 SDK - S120 SoftDevice
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
DTM - Direct Test Mode

Module for testing RF/PHY using DTM commands. More...

Macros

#define DEFAULT_TX_POWER   RADIO_TXPOWER_TXPOWER_Pos4dBm
 Configuration parameters. More...
 
#define DEFAULT_TIMER   NRF_TIMER0
 
#define DEFAULT_TIMER_IRQn   TIMER0_IRQn
 
#define LE_RESET   0
 
#define LE_RECEIVER_TEST   1
 
#define LE_TRANSMITTER_TEST   2
 
#define LE_TEST_END   3
 
#define CARRIER_TEST   0
 
#define CARRIER_TEST_STUDIO   1
 
#define SET_TX_POWER   2
 
#define SELECT_TIMER   3
 
#define LE_PACKET_REPORTING_EVENT   0x8000
 
#define LE_TEST_STATUS_EVENT_SUCCESS   0x0000
 
#define LE_TEST_STATUS_EVENT_ERROR   0x0001
 
#define DTM_PKT_PRBS9   0x00
 
#define DTM_PKT_0X0F   0x01
 
#define DTM_PKT_0X55   0x02
 
#define DTM_PKT_VENDORSPECIFIC   0xFFFFFFFF
 
#define DTM_SUCCESS   0x00
 Return codes from dtm_cmd(). More...
 
#define DTM_ERROR_ILLEGAL_CHANNEL   0x01
 
#define DTM_ERROR_INVALID_STATE   0x02
 
#define DTM_ERROR_ILLEGAL_LENGTH   0x03
 
#define DTM_ERROR_ILLEGAL_CONFIGURATION   0x04
 
#define DTM_ERROR_UNINITIALIZED   0x05
 
#define PACKET_TYPE_MAX   DTM_PKT_0X55
 

Typedefs

typedef uint32_t dtm_cmd_t
 BLE DTM command codes. More...
 
typedef uint32_t dtm_event_t
 BLE DTM event type. More...
 
typedef uint32_t dtm_freq_t
 BLE DTM frequency type. More...
 
typedef uint32_t dtm_pkt_type_t
 BLE DTM packet types. More...
 

Functions

uint32_t dtm_init (void)
 Function for initializing or re-initializing DTM module. More...
 
uint32_t dtm_wait (void)
 Function for giving control to dtmlib for handling timer and radio events. Will return to caller at 625us intervals or whenever another event than radio occurs (such as UART input). Function will put MCU to sleep between events. More...
 
uint32_t dtm_cmd (dtm_cmd_t cmd, dtm_freq_t freq, uint32_t length, dtm_pkt_type_t payload)
 Function for calling when a complete command has been prepared by the Tester. More...
 
bool dtm_event_get (dtm_event_t *p_dtm_event)
 Function for reading the result of a DTM command. More...
 
bool dtm_set_timer (uint32_t new_timer)
 Function for configuring the timer to use. More...
 
bool dtm_set_txpower (uint32_t new_tx_power)
 Function for configuring the transmit power. More...
 

Detailed Description

Module for testing RF/PHY using DTM commands.

Macro Definition Documentation

#define CARRIER_TEST   0

Length=0 indicates a constant, unmodulated carrier until LE_TEST_END or LE_RESET

#define CARRIER_TEST_STUDIO   1

nRFgo Studio uses value 1 in length field, to indicate a constant, unmodulated carrier until LE_TEST_END or LE_RESET

#define DEFAULT_TIMER   NRF_TIMER0

Default timer used for timing.

#define DEFAULT_TIMER_IRQn   TIMER0_IRQn

IRQ used for timer. NOTE: MUST correspond to DEFAULT_TIMER.

#define DEFAULT_TX_POWER   RADIO_TXPOWER_TXPOWER_Pos4dBm

Configuration parameters.

Default Transmission power using in the DTM module.

#define DTM_ERROR_ILLEGAL_CHANNEL   0x01

Physical channel number must be in the range 0..39.

#define DTM_ERROR_ILLEGAL_CONFIGURATION   0x04

Parameter out of range (legal range is function dependent).

#define DTM_ERROR_ILLEGAL_LENGTH   0x03

Payload size must be in the range 0..37.

#define DTM_ERROR_INVALID_STATE   0x02

Sequencing error: Command is not valid now.

#define DTM_ERROR_UNINITIALIZED   0x05

DTM module has not been initialized by the application.

#define DTM_PKT_0X0F   0x01

Bit pattern 11110000 (LSB is the leftmost bit).

#define DTM_PKT_0X55   0x02

Bit pattern 10101010 (LSB is the leftmost bit).

#define DTM_PKT_PRBS9   0x00

Bit pattern PRBS9.

#define DTM_PKT_VENDORSPECIFIC   0xFFFFFFFF

Vendor specific. Nordic: Continuous carrier test, or configuration.

#define DTM_SUCCESS   0x00

Return codes from dtm_cmd().

Indicate that the DTM function completed with success.

#define LE_PACKET_REPORTING_EVENT   0x8000

DTM Packet reporting event, returned by the device to the tester.

#define LE_RECEIVER_TEST   1

DTM command: Start receive test.

#define LE_RESET   0

DTM command: Reset device.

#define LE_TEST_END   3

DTM command: End test and send packet report.

#define LE_TEST_STATUS_EVENT_ERROR   0x0001

DTM Status event, indicating an error.

#define LE_TEST_STATUS_EVENT_SUCCESS   0x0000

DTM Status event, indicating success.

#define LE_TRANSMITTER_TEST   2

DTM command: Start transmission test.

#define PACKET_TYPE_MAX   DTM_PKT_0X55

Highest value allowed as DTM Packet type.

#define SELECT_TIMER   3

Select on of the 16 MHz timers 0, 1 or 2

#define SET_TX_POWER   2

Set transmission power, value -40..+4 dBm in steps of 4

Typedef Documentation

typedef uint32_t dtm_cmd_t

BLE DTM command codes.

DTM command type.

typedef uint32_t dtm_event_t

BLE DTM event type.

Type for handling DTM event.

typedef uint32_t dtm_freq_t

BLE DTM frequency type.

Physical channel, valid range: 0..39.

typedef uint32_t dtm_pkt_type_t

BLE DTM packet types.

Type for holding the requested DTM payload type.

Function Documentation

uint32_t dtm_cmd ( dtm_cmd_t  cmd,
dtm_freq_t  freq,
uint32_t  length,
dtm_pkt_type_t  payload 
)

Function for calling when a complete command has been prepared by the Tester.

Parameters
[in]cmdOne of the DTM_CMD values (bits 14:15 in the 16-bit UART format).
[in]freqPhys. channel no - actual frequency = (2402 + freq * 2) MHz (bits 8:13 in the 16-bit UART format).
[in]lengthPayload length, 0..37 (bits 2:7 in the 16-bit UART format).
[in]payloadOne of the DTM_PKT values (bits 0:1 in the 16-bit UART format).
Returns
DTM_SUCCESS or one of the DTM_ERROR_ values
bool dtm_event_get ( dtm_event_t p_dtm_event)

Function for reading the result of a DTM command.

Parameters
[out]p_dtm_eventPointer to buffer for 16 bit event code according to DTM standard.
Returns
true: new event, false: no event since last call, this event has been read earlier
uint32_t dtm_init ( void  )

Function for initializing or re-initializing DTM module.

Returns
DTM_SUCCESS on successful initialization of the DTM module.
bool dtm_set_timer ( uint32_t  new_timer)

Function for configuring the timer to use.

Note
Must be called when no DTM test is running.
Parameters
[in]new_timerIndex (0..2) of timer to be used by the DTM library
Returns
true: success, new timer was selected, false: parameter error
bool dtm_set_txpower ( uint32_t  new_tx_power)

Function for configuring the transmit power.

Note
Must be called when no DTM test is running.
Parameters
[in]new_tx_powerNew output level, +4..-40, in steps of 4.
Returns
true: tx power setting changed, false: parameter error
uint32_t dtm_wait ( void  )

Function for giving control to dtmlib for handling timer and radio events. Will return to caller at 625us intervals or whenever another event than radio occurs (such as UART input). Function will put MCU to sleep between events.

Returns
Time counter, incremented every 625 us.