SatNOGS-COMMS  4.1.0
A COMMS subsystem for CubeSats
Loading...
Searching...
No Matches
satnogs::comms::lib::radio Class Reference

Radio subsystem providing TX/RX functionality on UHF and S-Band. More...

#include <radio.hpp>

Classes

class  mixer_param
 Configuration parameters for the RF mixer. More...
class  frame_len
class  io_conf
 IO configuration that is necessary for the radio to operate. More...
class  params
 Initialization parameters of the radio class. More...
class  fsk_conf
 FSK configuration parameters. More...
class  rx_info
 Metadata for a received frame. More...
class  rx_msg
 The RX message accompanied by its metadata. More...
class  rx_conf
 RX configuration parameters. More...
class  tx_conf

Public Types

enum class  clk_src : bool { INTERNAL = 0 , EXTERNAL = 1 }
 PLL Reference Clock identifier. More...
enum class  interface : uint8_t { UHF = 0 , SBAND = 1 }
 Radio interface identifier. More...
enum class  op_mode : uint8_t { BASEBAND , IQ }
 Radio Operational mode. More...
enum class  modulation : uint8_t { FSK , FSK4 , QPSK }
 Supported modulation schemes. More...

Public Member Functions

 radio (const params &p, const io_conf &cnf, power &pwr, bsp::imsgq< rx_msg > &rx_msgq)
 Construct a new radio::radio object.
void enable (bool yes=true)
 Enable/disable the radio chain.
void enable (interface iface, bool yes=true)
 Enable/disable the radio chain of a specific band.
bool enabled () const
 Checks if the radio transceiver is in an operational state. This means that their powesr sources are enabled and each component has been successfully initialized and there is basic connectivity with the radio ICs.
void stop (interface iface, size_t timeout_ms=1000)
 Sets the FSM of the AT86RF215 interface to TRXOFF.
bool enabled (interface iface) const
 Returns the state of a specific interface.
rf_frontend::dir direction (interface iface) const
 Fetches the current direction (RX/TX) of the specific interface.
void set_frequency (interface iface, rf_frontend::dir d, uint32_t freq)
 Sets the frequency and the direction.
uint32_t frequency (interface iface, rf_frontend::dir d) const
 Returns the actual frequency that the hardware reports.
void set_tx_gain (interface iface, float gain)
 Sets the TX gain of the AT86RF215.
void set_tx_conf (interface iface, const tx_conf &conf)
 Performs the configuration of a specific interface for TX.
void tx (interface iface, const uint8_t *b)
 Performs a TX in blocking mode.
void rx_async (interface iface, const rx_conf &conf)
 Sets the radio in reception mode asynchronously.
bool mixer_lock ()
 Gets the status of the RF mixer lock.
clk_src get_clk_src () const
 Retrieves the current clock source of the AT86RF215 PLL.
rf_frontend09uhf ()
rf_frontend24sband ()
int recv_msg (rx_msg &msg, size_t timeout_ms)
 Gets an available message from the receive message queue.
uint32_t tx_len (interface iface) const
 Retrieves the configured TX frame size for a specific interface.
uint32_t rx_len (interface iface) const
 Retrieves the configured RX frame size for a specific interface.
void set_clk_src (clk_src src)
 Sets the clock source for the AT86RF215 PLL.
bool get_pll_ls (interface iface)
 Checks the PLL lock status of the AT86RF215 transceiver for the specified radio interface.
void register_rx_drop_callback (etl::delegate< void(interface)> callback)
 Registers a callback for the RX drop message event.

Static Public Member Functions

static int trx_irq_handler ()
 The IRQ handler of the AT86RF215 IRQ.

Static Public Attributes

static const uint16_t UHF_AGC_VOUT_DAC_CH = 2
static const uint16_t SBAND_AGC_VOUT_DAC_CH = 1

Friends

int at86rf215_irq_user_callback (struct at86rf215 *h, uint8_t rf09_irqs, uint8_t rf24_irqs, uint8_t bbc0_irqs, uint8_t bbc1_irqs)

