nRF51 SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages

Radio Test Example Application main file. More...

Macros

#define BELL   7
 
#define BS   8
 
#define BUFFER_LENGTH   16
 

Enumerations

enum  radio_tests_t {
  RADIO_TEST_NOP,
  RADIO_TEST_TXCC,
  RADIO_TEST_TXMC,
  RADIO_TEST_TXSWEEP,
  RADIO_TEST_RXC,
  RADIO_TEST_RXSWEEP,
  RADIO_TEST_NOP,
  RADIO_TEST_TXCC,
  RADIO_TEST_TXMC,
  RADIO_TEST_TXSWEEP,
  RADIO_TEST_RXC,
  RADIO_TEST_RXSWEEP,
  RADIO_TEST_NOP,
  RADIO_TEST_TXCC,
  RADIO_TEST_TXMC,
  RADIO_TEST_TXSWEEP,
  RADIO_TEST_RXC,
  RADIO_TEST_RXSWEEP,
  RADIO_TEST_NOP,
  RADIO_TEST_TXCC,
  RADIO_TEST_TXMC,
  RADIO_TEST_TXSWEEP,
  RADIO_TEST_RXC,
  RADIO_TEST_RXSWEEP
}
 

Functions

static void init (void)
 Function for configuring all peripherals used in this example.
 
static void help (void)
 Function for outputting usage info to the serial port.
 
static uint8_t get_dec2 (void)
 Function for reading two digit decimal numbers from the serial port. Backspace is supported on the first char.
 
void get_datarate (void)
 Function for reading the data rate.
 
void get_power (void)
 Function for reading the output power.
 
static void print_dec2 (uint8_t val)
 Function for printing two digit decimal numbers.
 
void print_parameters (void)
 Function for printing parameters to the serial port.
 
int main (void)
 Function for main application entry.
 
static void timer0_init (uint8_t delayms)
 Function for initializing Timer 0 in 24 bit timer mode with 1 us resolution.
 
static uint32_t rnd8 (void)
 Function for generating an 8 bit random number using the internal random generator.
 
static uint32_t rnd32 (void)
 Function for generating a 32 bit random number using the internal random generator.
 
static void generate_modulated_rf_packet (void)
 Function for configuring the radio to use a random address and a 254 byte random payload. The S0 and S1 fields are not used.
 
static void radio_disable (void)
 
void radio_sweep_end (void)
 Function for stopping Timer 0.
 
void radio_tx_carrier (uint8_t txpower, uint8_t mode, uint8_t channel)
 Function for turning on the TX carrier test mode.
 
void radio_modulated_tx_carrier (uint8_t txpower, uint8_t mode, uint8_t channel)
 Function for starting modulated TX carrier by repeatedly sending a packet with random address and random payload.
 
void radio_rx_carrier (uint8_t mode, uint8_t channel)
 Function for turning on RX carrier.
 
void radio_tx_sweep_start (uint8_t txpower, uint8_t mode, uint8_t channel_start, uint8_t channel_end, uint8_t delayms)
 Function for turning on TX carrier sweep. This test uses Timer 0 to restart the TX carrier at different channels.
 
void radio_rx_sweep_start (uint8_t mode, uint8_t channel_start, uint8_t channel_end, uint8_t delayms)
 Function for turning on RX carrier sweep. This test uses Timer 0 to restart the RX carrier at different channels.
 
void TIMER0_IRQHandler (void)
 Function for handling the Timer 0 interrupt used for TX/RX sweep. The carrier is started with the new channel, and the channel is incremented for the next interrupt.
 
void uart_put (uint8_t cr)
 Function for writing one character to UART. More...
 
uint8_t uart_get (void)
 Function for getting one character from UART. More...
 
void uart_config (uint8_t txd_pin_number, uint8_t rxd_pin_number)
 Function for configuring UART. More...
 
void uart_putstring (const uint8_t *str)
 Function for writing a string to UART. More...
 
void UART0_IRQHandler (void)
 Function for handling the UART Interrupt.
 

Variables

static uint8_t mode_ = RADIO_MODE_MODE_Nrf_2Mbit
 
static uint8_t txpower_ = RADIO_TXPOWER_TXPOWER_0dBm
 
static uint8_t channel_start_ = 0
 
static uint8_t channel_end_ = 80
 
static uint8_t delayms_ = 10
 
static bool sweep = false
 
static uint8_t packet [256]
 
static uint8_t mode_
 
static uint8_t txpower_
 
static uint8_t channel_start_
 
static uint8_t channel_end_
 
static uint8_t channel_
 
static bool sweep_tx_
 
static volatile uint8_t rx_buffer [BUFFER_LENGTH]
 
static volatile uint8_t rxwp
 
static volatile uint8_t rxrp
 
static volatile uint8_t nrx
 

Detailed Description

This file contains the source code for a sample application using the NRF_RADIO, and is controlled through the serial port.

example_board_setup_a.jpg
Use board setup A for this example.

Enumeration Type Documentation

Enumerator
RADIO_TEST_NOP 

No test running

RADIO_TEST_TXCC 

TX constant carrier

RADIO_TEST_TXMC 

TX modulated carrier

RADIO_TEST_TXSWEEP 

TX sweep

RADIO_TEST_RXC 

RX constant carrier

RADIO_TEST_RXSWEEP 

RX sweep

RADIO_TEST_NOP 

No test running.

RADIO_TEST_TXCC 

TX constant carrier.

RADIO_TEST_TXMC 

TX modulated carrier.

RADIO_TEST_TXSWEEP 

TX sweep.

RADIO_TEST_RXC 

RX constant carrier.

RADIO_TEST_RXSWEEP 

RX sweep.

RADIO_TEST_NOP 

No test running

RADIO_TEST_TXCC 

TX constant carrier

RADIO_TEST_TXMC 

TX modulated carrier

RADIO_TEST_TXSWEEP 

TX sweep

RADIO_TEST_RXC 

RX constant carrier

RADIO_TEST_RXSWEEP 

RX sweep

RADIO_TEST_NOP 

No test running.

RADIO_TEST_TXCC 

TX constant carrier.

RADIO_TEST_TXMC 

TX modulated carrier.

RADIO_TEST_TXSWEEP 

TX sweep.

RADIO_TEST_RXC 

RX constant carrier.

RADIO_TEST_RXSWEEP 

RX sweep.

Function Documentation

void uart_put ( uint8_t  cr)
Sends a character to UART.

Execution is blocked until the UART peripheral reports that a character has been sent.

Parameters
[in]crCharacter to send.
uint8_t uart_get ( void  )
Reads a character from UART.

Execution is blocked until the UART peripheral detects that a character has been received.

Returns
cr Received character.
void uart_config ( uint8_t  txd_pin_number,
uint8_t  rxd_pin_number 
)
Configures UART to use 38400 baud rate.
Parameters
[in]txd_pin_numberPin number used for UART TXD
[in]rxd_pin_numberPin number used for UART RXD
void uart_putstring ( const uint8_t *  str)
Sends a string to UART.

Execution is blocked until the UART peripheral reports that all characters to have been sent. Maximum string length is 254 characters including null character in the end.

Parameters
[in]strNull terminated string to send.