USRP: ClockTamer Control Protocol

From OnnoWiki
Jump to navigation Jump to search

Kita dapat mengontrol ClockTamer melalui USB atau SPI. Jika tersambung ke USB, ClockTamer akan mengemulasi serial port, oleh karenanya kita dapat mengontrolnya menggunakan terminal emulator, baik dari script atau program. Sambungan SPI digunakan jika ClockTamer tersambung ke USRP dan sangat berguna jika kita tidak ingin menggunakan dua kabel USB dari USRP ke komputer yang kita gunakan.

Komunikasi dengan ClockTamer

Keberadaan ClockTamer dapat dilihat melalui perintah

ls /dev/tty*

harusnya ada device ClockTamer

/dev/ttyACM0

ClockTamer menggunakan protokol berbasis text dan pada dasarnya sama baik itu untuk interface ClockTamer USB maupun SPI. Protokol versi USB dan SPI berbeda hanya pada cara jawaban dari ClockTamer di kirim. Jika menggunakan sambungan SPI kita perlu poll untuk memperoleh jawaban, seperti di jelaskan di halaman interface SPI, di Linux sebelum kita melakukan pertukaran data sebaiknya kita matikan echo dari ClockTamer serial device. Melalui command line kita dapat mematikan melalui perintah berikut,

stty -F /dev/ttyACM0 -echo

Dimana /dev/ttyACM0 adalah ClockTamer serial device file.

Install screen

sudo apt-get install screen

Komunikasi menggunakan perintah

sudo screen /dev/ttyACM0 115200,cs8,-ixon,-ixoff

Tekan

ENTER

Akan keluar

CMD ERROR

berarti kita berhasil berkomunikasi dengan ClockTamer

Fitur Protokol ClockTamer

Protokol ClockTamer mempunya fitur:

  • Bekerja dengan pola master / slave. Dengan ClockTamer sebagai slave. Hal ini berarti ClockTamer hanya akan menjawab perintah yang dikirim oleh host dan tidak dalam memberikan perintah atau bertanya ke host.
  • Semua Perintah dan Jawaban dalam string ASCII, ditutup dengan CR/LF. Hal ini menyebabkan sangat mudah untuk memberikan perintah ke ClockTamer dengan mode interaktif melalui program terminal emulator.
  • Setiap perintah dari host akan di ikuti oleh jawaban dari ClockTamer, artinya protokol yang digunakan sifatnya sinkron (synchronous). Kira-kira sama dengan SD/MMC - jika kita mengirim command maka kita harus menunggu sampai kita menerima jawaban. Jika tidak ada jawaban untuk jangka waktu yang lama, maka kemungkinan besar ada sesuatu yang salah dan itu adalah bug. Sangat di rekomendasikan untuk me-reset ClockTamer dan mencoba lagi. Jangan lupa untuk menlaporkan bug tersebut.

Untuk mereka yang Tidak Sabar

Jika kita ingin langsung menggunakan ClockTamer tanpa perlu mengetahui berbagai detail yang ada, kita minimal membutuhkan dua (2) perintah berikut,

SET,,OSC,<osc_freq>
SET,,OUT,<out_freq>

dimana kita harus mengganti,

  • osc_freq dengan frekuensi (Hz) dari (VC)TCXO yang terpasang di ClockTamer, contoh 20000000. Perlu di catat bahwa kita dapat mengkalibrasi ClockTamer dengan mengubah sedikit osc_freq. Baca ClockTamer calibration untuk instruksi lebih detail.
  • out_freq dengan frekuensi output yang diinginkan (Hz).

Contoh

SET,,OSC,20000000
SET,,OUT,52000000

Jika kita sudah puas dengan settingan yang ada, kita dapat menyimpan parameter tersebut ke EEPROM dan digunakan sesudah reboot:

STE

Command dan struktur jawaban

Setiap perintah menggunakan format

CMD[,TYP[,DET[,value]]]<CR><LF>

Dimana

CMD - kelas command tiga huruf, harus berupa string yang tidak kosong.
TYP - command tipe target tiga huruf. Dapat berupa string yang kosong, walaupun DET dan value ada isinya (misalnya, SET,,OSC,10000200).
DET - command detail target tiga huruf. Dapat berupa string kosong, walaupun value ada. (e.g. PIN,LED,,0).
value - desimal atau hexadesimal value. Value desimal mulai digit (contoh, 54781), Value hexadecimal mulai dengan huruf 'x' (contoh, x01af3d).

