libbladeRF  1.7.2
Nuand bladeRF library
Macros | Enumerations | Functions
SMB clock port control

Description

The SMB clock port (J62) may be used to synchronize sampling on multiple devices, or to generate an arbitrary clock output for a different device.

For MIMO configurations, one device is the clock "master" and outputs its 38.4 MHz reference on this port. The clock "slave" devices configure the SMB port as an input and expect to see this 38.4 MHz reference on this port. This implies that the "master" must be configured first.

Alternatively, this port may be used to generate an arbitrary clock signal for use with other devices via the bladerf_set_smb_frequency() and bladerf_set_rational_smb_frequency() functions.

Warning
Do not use these functions when operating an expansion board. A different clock configuration is required for the XB devices which cannot be used simultaneously with the SMB clock port.

These functions are thread-safe.

Macros

#define BLADERF_SMB_FREQUENCY_MAX   200000000u
 
#define BLADERF_SMB_FREQUENCY_MIN   ((38400000u * 66u) / (32 * 567))
 

Enumerations

enum  bladerf_smb_mode {
  BLADERF_SMB_MODE_INVALID = -1, BLADERF_SMB_MODE_DISABLED, BLADERF_SMB_MODE_OUTPUT, BLADERF_SMB_MODE_INPUT,
  BLADERF_SMB_MODE_UNAVAILBLE
}
 

Functions

API_EXPORT int CALL_CONV bladerf_set_smb_mode (struct bladerf *dev, bladerf_smb_mode mode)
 
API_EXPORT int CALL_CONV bladerf_get_smb_mode (struct bladerf *dev, bladerf_smb_mode *mode)
 
API_EXPORT int CALL_CONV bladerf_set_rational_smb_frequency (struct bladerf *dev, struct bladerf_rational_rate *rate, struct bladerf_rational_rate *actual)
 
API_EXPORT int CALL_CONV bladerf_set_smb_frequency (struct bladerf *dev, uint32_t rate, uint32_t *actual)
 
API_EXPORT int CALL_CONV bladerf_get_rational_smb_frequency (struct bladerf *dev, struct bladerf_rational_rate *rate)
 
API_EXPORT int CALL_CONV bladerf_get_smb_frequency (struct bladerf *dev, unsigned int *rate)
 

Macro Definition Documentation

#define BLADERF_SMB_FREQUENCY_MAX   200000000u

Maximum output frequency on SMB connector, if no expansion board attached.

Definition at line 1393 of file libbladeRF.h.

#define BLADERF_SMB_FREQUENCY_MIN   ((38400000u * 66u) / (32 * 567))

Minimum output frequency on SMB connector, if no expansion board attached.

Definition at line 1398 of file libbladeRF.h.

Enumeration Type Documentation

SMB clock port mode of operation

Enumerator
BLADERF_SMB_MODE_INVALID 

Invalid selection

BLADERF_SMB_MODE_DISABLED 

Not in use. Device operates from its onboard clock and does not use J62.

BLADERF_SMB_MODE_OUTPUT 

Device outputs a 38.4 MHz reference clock on J62. This may be used to drive another device that is configured with BLADERF_SMB_MODE_INPUT.

BLADERF_SMB_MODE_INPUT 

Device configures J62 as an input and expects a 38.4 MHz reference to be available when this setting is applied.

BLADERF_SMB_MODE_UNAVAILBLE 

SMB port is unavailable for use due the underlying clock being used elsewhere (e.g., for and expansion board).

Definition at line 1404 of file libbladeRF.h.

Function Documentation

API_EXPORT int CALL_CONV bladerf_get_rational_smb_frequency ( struct bladerf *  dev,
struct bladerf_rational_rate rate 
)

Read the SMB connector output frequency in rational Hz

Parameters
[in]devDevice handle
[out]ratePointer to returned rational frequency
Returns
0 on success, value from Error codes list upon failure
API_EXPORT int CALL_CONV bladerf_get_smb_frequency ( struct bladerf *  dev,
unsigned int *  rate 
)

Read the SMB connector output frequency in Hz

Parameters
[in]devDevice handle
[out]ratePointer to returned frequency
Returns
0 on success, value from Error codes list upon failure
API_EXPORT int CALL_CONV bladerf_get_smb_mode ( struct bladerf *  dev,
bladerf_smb_mode mode 
)

Get the current mode of operation of the SMB clock port

Parameters
[in]devDevice handle
[out]modeDesired mode
Returns
0 on success, or a value from Error codes list on failure.
API_EXPORT int CALL_CONV bladerf_set_rational_smb_frequency ( struct bladerf *  dev,
struct bladerf_rational_rate rate,
struct bladerf_rational_rate actual 
)

Set the SMB clock port frequency in rational Hz

Parameters
[in]devDevice handle
[in]rateRational frequency
[out]actualIf non-NULL, this is written with the actual

The frequency must be between BLADERF_SMB_FREQUENCY_MIN and BLADERF_SMB_FREQUENCY_MAX.

This function inherently configures the SMB clock port as an output. Do not call bladerf_set_smb_mode() with BLADERF_SMB_MODE_OUTPUT, as this will reset the output frequency to the 38.4 MHz reference.

Warning
This clock should not be set if an expansion board is connected.
Returns
0 on success, BLADERF_ERR_INVAL for an invalid frequency, or a value from Error codes list on failure.
API_EXPORT int CALL_CONV bladerf_set_smb_frequency ( struct bladerf *  dev,
uint32_t  rate,
uint32_t *  actual 
)

Set the SMB connector output frequency in Hz. Use bladerf_set_rational_smb_frequency() for more arbitrary values.

Parameters
[in]devDevice handle
[in]rateFrequency
[out]actualIf non-NULL. this is written with the actual frequency achieved.

This function inherently configures the SMB clock port as an output. Do not call bladerf_set_smb_mode() with BLADERF_SMB_MODE_OUTPUT, as this will reset the output frequency to the 38.4 MHz reference.

The frequency must be between BLADERF_SMB_FREQUENCY_MIN and BLADERF_SMB_FREQUENCY_MAX.

Warning
This clock should not be set if an expansion board is connected.
Returns
0 on success, BLADERF_ERR_INVAL for an invalid frequency, or a value from Error codes list on other failures
API_EXPORT int CALL_CONV bladerf_set_smb_mode ( struct bladerf *  dev,
bladerf_smb_mode  mode 
)

Set the current mode of operation of the SMB clock port

In a MIMO configuration, one "master" device should first be configured to output its reference clock to the slave devices via bladerf_set_smb_mode(dev, BLADERF_SMB_MODE_OUTPUT).

Next, all "slave" devices should be configured to use the reference clock provided on the SMB clock port (instead of using their on-board reference) via bladerf_set_smb_mode(dev, BLADERF_SMB_MODE_INPUT).

Parameters
[in]devDevice handle
[in]modeDesired mode
Returns
0 on success, or a value from Error codes list on failure.