Detailed Description

Radio subsystem providing TX/RX functionality on UHF and S-Band.

The radio class is the main control interface for both UHF and S-Band interfaces as well as the RF frontends.

TX of frames is implemented for now using blocking mode. The calling task that calls the radio::tx() blocks until the successful transmission of the desired frame, or until a timeout. This is expected to change in later releases of the library.

On the other hand, reception is performed asynchronously. After a call of the radio::rx_async(), the radio enters RX mode and the calling task continues its execution. The radio will continue to stay in RX mode until either the radio interface is disabled, or a TX is performed by calling the radio::tx().

Definition at line 126 of file radio.hpp.

Member Enumeration Documentation

◆ clk_src

enum class satnogs::comms::lib::radio::clk_src : bool
strong

PLL Reference Clock identifier.

Enumerator
INTERNAL 

Internal Crystal Oscillator.

EXTERNAL 

External Reference Clock (TCXO).

Definition at line 166 of file radio.hpp.

◆ interface

enum class satnogs::comms::lib::radio::interface : uint8_t
strong

Radio interface identifier.

Enumerator
UHF 

UHF.

SBAND 

S-BAND.

Definition at line 176 of file radio.hpp.

◆ modulation

enum class satnogs::comms::lib::radio::modulation : uint8_t
strong

Supported modulation schemes.

Enumerator
FSK 

FSK/MSK modulation.

FSK4 

4-FSK

QPSK 

QPSK.

Definition at line 195 of file radio.hpp.

◆ op_mode

enum class satnogs::comms::lib::radio::op_mode : uint8_t
strong

Radio Operational mode.

Enumerator
BASEBAND 

The baseband core is active.

IQ 

The IQ functionality is active.

Definition at line 185 of file radio.hpp.

Constructor & Destructor Documentation

◆ radio()

satnogs::comms::lib::radio::radio ( const params & p,
const io_conf & cnf,
power & pwr,
bsp::imsgq< rx_msg > & rx_msgq )

Construct a new radio::radio object.

Parameters
pconfiguration parameters
cnfIO configuration for controlling the peripherals of the radio
pwrreference to the power subsystem. Necessary to power up/down the radio components depending on the user calls
rx_msgqa thread safe message queue that will hold the RX messages from both UHF and S-Band interfaces at they received and validated

Definition at line 197 of file radio.cpp.

Member Function Documentation

◆ direction()

rf_frontend::dir satnogs::comms::lib::radio::direction ( interface iface) const

Fetches the current direction (RX/TX) of the specific interface.

Parameters
ifacethe desired interface
Returns
rf_frontend::dir the currently configured direction of the interface

Definition at line 435 of file radio.cpp.

◆ enable() [1/2]

void satnogs::comms::lib::radio::enable ( bool yes = true)

Enable/disable the radio chain.

Attention
This method does not enable the RF front-ends. It powers up the RF 5V power supply, allowing then for each RF front-end to be enabled separately.
Note
To avoid accidental activation for any front-end after an enable/disable cycle, when a disable is requested, the RF front-ends are explicitly disabled
Parameters
yestrue to enable, false to disable

Definition at line 247 of file radio.cpp.

◆ enable() [2/2]

void satnogs::comms::lib::radio::enable ( interface iface,
bool yes = true )

Enable/disable the radio chain of a specific band.

If the interface is already enabled, this method has no effect. If not, it enables and set the default direction which is rf_frontend::dir::RX

Parameters
ifacethe target interface (UHF/S-Band)
yestrue to enable, false to disable

Definition at line 342 of file radio.cpp.

◆ enabled() [1/2]

bool satnogs::comms::lib::radio::enabled ( ) const

Checks if the radio transceiver is in an operational state. This means that their powesr sources are enabled and each component has been successfully initialized and there is basic connectivity with the radio ICs.

Returns
true if all of the components of the radio chain are operational
false if at least one of the components of the radio is not operational