Tergantung pada kelas command, perintah yang belakangan dapat di acuhkan sama sekali, seperti:

LDE       - only CMD is present
INF,,OSC  - CMD, TYP and DET are present with TYP as empty string
INF,,OUT

Format jawaban adalah sebagai berikut:

  • Jika command tidak memberikan value, maka jawaban adalah
OK<CR><LF>
  • Jika command memberikan value, jawaban akan mengunakan struktur yang sama dengan command yaitu
CMD[,TYP[,DET[,value]]]<CR><LF>
   where CMD, TYP and DET repeats the respective fields in the command. 
  • Jika command tidak dapat di parsing maka akan mengeluarkan error sebagai berikut:
   SYNTAX ERROR<CR><LF>

Command classes

Register ("REG")

Write data ke register di chip yang sesuai MicroWire bus. Menggunakan cpmmand ini kita dapat mengontrol setiap aspek dari pembangkitan clock dalam mode manual. Tipe target dan detail kombinasi yang di ijinkan adalah:

TYP 	DET 	value 	Description
LMK 	<empty> 	32bit value 	Write to LMK (clock distributor) chip registers
LMX 	<empty> 	24bit value 	Write to LMX (PLL+VCO) chip registers (if LMX is present)
DAC 	<empty> 	16-24bit value 	Write to DAC (Digital-to-Analog Converter) chip registers (if DAC is present)

Pin ("PIN")

Kontrol pin dari chip. Tipe target dan kombinasi detail yang di ijinkan adalah:

TYP 	DET 	value 	Description
LMK 	ENB 	0/1 	ENABLE pin of LMK (clock distributor) chip.
LMK 	GOE 	0/1 	GOE pin of LMK (clock distributor) chip.
LMX 	SYN 	0/1 	SYN pin of LMX (PLL+VCO) chip.
LED 	<empty> 	0/1 	Turn LED on/off.

Set ("SET")

Easy to use setting of output frequency, setting oscillator calibration value, changing algorithms internal variables. The most useful target type and detail combinations:

TYP 	DET 	value 	Description
<empty> 	<empty> 	<empty> 	Write all control registers from MCU RAM to LMX and LMK chips.
<empty> 	OSC 	integer 	Set oscillator frequency. Used when oscillator is changed, when external frequency source changed its frequency or to calibrate oscillator. Control registers of LMK and LMX are recalculated and written to the chips with this command.
<empty> 	OUT 	integer 	Set ClockTamer output frequency. Control registers of LMK and LMX are recalculated and written to the chips with this command.
<empty> 	AUT 	0/1 	If set to 1 ClockTamer will load all variables from EEPROM and start generator on boot.
LMK 	<empty> 	<empty> 	Write all control registers of LMK to the chip.
LMK 	PRT 	integer 	Change value of LMK output mask. See description of LMK_OutMask EEPROM register for details. Control registers of LMK are written to the chip with this command.
GPS 	SYN 	<empty> 	One-time synchronization to GPS.
GPS 	AUT 	0/1 	If set to 1 ClockTamer will keep clock synchronized to GPS.

Save ("SAV")

BELUM DI IMPLEMENTASIKAN

Defaults ("DEF")

BELUM DI IMPLEMENTASIKAN

Info ("INF")

Get value of the selected variable. Every variable (specified in DET), usable with SET has its INF counterpart. There is no NFO command with empty DET, though.

There are also a set of variables for debugging purposes only. You don't need to touch them if you don't change the firmware. Also their meaning may change from one firmware version to another without API version change. Currently available target type and detail combinations:

TYP 	DET 	value 	Description
GPS 	DIV 	<empty> 	Debug output. Value of divider of LMK output, routed to MCU input.
GPS 	KBT 	<empty> 	Debug output.
GPS 	R00 	<empty> 	Debug output.
GPS 	R01 	<empty> 	Debug output. In ClockTamer-1.2 it gives you a number of received 1pps ticks. If this value is increasing, then GPS lock is acquired.
GPS 	R02 	<empty> 	Debug output.
GPS 	R03 	<empty> 	Debug output. In ClockTamer-1.2 it gives you calculated output frequency, multiplied by 32, i.e. Fout = R02/32.
GPS 	MAX 	<empty> 	Debug output.
GPS 	MIN 	<empty> 	Debug output.

