Skip to main content

A pure Python 3 library for LMK05318 device.

Project description

Linux pure Python library for LMK05318 Ultra-Low Jitter Network Synchronizer Clock With Two Frequency Domains.

Check if LMK05318 is present in the system.

By default the address is 0x64. Check the device is present in your system (I2C bus 0 in our case):

# i2cdetect -y 0
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         08 -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- 
50: -- -- UU UU -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- 64 -- -- -- -- UU -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --

Debug and development

Create virtual environment

make venv
source ./venv/bin/activate

Run tests:

$ make test
venv/bin/python3 -m unittest discover -s tests
.
----------------------------------------------------------------------
Ran 1 test in 0.000s

OK

Copy the tarball with Python sources to your board /tmp directory:

./copy_to_board.sh 192.168.2.21

Run on board as root:

cd /tmp && ./untar_install.sh LMK05318

Run as root:

# python3 -m lmk05318
usage: __main__.py [-h] [{wfile,rfile,sdpll,spllxo}] [arg2]

LMK05318 configuration and status utility.

positional arguments:
  {wfile,rfile,sdpll,spllxo}
                        wfile path    Write cfg regs to eeprom from file (path) prepared
                                      by TI utility TICSPRO-SW.
                        rfile path    Dump cfg regs to file (path)
                        sdpll         Get status dpll.
                        spllxo        Get status pll xo.
  arg2                  Optional parameter for cmd.

optional arguments:
  -h, --help            show this help message and exit

Write to EEPROM the registers file prepared by TI utility TICS Pro

Copy the file to the board:

scp ./HexRegisterValues_free_run.txt   root@192.168.2.16:/tmp/LMK05318

Flash the file to the chip's EEPROM:

root@eccahemcmain1:/tmp/LMK05318# python3 -m lmk05318 wfile ./HexRegisterValues_free_run.txt 
INFO:lmk05318:Vendor ID Readback: 0x100B
INFO:lmk05318:Product ID Readback: 0x35
LMK05318 valid: True
INFO:lmk05318:Attention: writing to register 0c with masked bits, mask 0xa7 was applied, resulting in value 1b
INFO:lmk05318:Attention: writing to register 9d with masked bits, mask 0xff was applied, resulting in value 00
INFO:lmk05318:Attention: writing to register a4 with masked bits, mask 0xff was applied, resulting in value 00
INFO:lmk05318:Attention: writing to register 165 with masked bits, mask 0xff was applied, resulting in value 28
INFO:lmk05318:Attention: writing to register 16f with masked bits, mask 0xff was applied, resulting in value 00
INFO:lmk05318:Attention: writing to register 19b with masked bits, mask 0xff was applied, resulting in value 00
INFO:lmk05318:write current device register content to EEPROM
INFO:lmk05318:wait till busy bit becomes 1
INFO:lmk05318:wait till busy bit becomes 0
INFO:lmk05318:wait till busy bit becomes 0
INFO:lmk05318:wait till busy bit becomes 0
INFO:lmk05318:wait till busy bit becomes 0
INFO:lmk05318:wait till busy bit becomes 0
INFO:lmk05318:wait till busy bit becomes 0
INFO:lmk05318:wait till busy bit becomes 0
INFO:lmk05318:wait till busy bit becomes 0
INFO:lmk05318:wait till busy bit becomes 0
INFO:lmk05318:wait till busy bit becomes 0
INFO:lmk05318:wait till busy bit becomes 0
INFO:lmk05318:wait till busy bit becomes 0
INFO:lmk05318:wait till busy bit becomes 0
INFO:lmk05318:wait till busy bit becomes 0
INFO:lmk05318:wait till busy bit becomes 0
INFO:lmk05318:programming EEPROM done, power-cycle or hard-reset to take effect
root@eccahemcmain1:/tmp/LMK05318# 

Read back all the registers from LMK05318 device to the file:

root@eccahemcmain1:/tmp# python3 -m lmk05318 rfile ./HexRegs.txt
INFO:lmk05318:Vendor ID Readback: 0x100B
INFO:lmk05318:Product ID Readback: 0x35
LMK05318 valid: True

Check DPLL and APLL status:

Check DPLL:

root@eccahemcmain1:/tmp# python3 -m lmk05318 sdpll
INFO:lmk05318:Vendor ID Readback: 0x100B
INFO:lmk05318:Product ID Readback: 0x35
LMK05318 valid: True

        Loss of phase lock: 1
        Loss of freq. lock: 1
        Tuning word update: 1
        Holdover Event: 1
        Reference Switch Event: 0
        Active ref. missing clk: 0
        Active ref. loss freq.: 0
        Active ref. loss ampl.: 0

Check APLL:

root@eccahemcmain1:/tmp# python3 -m lmk05318 spllxo
INFO:lmk05318:Vendor ID Readback: 0x100B
INFO:lmk05318:Product ID Readback: 0x35
LMK05318 valid: True

        Loss of freq. detection XO: 0
        Loss of lock APLL2: 1
        Loss of lock APLL1: 0
        Loss of source XO: 0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lmk05318-0.1.2.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lmk05318-0.1.2-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file lmk05318-0.1.2.tar.gz.

File metadata

  • Download URL: lmk05318-0.1.2.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.10

File hashes

Hashes for lmk05318-0.1.2.tar.gz
Algorithm Hash digest
SHA256 0ff871f9c8394169087c0cbf5bb1f19b99f27173299581e3e21ced3c8fbf5b65
MD5 4dcfee6ca10c4a71dfa97a44740bd0f5
BLAKE2b-256 607a2562d516ade0c4f7aa3a096f0b2f3f53042566c1d3407e4ee292f34fae76

See more details on using hashes here.

File details

Details for the file lmk05318-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: lmk05318-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.10

File hashes

Hashes for lmk05318-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fa4a6f7c05a8456dfb8fc698659b3e5d9eba718cb3eceaae1a52b0bca427991b
MD5 e4b7b62c6415b181c5cfa1d11c9d0c77
BLAKE2b-256 75b9e3e27da794549722a57a8b265daca94a4a1156177021d0e6e03709d349ba

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page