diff options
author | Martin Braun <martin.braun@ettus.com> | 2017-04-19 18:55:16 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-12-22 15:03:46 -0800 |
commit | 36365930a6035e18dc3ec07d401d73e7730af8cf (patch) | |
tree | 5d1c2e3653c3f2edce464328fdf03eafaaffd476 /host/lib | |
parent | 0cdf67ad33628af28cf92ef4ad7eaa63c712b8b5 (diff) | |
download | uhd-36365930a6035e18dc3ec07d401d73e7730af8cf.tar.gz uhd-36365930a6035e18dc3ec07d401d73e7730af8cf.tar.bz2 uhd-36365930a6035e18dc3ec07d401d73e7730af8cf.zip |
mpm: Fixed a plethora of SPI-related issues
Diffstat (limited to 'host/lib')
-rw-r--r-- | host/lib/usrp/common/lmk04828.cpp | 18 | ||||
-rw-r--r-- | host/lib/usrp/common/lmk04828.hpp | 8 |
2 files changed, 17 insertions, 9 deletions
diff --git a/host/lib/usrp/common/lmk04828.cpp b/host/lib/usrp/common/lmk04828.cpp index 6a0f5fd14..9a9657ac8 100644 --- a/host/lib/usrp/common/lmk04828.cpp +++ b/host/lib/usrp/common/lmk04828.cpp @@ -31,11 +31,13 @@ lmk04828_iface::lmk04828_iface(write_fn_t write_fn, read_fn_t read_fn) : _write_ void lmk04828_iface::verify_chip_id() { // Check ID Device Type, ID Prod, and ID Maskrev registers - uint8_t id_device_type = _read_fn(3); + uint8_t id_device_type = get_chip_id(); + + std::cout << "LMK device ID: " << int(id_device_type) << std::endl; // assert(id_device_type == 6); if (id_device_type != 6){ - printf("id_device_type is not 6!"); + std::cout << "id_device_type is not 6!" << std::endl; } } @@ -48,15 +50,15 @@ void lmk04828_iface::init() { // Configure the LMK to start producing clocks // TODO: Convert to use ic_reg_map fields once values are finalized/working - std::vector<uint32_t> write_addrs = { + std::vector<uint16_t> write_addrs = { 0x000000,0x000000,0x000002,0x000149,0x00014A,0x000100,0x000101,0x000103,0x000104,0x000105,0x000106,0x000107,0x000120,0x000121,0x000123,0x000124,0x000125,0x000126,0x000127,0x000130,0x000131,0x000133,0x000134,0x000135,0x000136,0x000137,0x000128,0x000129,0x00012B,0x00012C,0x00012D,0x00012E,0x00012F,0x000108,0x000109,0x00010B,0x00010C,0x00010D,0x00010E,0x00010F,0x000118,0x000119,0x00011B,0x00011C,0x00011D,0x00011E,0x00011F,0x000138,0x00013F,0x000140,0x000144,0x000146,0x000147,0x00014B,0x00014C,0x000153,0x000154,0x000155,0x000156,0x000157,0x000158,0x000159,0x00015A,0x00015B,0x00015E,0x000160,0x000161,0x000162,0x000163,0x000164,0x000165,0x000166,0x000167,0x000168,0x00016E,0x000173,0x000169,0x00016C,0x00016D}; - std::vector<uint32_t> write_data = { + std::vector<uint8_t> write_data = { 0x000090,0x000010,0x000000,0x000040,0x000033,0x000078,0x000055,0x000000,0x000020,0x000000,0x0000F1,0x000055,0x000078,0x000055,0x000000,0x000020,0x000000,0x0000F1,0x000055,0x000078,0x000055,0x000000,0x000020,0x000000,0x0000F1,0x000005,0x000078,0x000055,0x000000,0x000000,0x000000,0x0000F0,0x000050,0x00007E,0x000055,0x000000,0x000000,0x000000,0x0000F0,0x000055,0x000078,0x000055,0x000000,0x000020,0x000000,0x0000F1,0x000000,0x000030,0x000009,0x000000,0x000000,0x000010,0x00001A,0x00000D,0x0000F6,0x000000,0x000001,0x000000,0x00000A,0x000000,0x000001,0x000000,0x00007D,0x0000DB,0x000000,0x000000,0x000004,0x0000A0,0x000000,0x000000,0x000019,0x000000,0x000000,0x000019,0x00006B,0x000000,0x000051,0x000000,0x000000}; std::vector<uint32_t> writes {}; for (size_t index = 0; index < write_addrs.size(); index++) { - writes.push_back((write_addrs[index] << 11) | write_data[index]); + writes.push_back((write_addrs[index] << 8) | write_data[index]); } std::cout << "LMK Initialization writes" << std::endl; @@ -66,12 +68,14 @@ void lmk04828_iface::init() std::cout << std::endl; _write_fn(writes); + + verify_chip_id(); } -void lmk04828_iface::send_sysref_pulse() +void lmk04828_iface::enable_sysref_pulse() { // Configure the LMK to issue a single SysRef pulse each time SYNC is asserted - + // TODO: Convert to use ic reg map fields once functional // Addr 0x139 Value 0x2 // Addr 0x144 Value 0xFF diff --git a/host/lib/usrp/common/lmk04828.hpp b/host/lib/usrp/common/lmk04828.hpp index 80a7a8917..36266bbfe 100644 --- a/host/lib/usrp/common/lmk04828.hpp +++ b/host/lib/usrp/common/lmk04828.hpp @@ -46,12 +46,16 @@ public: void init(); - void send_sysref_pulse(); + /*! Enable SYSREF pulses + * + * After calling this, triggering the sync pin will emit a SYSREF pulse. + */ + void enable_sysref_pulse(); private: // use IC Reg Map once values stabilize // lmk04828_regs_t _regs; - + write_fn_t _write_fn; read_fn_t _read_fn; }; |