Version ("VER")

Get firmware and protocol versions.

Example:

ClockTamer SW=1.23 API=1

Hardware information ("HWI")

Get detailed information about installed hardware options. This information is stored in EEPROM and may be altered only if ClockTamer is flashed over SPI. Flashing over USB can not change EEPROM data.

Values shown in HWI string incude:

LMX= 	Type of LMX2531 VCO+PLL. Can be "2080" for LMX2531LQ2080E or "1515" for LMX2531LQ1515E. Most ClockTamers have LMX2531LQ2080E.
LMK= 	Type of LMK01000 Clock Buffer, Divider, and Distributor. Can be "1000" for LMK01000, "1010" for LMK01010 or "1020" for LMK01020, but is usually LMK01010.
OSC=
FOSC= 	Frequency of the reference TCXO or VCTCXO in MHz. Possible values are 10, 20 or 26.
GPS 	ClockTamer has GPS module installed if GPS is present in HWI.
VCTCXO 	ClockTamer use VCTCXO with DAC instead of TCXO with VCO+PLL is VCTCXO is present in HWI.

Example of HWI for a ClockTamer with LMX2531LQ2080E, LMK1010, 20MHz TCXO and GPS:

LMX=2080 LMK=1010 OSC=20 GPS

Reset ("RST")

Sends reset command to LMK and LMX and clears variables in MCU RAM, but does not affect EEPROM. To start output generation after RST you can execute "SET,,OSC,<val>", "SET,,OUT,<val>" or "LDE"+"SET".

Load EEPROM ("LDE")

Loads previously stored values from EEPROM to RAM. This command does not push them to LMK and LMX chips, so you should execute SET command manually.

TYP, DET and value should be empty.

Store EEPROM ("STE")

Stores all values to EEPROM. This values will be used by default after ClockTamer reboot. They can also be loaded to RAM at any time with LDE command.

TYP, DET and value should be empty.

EEPROM variables list

Variable 	Description
Fosc 	Oscillator frequency
Fout 	Output frequency
VCO_MIN 	Parameter for calculation of VCO registers for LMX. Shouldn't be changed unless you change LMX on your unit.
VCO_MAX 	Parameter for calculation of VCO registers for LMX. Shouldn't be changed unless you change LMX on your unit.
VCO_Kbit 	Parameter for calculation of VCO registers for LMX. Shouldn't be changed unless you change LMX on your unit.
LMK_OutMask 	Enable/disable output generation on specific LMK outputs. Set bit in the mask to 1 to enable corresponding output and to 0 to disable it. E.g. x60 value will enable 5 and 6 outputs and disable all others. See outputs numbering below.
AutoFreq 	Autostart generating output on boot.
DacValue 	DAC value if VCTCXO is used.
AutoGPSSync 	Continuously synchronize clock to GPS.

Outputs numbering

ClockTamer-1.0

If you look at ClockTamer so that "ClockTamer v1.0" label reads normally, then outputs are numbered in the following way:

2        0
  .---.
  |LMK|  7
  .---.
         6
4   5    6*

where 0,2,4,5,6 - places for U.FL connectors, 6* - a place for SMA connector. Outputs number 1 and 3 are not present on PCB. In default configuration outputs number 0 and 2 are LVDS, while 4,5,6 are LVPECL/CMOS.

ClockTamer-1.1 and ClockTamer-1.2

Outputs numbering is as shown on the picture:

Tamer-gui-pic.png

Outputs 1 and 6 and CMOS, while outputs 0, 3, 4, 5 and 7 are LVDS or half-LVDS. Refer to Features and technical specification page for more information about half-LVDS outputs.


Referensi

Pranala Menarik

Persiapan

Script

OpenBTS 2.6

OpenBTS 2.8

Multi OpenBTS 2.8

OpenBTS 3.1.x

Ettus E110

Ettus N210

RangeNetworks

GPRS

Briker OpenBTS

FreeSWITCH OpenBTS

Power Amplifier

Lain Lain

Catatan Legal dan Pendukung

Catatan Sejarah

Dokumentasi Video

Perjuangan OpenBTS