Definition at line 372 of file radio.cpp.

◆ enabled() [2/2]

bool satnogs::comms::lib::radio::enabled ( interface iface) const

Returns the state of a specific interface.

Parameters
ifacethe desired interface
Returns
true if the interface is enabled
false if the interface is disabled
Note
If the radio subsystem is disabled, this method returns false

Definition at line 422 of file radio.cpp.

◆ frequency()

uint32_t satnogs::comms::lib::radio::frequency ( interface iface,
rf_frontend::dir d ) const

Returns the actual frequency that the hardware reports.

Note
For various reasons (tuning resolution, wrong configuration, etc) the frequency requested may vary from the actual tuning frequency reported by the hardware
Bug
This is not implemented yet and should return always 0.0
Parameters
ifacethe desired interface
dthe direction to check the tuned frequency
Returns
uint32_t the tuned frequency as reported by the hardware

Definition at line 516 of file radio.cpp.

◆ get_clk_src()

radio::clk_src satnogs::comms::lib::radio::get_clk_src ( ) const

Retrieves the current clock source of the AT86RF215 PLL.

Returns
radio::clk_src The clock source of the PLL

Definition at line 1104 of file radio.cpp.

◆ get_pll_ls()

bool satnogs::comms::lib::radio::get_pll_ls ( interface iface)

Checks the PLL lock status of the AT86RF215 transceiver for the specified radio interface.

Parameters
ifaceThe radio interface
Returns
true if the specified PLL is locked, false otherwise.

Definition at line 1118 of file radio.cpp.

◆ mixer_lock()

bool satnogs::comms::lib::radio::mixer_lock ( )

Gets the status of the RF mixer lock.

Returns
true if the mixer is locked
false if the mixer is not locked or does not communicate

Definition at line 935 of file radio.cpp.

◆ recv_msg()

int satnogs::comms::lib::radio::recv_msg ( rx_msg & msg,
size_t timeout_ms )

Gets an available message from the receive message queue.

Parameters
msgreference to place the received message
timeout_msthe timeout in milliseconds
Returns
0 on success or negative error code on failure or timeout

Definition at line 968 of file radio.cpp.

◆ register_rx_drop_callback()

void satnogs::comms::lib::radio::register_rx_drop_callback ( etl::delegate< void(interface)> callback)

Registers a callback for the RX drop message event.

In case the processing of the RX frames is slower than the rate they arrive, the radio subsystem will drop the new incoming frames. Users may notified by registering a custom callback.

Parameters
callbackthe callback to regsiter. It should accept the interface that the drop event occured as parameter

Definition at line 1147 of file radio.cpp.

◆ rx_async()

void satnogs::comms::lib::radio::rx_async ( interface iface,
const rx_conf & conf )

Sets the radio in reception mode asynchronously.

This method sets the radio in RX state with the given configuration parameters and exits immediately. Any received frame will be pushed on the reception message queue of the radio subsystem. Users can poll for received messages utilizing the radio::recv_msg() method

Parameters
ifacethe desired interface
confthe reception configuration for the RF frontend and the modem

Definition at line 845 of file radio.cpp.

◆ rx_len()

uint32_t satnogs::comms::lib::radio::rx_len ( interface iface) const

Retrieves the configured RX frame size for a specific interface.

Parameters
ifacethe desired interface
Returns
uint32_t the RX frame size of the specified interface

Definition at line 992 of file radio.cpp.

◆ sband()

rf_frontend24 & satnogs::comms::lib::radio::sband ( )
Returns
rf_frontend24& of the S-band RF front-end

Definition at line 955 of file radio.cpp.

◆ set_clk_src()

void satnogs::comms::lib::radio::set_clk_src ( clk_src src)

Sets the clock source for the AT86RF215 PLL.

Parameters
srcradio::clk_src The clock source of the PLL
Note
The new clock setting will be available on the next re-initialization of the radio
If the PLL fails to lock with the external source, the clock source will automatically revert to the internal crystal oscillator

