= Radio Controller = The radio contoller is a custom peripheral designed to utilize the many functions of the radio boards. It contains SPI logic to set the registers in the Radio and DAC chips on the boards and logic to keep track of the control pins for both of the chips. Also provided with the radio controller are drivers that enable the use of the radio controller. For the latest copy of the radio controller and its drivers refer to the [source:PlatformSupport/CustomPeripherals/ repository]. This core only has logic in it and does not connect to pins directly. It must be used in conjunction with the [wiki:RadioBridge radio bridge] peripheral which actually provides the connections for each of the four available daughtercard slots. Select radio bridges for the locations where a WARP radio board is plugged in. Up to four radio bridges can be used in a project. The radio controller is an EDK peripheral that should be available as an option in Base System Builder when using the Board Description File (*.xbd) available in the repository. == Setting up the Radio Controller Peripheral == The latest version of the radio controller peripheral and drivers are located in the repository. Its setup is included in the Board Description File (*.xbd) for the WARP Boards. Please refer to the [wiki:FAQ/EDK#HowdoIinstalltheWARPsupportfiles FAQ] for instructions on obtaining the peripherals and XBD file. 1. Use the Base System Builder to set up a new project in Xilinx Platform Studio (refer to [wiki:peripheral_test User's Guide] to see how to set up a project that tests the basic peripherals on the FPGA board). 1. Check the box referring to the Radio Controller to include it. 1. Also you will see four [wiki:RadioBridge radio bridge] peripherals. Each of these refer to a daughtercard slot on the FPGA board. If your radio is in slot 2, check the box for Radio_Bridge_2. If you have mutliple radios you may check more than one bridge. ''To use the Radio Controller you must have alteast one Radio Bridge included. Also setting up Radio Bridge without the Radio Controller does not provide any tools to use the radios.'' Once the project has been created you will notice a Radio Controller core in the System Assembly View. == Using the Radio Controller Drivers == All the functions provided with the radio controller can be accessed through {{{radio_controller.h}}}. Include this file in your C program by inserting the following line at the top: {{{ #include "radio_controller.h" }}} All the radio controller functions are divided into two sets. The first set control the Maxim Radio on the board and begin with {{{WarpRadio_}}} while the second set controls the Digitial-to-Analog Converter (DAC) for the data and these begin with {{{WarpDac_}}}. === Inputs to Functions === The following two inputs are common to all functions in the library 1. {{{baseaddr}}}: This is the base address of the radio controller peripheral. The base address information of all the peripherals is located in the {{{xparameters.h}}} file. This file appears only after the hardware has been generated the first time. To access the file open the Software Application Project and expand the {{{Processor: ppc405_0}}} list. Be sure to include this file at the top of your C program as well by using the following line: {{{ #include "xparameters.h" }}} If the project has been created with the Base System Builder, generally the base address of the radio controller is XPAR_RADIO_CONTROLLER_0_BASEADDR. Be sure to check this to be certain. 1. {{{radios}}}/{{{dacs}}}: This refers to the Radios or the DACs that are to be affected by the function call. Each radio and DAC on the Radio Board can be selected by {{{RADIO1}}} or {{{DAC1}}} if the Radio Board is in slot 1, {{{RADIO2}}} or {{{DAC2}}} if in slot 2, etc. To call the function on multiple boards at the same time, OR (|) the values with each other. For example, {{{RADIO1|RADIO2}}} would affect both the radios in slot 1 and 2. Any other inputs are explained at the top of that function in {{{radio_controller.h}}}. === Initialization === The core uses just one Serial Peripheral Interface (SPI) to control both the Maxim Radio as well DAC. Hence certain changes need to be made to the SPI core before addressing one or the other. Before calling any {{{WarpRadio_}}} functions be sure to call {{{WarpRadio_InitializeSPI}}}. This must be done before any call to the radios after just calling a function on the DACs. Similarly {{{WarpDac_InitializeSPI}}} must be called before accessing any of its functions. A good rule of thumb for intialization at the start of time is to execute the following statements in order: {{{ WarpDac_InitializeSPI(...) WarpDac_Reset(...) WarpDac_InitializeDAC(...) WarpRadio_InitializeSPI(...) WarpRadio_Reset(...) WarpRadio_InitializeRadio(...) }}} Just to reiterate, notice how the InitializeSPI functions of both the radio and DAC are called before a function call of that type. === Basic Usage of Radio Functions (`WarpRadio_`) === '''Selecting Center Frequency:''' Functions `SetCenterFreq2GHz(...)` and `SetCenterFreq5GHz(...)` can be used to set the transceiver center frequency in the 2.4 GHz and 5 GHz ISM bands respectively. Within these the channel number can also be selected. By default the center frequency is in the 2.4 GHz band with channel number 6 which is equivalent to 2.437 GHz.