args = docopt(__doc__, version='0.1') rc = newton.adi_newton_config(0) if rc != 0: print("ERROR: newton.adi_newton_config return an error (" + str(rc) + ").") sys.exit(rc) if args['--no_reset']: performReset = False if performReset == True: newton.adi_reset_newton(newton.PIN_MODE_HSP_DEBUG) newton.adi_check_register_py(0x0142, 0x0500) # pll_status newton.adi_write_register(0x0164, 0x0004) # ts_ctrl newton.adi_write_register(0x0164, 0x0003) # ts_ctrl newton.adi_write_register(0x0164, 0x0000) # ts_ctrl newton.adi_check_register_py(0x0032, 0x0000) # errorStatus newton.adi_check_register_py(0x0164, 0x8000) # ts_ctrl newton.adi_write_register(0x0170, 0x0008) # vlowregCtrl3_s2 newton.adi_write_register(0x0150, 0x0501) # regif_ctrl newton.adi_check_register_py(0x0032, 0x0000) # errorStatus newton.adi_check_register_py(0x0150, 0x0101) # regif_ctrl newton.adi_check_register_py(0x0032, 0x0000) # errorStatus newton.adi_check_register_py(0x0170, 0x0008) # vlowregCtrl3_s2 newton.adi_write_register(0x0170, 0x0008) # vlowregCtrl3_s2 newton.adi_write_register(0x0150, 0x0501) # regif_ctrl newton.adi_check_register_py(0x0032, 0x0000) # errorStatus newton.adi_check_register_py(0x0150, 0x0101) # regif_ctrl newton.adi_check_register_py(0x0032, 0x0000) # errorStatus
if args['--no_fw_load']: loadFirmware = False if args['--no_reset']: performReset = False if performReset == True: newton.adi_reset_newton(newton.PIN_MODE_HSP_DEBUG) if loadFirmware == True: cmd_file = os.path.expanduser( "./tests/dms_eval_tests/fc_asm_mscm_dll_visible_moda/fc_asm_mscm_dll_visible_moda.txt" ) cmd_file_bytes = cmd_file.encode(encoding='utf-8') newton.adi_load_command_file(cmd_file_bytes) newton.adi_write_register(0x000C, 0x00c5) # useqControlRegister newton.adi_check_register_py(0x0142, 0x0500) # pll_status newton.adi_write_register(0x0244, 0x0020) # SCRATCHPAD[34] newton.adi_write_register(0x0028, 0x0000) # systemClockControl newton.adi_write_register(0x0140, 0x0133) # pll_ctrl newton.adi_write_register(0x015e, 0x8512) # syspll_ctrl2_s1 newton.adi_write_register(0x015a, 0x7810) # syspll_ctrl0_s1 newton.adi_write_register(0x0146, 0x007b) # power_down_adc_others newton.adi_write_register(0x017c, 0x0220) # xosc_ctrl newton.adi_write_register(0x0150, 0x0105) # regif_ctrl newton.adi_check_register_py(0x0032, 0x0000) # errorStatus newton.adi_check_register_py(0x0150, 0x0101) # regif_ctrl newton.adi_write_register(0x0140, 0x0033) # pll_ctrl newton.adi_write_register(0x0028, 0x0001) # systemClockControl newton.adi_check_register_py(0x0032, 0x0000) # errorStatus
from docopt import docopt import sys import io import os import time import struct import subprocess import ctypes from collections import OrderedDict import threading from newton_control_main import newton as newton if __name__ == "__main__": args = docopt(__doc__, version='0.1') writeData = 0x1111 rc = newton.adi_write_register(0x0060, writeData) if rc != newton.ADI_NO_ERROR: print("ERROR: Error \"" + newton.adi_error_msg(rc) + "\" returned from newton.adi_write_register.") sys.exit(rc) readData = newton.adi_read_register_py(0x0060) if rc != newton.ADI_NO_ERROR: print("ERROR: Error \"" + newton.adi_error_msg(rc) + "\" returned from newton.adi_read_register.") sys.exit(rc) if readData != writeData: print("ERROR: miscompare: expect = " + hex(writeData) + ", actual = " + hex(readData))
if args['--no_fw_load']: loadFirmware = False if args['--no_reset']: performReset = False if performReset == True: newton.adi_reset_newton(newton.PIN_MODE_HSP_DEBUG) if loadFirmware == True: cmd_file = os.path.expanduser( "./tests/dms_eval_tests/fc_asm_mscm_dll_lock_range_5p5ns_10Mhz/fc_asm_mscm_dll_lock_range_5p5ns_10Mhz.txt" ) cmd_file_bytes = cmd_file.encode(encoding='utf-8') newton.adi_load_command_file(cmd_file_bytes) newton.adi_write_register(0x000C, 0x00c5) # useqControlRegister newton.adi_check_register_py(0x0142, 0x0500) # pll_status newton.adi_write_register(0x0244, 0x0020) # SCRATCHPAD[34] newton.adi_check_register_py(0x0032, 0x0000) # errorStatus newton.adi_check_register_py(0x0140, 0x0033) # pll_ctrl newton.adi_write_register(0x0140, 0x0032) # pll_ctrl newton.adi_write_register(0x0140, 0x0030) # pll_ctrl newton.adi_check_register_py(0x0032, 0x0000) # errorStatus newton.adi_check_register_py(0x0142, 0x0501) # pll_status newton.adi_write_register(0x0158, 0x020b) # sspll_ctrl2_s1 newton.adi_write_register(0x0138, 0x0001) # lsctrl0_s1 newton.adi_write_register(0x013a, 0x0005) # lsmod_en newton.adi_write_register(0x0116, 0x3f00) # ckgen_s1 newton.adi_write_register(0x0150, 0x0105) # regif_ctrl newton.adi_check_register_py(0x0032, 0x0000) # errorStatus
args = docopt(__doc__, version='0.1') rc = newton.adi_newton_config(0) if rc != 0: print("ERROR: newton.adi_newton_config return an error (" + str(rc) + ").") sys.exit(rc) if args['--no_reset']: performReset = False if performReset == True: newton.adi_reset_newton(newton.PIN_MODE_HSP_DEBUG) newton.adi_check_register_py(0x0142, 0x0500) # pll_status newton.adi_write_register(0x0028, 0x0000) # systemClockControl newton.adi_write_register(0x0140, 0x0100) # pll_ctrl newton.adi_write_register(0x0146, 0x00fb) # power_down_adc_others newton.adi_write_register(0x0144, 0x0006) # power_down_0 newton.adi_write_register(0x0146, 0x007b) # power_down_adc_others newton.adi_write_register(0x0144, 0x0004) # power_down_0 newton.adi_write_register(0x014c, 0x0000) # pump_s1 newton.adi_write_register(0x0150, 0x0105) # regif_ctrl newton.adi_check_register_py(0x0032, 0x0000) # errorStatus newton.adi_check_register_py(0x0150, 0x0101) # regif_ctrl newton.adi_check_register_py(0x0032, 0x0000) # errorStatus newton.adi_check_register_py(0x014c, 0x0000) # pump_s1 newton.adi_write_register(0x014c, 0x0100) # pump_s1 newton.adi_write_register(0x0150, 0x0105) # regif_ctrl newton.adi_check_register_py(0x0032, 0x0000) # errorStatus newton.adi_check_register_py(0x0150, 0x0101) # regif_ctrl
if args['--no_fw_load']: loadFirmware = False if args['--no_reset']: performReset = False if performReset == True: newton.adi_reset_newton(newton.PIN_MODE_HSP_DEBUG) if loadFirmware == True: cmd_file = os.path.expanduser( "./tests/dms_eval_tests/fc_asm_mscm_adc_test/fc_asm_mscm_adc_test.txt" ) cmd_file_bytes = cmd_file.encode(encoding='utf-8') newton.adi_load_command_file(cmd_file_bytes) newton.adi_write_register(0x000C, 0x00c5) # useqControlRegister newton.adi_check_register_py(0x0142, 0x0500) # pll_status newton.adi_write_register(0x0244, 0x0020) # SCRATCHPAD[34] newton.adi_write_register(0x0014, 0x3918) # digPwrDown newton.adi_write_register(0x010e, 0xdddd) # amp_ctrl1_s1 newton.adi_write_register(0x0150, 0x0905) # regif_ctrl newton.adi_check_register_py(0x0032, 0x0000) # errorStatus newton.adi_check_register_py(0x0150, 0x0101) # regif_ctrl newton.adi_write_register(0x010c, 0xdddd) # amp_ctrl0_s1 newton.adi_write_register(0x0150, 0x0105) # regif_ctrl newton.adi_check_register_py(0x0032, 0x0000) # errorStatus newton.adi_check_register_py(0x0150, 0x0101) # regif_ctrl newton.adi_write_register(0x0160, 0x0011) # ana_test_mux_s1 newton.adi_write_register(0x0150, 0x0105) # regif_ctrl newton.adi_check_register_py(0x0032, 0x0000) # errorStatus
args = docopt(__doc__, version='0.1') rc = newton.adi_newton_config( 0 ) if rc != 0: print( "ERROR: newton.adi_newton_config return an error (" + str( rc ) + ")." ) sys.exit( rc ) if args['--no_reset']: performReset = False if performReset == True: newton.adi_reset_newton( newton.PIN_MODE_HSP_DEBUG ) newton.adi_check_register_py( 0x0142, 0x0500 ) # pll_status newton.adi_write_register( 0x0146, 0x007b ) # power_down_adc_others newton.adi_write_register( 0x0146, 0x005b ) # power_down_adc_others newton.adi_write_register( 0x0146, 0x004b ) # power_down_adc_others newton.adi_write_register( 0x0128, 0x83ff ) # dac_ctrl2 newton.adi_write_register( 0x0128, 0x83ff ) # dac_ctrl2 newton.adi_write_register( 0x0128, 0x03ff ) # dac_ctrl2 newton.adi_write_register( 0x0128, 0x0000 ) # dac_ctrl2 newton.adi_write_register( 0x0128, 0x0000 ) # dac_ctrl2 newton.adi_write_register( 0x012e, 0x0915 ) # dac_ctrl2_s1 newton.adi_write_register( 0x0130, 0x8016 ) # dac_ctrl3_s1 newton.adi_write_register( 0x012e, 0x0000 ) # dac_ctrl2_s1 newton.adi_write_register( 0x0130, 0x0000 ) # dac_ctrl3_s1 newton.adi_write_register( 0x0150, 0x0105 ) # regif_ctrl newton.adi_check_register_py( 0x0032, 0x0000 ) # errorStatus newton.adi_check_register_py( 0x0150, 0x0101 ) # regif_ctrl newton.adi_write_register( 0x0132, 0x0000 ) # dac_data
sys.exit( rc ) if args['--no_fw_load']: loadFirmware = False if args['--no_reset']: performReset = False if performReset == True: newton.adi_reset_newton( newton.PIN_MODE_HSP_DEBUG ) if loadFirmware == True: cmd_file = os.path.expanduser( "./tests/dms_eval_tests/fc_asm_mscm_rdriv_690k/fc_asm_mscm_rdriv_690k.txt" ) cmd_file_bytes = cmd_file.encode(encoding='utf-8') newton.adi_load_command_file( cmd_file_bytes ) newton.adi_write_register( 0x000C, 0x00c5 ) # useqControlRegister newton.adi_check_register_py( 0x0142, 0x0500 ) # pll_status newton.adi_write_register( 0x0244, 0x0020 ) # SCRATCHPAD[34] newton.adi_write_register( 0x0014, 0x3918 ) # digPwrDown newton.adi_write_register( 0x0146, 0x007b ) # power_down_adc_others newton.adi_write_register( 0x0e00, 0x0082 ) # de_control newton.adi_write_register( 0x0e5a, 0x0003 ) # array_init_vec_dark newton.adi_check_register_py( 0x0032, 0x0000 ) # errorStatus newton.adi_check_register_py( 0x0256, 0x0001 ) # SCRATCHPAD[43] newton.adi_check_register_py( 0x0032, 0x0000 ) # errorStatus newton.adi_check_register_py( 0x0256, 0x0001 ) # SCRATCHPAD[43] newton.adi_check_register_py( 0x0032, 0x0000 ) # errorStatus newton.adi_check_register_py( 0x0256, 0x0001 ) # SCRATCHPAD[43] newton.adi_check_register_py( 0x0032, 0x0000 ) # errorStatus newton.adi_check_register_py( 0x0256, 0x0001 ) # SCRATCHPAD[43]
args = docopt(__doc__, version='0.1') rc = newton.adi_newton_config(0) if rc != 0: print("ERROR: newton.adi_newton_config return an error (" + str(rc) + ").") sys.exit(rc) if args['--no_reset']: performReset = False if performReset == True: newton.adi_reset_newton(newton.PIN_MODE_HSP_DEBUG) newton.adi_check_register_py(0x0142, 0x0500) # pll_status newton.adi_write_register(0x0028, 0x0000) # systemClockControl newton.adi_write_register(0x0140, 0x0100) # pll_ctrl newton.adi_write_register(0x0146, 0x00fb) # power_down_adc_others newton.adi_write_register(0x0146, 0x007b) # power_down_adc_others newton.adi_write_register(0x0160, 0x0003) # ana_test_mux_s1 newton.adi_write_register(0x0150, 0x0105) # regif_ctrl newton.adi_check_register_py(0x0032, 0x0000) # errorStatus newton.adi_check_register_py(0x0150, 0x0101) # regif_ctrl newton.adi_check_register_py(0x0032, 0x0000) # errorStatus newton.adi_check_register_py(0x0160, 0x0003) # ana_test_mux_s1 newton.adi_write_register(0x0160, 0x0004) # ana_test_mux_s1 newton.adi_write_register(0x0150, 0x0105) # regif_ctrl newton.adi_check_register_py(0x0032, 0x0000) # errorStatus newton.adi_check_register_py(0x0150, 0x0101) # regif_ctrl newton.adi_check_register_py(0x0032, 0x0000) # errorStatus newton.adi_check_register_py(0x0160, 0x0004) # ana_test_mux_s1
args = docopt(__doc__, version='0.1') rc = newton.adi_newton_config( 0 ) if rc != 0: print( "ERROR: newton.adi_newton_config return an error (" + str( rc ) + ")." ) sys.exit( rc ) if args['--no_reset']: performReset = False if performReset == True: newton.adi_reset_newton( newton.PIN_MODE_HSP_DEBUG ) newton.adi_check_register_py( 0x0142, 0x0500 ) # pll_status newton.adi_write_register( 0x0028, 0x0000 ) # systemClockControl newton.adi_write_register( 0x0140, 0x0233 ) # pll_ctrl newton.adi_write_register( 0x0140, 0x0033 ) # pll_ctrl newton.adi_write_register( 0x015e, 0x8312 ) # syspll_ctrl2_s1 newton.adi_check_register_py( 0x0032, 0x0000 ) # errorStatus newton.adi_check_register_py( 0x0142, 0x0100 ) # pll_status newton.adi_write_register( 0x0138, 0x00b0 ) # lsctrl0_s1 newton.adi_write_register( 0x0150, 0x0105 ) # regif_ctrl newton.adi_check_register_py( 0x0032, 0x0000 ) # errorStatus newton.adi_check_register_py( 0x0150, 0x0101 ) # regif_ctrl newton.adi_write_register( 0x013a, 0x0039 ) # lsmod_en newton.adi_write_register( 0x018e, 0x8aea ) # ana_serial_spare_0 newton.adi_write_register( 0x0150, 0x0105 ) # regif_ctrl newton.adi_check_register_py( 0x0032, 0x0000 ) # errorStatus newton.adi_check_register_py( 0x0150, 0x0101 ) # regif_ctrl newton.adi_write_register( 0x0140, 0x0133 ) # pll_ctrl
args = docopt(__doc__, version='0.1') rc = newton.adi_newton_config(0) if rc != 0: print("ERROR: newton.adi_newton_config return an error (" + str(rc) + ").") sys.exit(rc) if args['--no_reset']: performReset = False if performReset == True: newton.adi_reset_newton(newton.PIN_MODE_HSP_DEBUG) newton.adi_check_register_py(0x0142, 0x0500) # pll_status newton.adi_write_register(0x0114, 0x000f) # ckgen_ctrl newton.adi_write_register(0x0140, 0x0332) # pll_ctrl newton.adi_write_register(0x0140, 0x0330) # pll_ctrl newton.adi_check_register_py(0x0032, 0x0000) # errorStatus newton.adi_check_register_py(0x0142, 0x0500) # pll_status newton.adi_check_register_py(0x0032, 0x0000) # errorStatus newton.adi_check_register_py(0x0142, 0x0501) # pll_status newton.adi_write_register(0x0138, 0x00a0) # lsctrl0_s1 newton.adi_write_register(0x013a, 0x0005) # lsmod_en newton.adi_write_register(0x0150, 0x0105) # regif_ctrl newton.adi_check_register_py(0x0032, 0x0000) # errorStatus newton.adi_check_register_py(0x0150, 0x0101) # regif_ctrl newton.adi_write_register(0x0158, 0x000e) # sspll_ctrl2_s1 newton.adi_write_register(0x0150, 0x0105) # regif_ctrl newton.adi_check_register_py(0x0032, 0x0000) # errorStatus newton.adi_check_register_py(0x0150, 0x0101) # regif_ctrl
if args['--no_fw_load']: loadFirmware = False if args['--no_reset']: performReset = False if performReset == True: newton.adi_reset_newton(newton.PIN_MODE_HSP_DEBUG) if loadFirmware == True: cmd_file = os.path.expanduser( "./tests/dms_eval_tests/fc_asm_mscm_rdriv_1M/fc_asm_mscm_rdriv_1M.txt" ) cmd_file_bytes = cmd_file.encode(encoding='utf-8') newton.adi_load_command_file(cmd_file_bytes) newton.adi_write_register(0x000C, 0x00c5) # useqControlRegister newton.adi_check_register_py(0x0142, 0x0500) # pll_status newton.adi_write_register(0x0104, 0x00f2) # adc_ctrl2_s1 newton.adi_write_register(0x0102, 0x00c2) # adc_ctrl1_s1 newton.adi_write_register(0x0100, 0x0014) # adc_ctrl0_s1 newton.adi_write_register(0x0244, 0x0020) # SCRATCHPAD[34] newton.adi_write_register(0x0014, 0x3910) # digPwrDown newton.adi_write_register(0x0146, 0x007b) # power_down_adc_others newton.adi_write_register(0x011a, 0x0001) # clk_de_ctrl_s1 newton.adi_write_register(0x0e00, 0x0082) # de_control newton.adi_write_register(0x0e5a, 0x0003) # array_init_vec_dark newton.adi_write_register(0x0d0c, 0x0702) # USE_CASE_MIPI_PACKET_CONTROL newton.adi_check_register_py(0x0032, 0x0040) # errorStatus newton.adi_check_register_py(0x0256, 0x0001) # SCRATCHPAD[43] newton.adi_check_register_py(0x0032, 0x0040) # errorStatus
Options: --help Shows this help message. """ from __future__ import print_function from __future__ import absolute_import from __future__ import unicode_literals from docopt import docopt import struct import ctypes from newton_control_main import newton as newton if __name__ == "__main__": args = docopt(__doc__, version='0.1') address = int( args['<address>'], 16 ) write_data = int( args['<write_data>'], 16 ) rc = newton.adi_newton_config( 0 ) if rc != 0: print( "ERROR: newton.adi_newton_config return an error (" + str( rc ) + ")." ) sys.exit( rc ) newton.adi_write_register( address, write_data ) read_data = newton.adi_read_register_py( address ) if read_data != write_data: print( "ERROR: miscompare: actual = " + hex( read_data ) + " , expected = " + hex ( write_data ) )
if args['--no_fw_load']: loadFirmware = False if args['--no_reset']: performReset = False if performReset == True: newton.adi_reset_newton(newton.PIN_MODE_HSP_DEBUG) if loadFirmware == True: cmd_file = os.path.expanduser( "./tests/dms_eval_tests/fc_asm_mscm_amp_test/fc_asm_mscm_amp_test.txt" ) cmd_file_bytes = cmd_file.encode(encoding='utf-8') newton.adi_load_command_file(cmd_file_bytes) newton.adi_write_register(0x000C, 0x00c5) # useqControlRegister newton.adi_check_register_py(0x0142, 0x0500) # pll_status newton.adi_write_register(0x0244, 0x0020) # SCRATCHPAD[34] newton.adi_write_register(0x0014, 0x3918) # digPwrDown newton.adi_write_register(0x0100, 0x0030) # adc_ctrl0_s1 newton.adi_write_register(0x0192, 0x8380) # ana_serial_spare_2 newton.adi_write_register(0x0128, 0x8000) # dac_ctrl2 newton.adi_write_register(0x0132, 0x0080) # dac_data newton.adi_write_register(0x0126, 0x0004) # dac_ctrl1 newton.adi_write_register(0x0132, 0x00a8) # dac_data newton.adi_write_register(0x0126, 0x0080) # dac_ctrl1 newton.adi_write_register(0x0160, 0x0001) # ana_test_mux_s1 newton.adi_write_register(0x0150, 0x0905) # regif_ctrl newton.adi_check_register_py(0x0032, 0x0000) # errorStatus newton.adi_check_register_py(0x0150, 0x0101) # regif_ctrl
sys.exit( rc ) if args['--no_fw_load']: loadFirmware = False if args['--no_reset']: performReset = False if performReset == True: newton.adi_reset_newton( newton.PIN_MODE_HSP_DEBUG ) if loadFirmware == True: cmd_file = os.path.expanduser( "./tests/dms_eval_tests/fc_asm_mscm_rdriv_dn/fc_asm_mscm_rdriv_dn.txt" ) cmd_file_bytes = cmd_file.encode(encoding='utf-8') newton.adi_load_command_file( cmd_file_bytes ) newton.adi_write_register( 0x000C, 0x00c5 ) # useqControlRegister newton.adi_check_register_py( 0x0142, 0x0500 ) # pll_status newton.adi_write_register( 0x0244, 0x0020 ) # SCRATCHPAD[34] newton.adi_write_register( 0x0014, 0x3918 ) # digPwrDown newton.adi_write_register( 0x0146, 0x007f ) # power_down_adc_others newton.adi_write_register( 0x0e00, 0x0082 ) # de_control newton.adi_write_register( 0x0e5a, 0x0003 ) # array_init_vec_dark newton.adi_write_register( 0x0e1c, 0x8002 ) # amp_mux_sel_EE_low newton.adi_write_register( 0x0e1e, 0x0000 ) # amp_mux_sel_EE_high newton.adi_write_register( 0x0e24, 0x4001 ) # amp_mux_sel_OE_low newton.adi_write_register( 0x0e26, 0x0000 ) # amp_mux_sel_OE_high newton.adi_write_register( 0x0e20, 0x2080 ) # amp_mux_sel_EO_low newton.adi_write_register( 0x0e22, 0x0000 ) # amp_mux_sel_EO_high newton.adi_write_register( 0x0e28, 0x1040 ) # amp_mux_sel_OO_low newton.adi_write_register( 0x0e2a, 0x0000 ) # amp_mux_sel_OO_high