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.
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: -- -- -- -- -- -- -- --
Run test.py to see if everything works:
from lmk05318 import LMK05318
from ti_i2c_regs import lmk_i2c_regs
import logging
def main():
lmk_regs_iface = lmk_i2c_regs(0, 0x64)
lmk = LMK05318(regs_iface=lmk_regs_iface)
vendor_id = lmk.get_vendor_id()
print(f"LMK05318 vendor_id: {hex(vendor_id)}")
status = lmk.get_status_dpll()
print(f"LMK05318 status {status}")
valid = lmk.is_chip_id_valid()
print(f"LMK05318 valid: {valid}")
lmk.write_cfg_regs_to_eeprom(LMK05318.LMK_EEPROM_REG_COMMIT)
vendor_id = lmk.get_vendor_id()
print(f"LMK05318 vendor_id: {hex(vendor_id)}")
if __name__ == '__main__':
logging.basicConfig(level=logging.INFO)
main()
Debug and development
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 test.py as root:
root@xxx:/tmp# python3 LMK05318/test.py
INFO:lmk05318:Vendor ID Readback: 0x100B
LMK05318 vendor_id: 0x100b
LMK05318 status
Loss of phase lock: 1
Loss of freq. lock: 1
Tuning word update: 0
Holdover Event: 1
Reference Switch Event: 0
Active ref. missing clk: 0
Active ref. loss freq.: 0
Active ref. loss ampl.: 0
INFO:lmk05318:Vendor ID Readback: 0x100B
INFO:lmk05318:Product ID Readback: 0x35
LMK05318 valid: True
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:programming EEPROM done, power-cycle or hard-reset to take effect
INFO:lmk05318:Vendor ID Readback: 0x100B
LMK05318 vendor_id: 0x100b
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.0.tar.gz
(5.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lmk05318-0.1.0.tar.gz.
File metadata
- Download URL: lmk05318-0.1.0.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7318ce5cbc71f50376e432345d799917a929f13ec0b2527784b373d137359366
|
|
| MD5 |
4be507f48876f76c17ac265d4019687f
|
|
| BLAKE2b-256 |
7edee54895222db8d424173aa4aaec04f14108c4aa88cb6b666222dccc0f7fe3
|
File details
Details for the file lmk05318-0.1.0-py3-none-any.whl.
File metadata
- Download URL: lmk05318-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c46367b8dddef8720fa41467cbd24a920494014e58e3722090152f2b800da570
|
|
| MD5 |
3fd3c117b194cfe25f51a2d53125dd41
|
|
| BLAKE2b-256 |
c6d64f417ef3ceff50526db4c10fd86bf77eb06de95a4a00f7333fdae254ade2
|