adi.cn0566 module

class adi.cn0566.CN0566(uri=None, sdr=None, _chip_ids=['BEAM0', 'BEAM1'], _device_map=[[1], [2]], _element_map=[[1, 2, 3, 4, 5, 6, 7, 8]], _device_element_map={1: [7, 8, 5, 6], 2: [3, 4, 1, 2]}, verbose=False)

Bases: adf4159, adar1000_array

CN0566 class inherits from adar1000_array and adf4159 and adds operations for beamforming like default configuration, calibration, set_beam_phase_diff, etc. _gpios (as one-bit-adc-dac) are instantiated internally. ad7291 temperature / voltage monitor instantiated internally. CN0566.sdr property is an instance of a Pluto SDR with updated firmware, and updated to 2t2r.

uri: type=string

URI of Raspberry Pi attached to the phaser board

verbose: type=boolean

Print extra debug information

SDR_init(SampleRate, TX_freq, RX_freq, Rx_gain, Tx_gain, buffer_size)
Initialize Pluto rev C for operation with the phaser. This is a convenience

method that sets several default values, and provides a handle for a few other CN0566 methods that need access (i.e. set_rx_hardwaregain())


SampleRate: type=int

ADC/DAC sample rate.

TX_freq: type=float

Transmit frequency. lo-sdr.TX_freq is what shows up at the TX connector.

RX_freq: type=float

Receive frequency. lo-sdr.RX_freq is what shows up at RX outputs.

Rx_gain: type=float

Receive gain. Set indirectly via set_rx_hardwaregain()

Tx_gain: type=float

Transmit gain, controls TX output amplitude.

buffer_size: type=int

Receive buffer size

c = 299792458

speed of light in m/s


Gain compensation for the two RX channels in dB. Includes all errors, including the SDRs


Configure the device/beamformer properties like RAM bypass, Tr source etc.


device_mode: type=string

(“rx”, “tx”, “disabled”, default = “rx”)

device_mode = 'rx'

For future RX/TX operation. Set to RX.

element_spacing = 0.015

Element to element spacing of the antenna in meters


Per-element gain compensation, AFTER above channel compensation. Use to scale value sent to ADAR1000.

property lo

Get the VCO output frequency, accounting for the /4 ahead of the ADF4159 RFIN.


Load channel gain compensation values, if not calibrated set all to 0.


filename: string

Path/name of channel calibration file


Load gain calibrated value, if not calibrated set all channel gain to maximum.


filename: type=string

Provide path of gain calibration file


Load phase calibrated value, if not calibrated set all channel phase correction to 0.


filename: type=string

Provide path of phase calibration file

num_elements = 8

Number of antenna elements


Phase calibration array. Add this value to the desired phase. Initialize to zero (no correction).

phase_step_size = 2.8125

Phase adjustment resolution


Read all voltage / temperature monitor channels.


verbose: type=bool

Print each channel’s information if true.


An array of all readings in SI units (deg. C, Volts)


Saves channel calibration file.


Saves gain calibration file.


Saves phase calibration file.

set_all_gain(value=127, apply_cal=True)

Set all channel gains to a single value


value: type=int

gain for all channels. Default value is 127 (maximum).

apply_cal: type=bool

Optionally apply gain calibration to all channels.


Set phase difference between the adjacent channels of devices


Ph-Diff: type=float

Ph_diff is the phase difference b/w the adjacent channels of devices


A public method to sweep the phase value from -180 to 180 deg, calculate phase values of all the channel and set them. If we want beam angle at fixed angle you can pass angle value at which you want center lobe

Create an empty list. Based on the device number and channel of that device append phase value to that empty list this creates a list of 4 items. Now write channel of each device, phase values acc to created list values. This is the structural integrity mentioned above.

set_chan_gain(chan_no: int, gain_val, apply_cal=True)

Setl gain of the individua channel/s.


chan_no: type=int

It is the index of channel whose gain you want to set

gain_val: type=int or hex

gain_val is the value of gain that you want to set

apply_cal: type=bool

Optionally apply gain calibration for the selected channel

set_chan_phase(chan_no: int, phase_val, apply_cal=True)

Setl phase of the individua channel/s.


chan_no: type=int

It is the index of channel whose gain you want to set

phase_val: float

phase_val is the value of phase that you want to set

apply_cal: type=bool

Optionally apply phase calibration


Each device has 4 channels but for top level channel numbers are 1 to 8 so took device number as Quotient of channel num div by 4 and channel of that dev is overall chan num minus 4 x that dev number. For e.g: if you want to set gain of channel at index 5 it is 6th channel or 2nd channel of 2nd device so 5//4 = 1 i.e. index of 2nd device and (5 - 4*(5//4) = 1 i.e. index of channel

set_rx_hardwaregain(gain, apply_cal=True)

Set Pluto channel gains


gain: type=float

Gain to set both channels to

apply_cal: type=bool

Optionally apply channel gain correction


Set TX switch toggle divide ratio. Possible values are: 0 (direct TX_OUT control via gpio_tx_sw) divide by 2, 4, 8, 16, 32, 64, 128