Definition at line 1094 of file radio.cpp.

◆ set_frequency()

void satnogs::comms::lib::radio::set_frequency ( interface iface,
rf_frontend::dir d,
uint32_t freq )

Sets the frequency and the direction.

Parameters
ifacethe desired interface
dthe direction to set
freqthe frequency that will be applied after the direction change

Definition at line 457 of file radio.cpp.

◆ set_tx_conf()

void satnogs::comms::lib::radio::set_tx_conf ( interface iface,
const tx_conf & conf )

Performs the configuration of a specific interface for TX.

Parameters
ifacethe desired interface
confthe TX configuration

Definition at line 731 of file radio.cpp.

◆ set_tx_gain()

void satnogs::comms::lib::radio::set_tx_gain ( interface iface,
float gain )

Sets the TX gain of the AT86RF215.

Parameters
ifacethe desired interface
gainthe target gain
Note
This method performs clamping on the given gain, ensuring that is withing the [0, 31] range

Definition at line 532 of file radio.cpp.

◆ stop()

void satnogs::comms::lib::radio::stop ( interface iface,
size_t timeout_ms = 1000 )

Sets the FSM of the AT86RF215 interface to TRXOFF.

Note
According to the datasheet, for better performance when a frequency change is requested or a new TX power setting, it is best to start again from the TRXOFF state
Warning
Due to [Errata reference 4807] this method will try multiple time to set the TRXOFF state. To avoid any infinite loop we use a timeout. If this occurs the corresponding exception is thrown
Parameters
ifacethe target interface (UHF/S-Band)
timeout_mstimeout in ms

Definition at line 393 of file radio.cpp.

◆ trx_irq_handler()

int satnogs::comms::lib::radio::trx_irq_handler ( )
static

The IRQ handler of the AT86RF215 IRQ.

Attention
The handling of this static method is platform dependent. Users should call this method inside the IRQ handling routine of the target platform
Returns
0 on success or negative error code

Definition at line 228 of file radio.cpp.

◆ tx()

void satnogs::comms::lib::radio::tx ( interface iface,
const uint8_t * b )

Performs a TX in blocking mode.

Performs a TX in blocking mode. If the radio was in RX state, it is automatically set to TX mode. After the end of the transmission (or on failure), the method leaves the radio in idle state.

Warning
This method requires that the corresponding frontend has been enabled and configured to the desired frequency
Parameters
ifacethe interface to send the frame
bthe frame buffer

Definition at line 817 of file radio.cpp.

◆ tx_len()

uint32_t satnogs::comms::lib::radio::tx_len ( interface iface) const

Retrieves the configured TX frame size for a specific interface.

Parameters
ifacethe desired interface
Returns
uint32_t the TX frame size of the specified interface

Definition at line 980 of file radio.cpp.

◆ uhf()

rf_frontend09 & satnogs::comms::lib::radio::uhf ( )
Returns
rf_frontend09& of the UHF RF front-end

Definition at line 945 of file radio.cpp.

◆ at86rf215_irq_user_callback

int at86rf215_irq_user_callback ( struct at86rf215 * h,
uint8_t rf09_irqs,
uint8_t rf24_irqs,
uint8_t bbc0_irqs,
uint8_t bbc1_irqs )
friend

Definition at line 110 of file radio.cpp.

Member Data Documentation

◆ SBAND_AGC_VOUT_DAC_CH

const uint16_t satnogs::comms::lib::radio::SBAND_AGC_VOUT_DAC_CH = 1
static

AGC Vout for the UHF is at channel 2 of the DAC

Definition at line 139 of file radio.hpp.

◆ UHF_AGC_VOUT_DAC_CH

const uint16_t satnogs::comms::lib::radio::UHF_AGC_VOUT_DAC_CH = 2
static

AGC Vout for the UHF is at channel 2 of the DAC

Definition at line 133 of file radio.hpp.


The documentation for this class was generated from the following files: