Exemplo n.º 1
0
def create_omega_dbg(axi4_bus_name, spi_axi4_bus_name, i2c_bus_name):
    omega = OmegaDebuger()

    if 'DAQT1' in axi4_bus_name:
        daqt1_axi4_bus = AXI4LiteBus(axi4_bus_name, 0x8000)
        daqt1 = MIXDAQT1SGR(axi4_bus=daqt1_axi4_bus,
                            ad717x_chip='AD7175',
                            ad717x_mvref=5000,
                            use_spi=True,
                            use_gpio=False)
        ad7175 = None
        spi_bus = None
    else:
        daqt1 = None
        ad717x_axi4_bus = AXI4LiteBus(axi4_bus_name, 0x8192)
        ad7175 = MIXAd7175SG(ad717x_axi4_bus, 5000)

        spi_axi4_bus = AXI4LiteBus(spi_axi4_bus_name, 0x8192)
        spi_bus = PLSPIBus(spi_axi4_bus)

    axi4_bus = AXI4LiteBus(i2c_bus_name, 256)
    i2c_bus = MIXI2CSG(axi4_bus)

    omega.omega = DMM005004(i2c=i2c_bus,
                            spi=spi_bus,
                            ad7175=ad7175,
                            ipcore=daqt1)
    return omega
Exemplo n.º 2
0
    def __init__(self, i2c_ext=None, i2c_power=None, ad7175=None, ipcore=None):

        if ad7175 and not ipcore:
            if isinstance(ad7175, basestring):
                axi4 = AXI4LiteBus(ad7175, OdinDef.PLAD7175_REG_SIZE)
                self.ad7175 = MIXAd7175SG(axi4, mvref=OdinDef.MVREF, code_polar=OdinDef.POLAR,
                                          reference=OdinDef.AD7175_REF_MODE, clock=OdinDef.CLOCK)
            else:
                self.ad7175 = ad7175

        elif not ad7175 and ipcore:
            if isinstance(ipcore, basestring):
                axi4_bus = AXI4LiteBus(ipcore, OdinDef.MIX_PSU001_REG_SIZE)
                self.ipcore = MIXPSU001SGR(axi4_bus, 'AD7175', ad717x_mvref=OdinDef.MVREF,
                                           code_polar=OdinDef.POLAR, reference=OdinDef.AD7175_REF_MODE,
                                           clock=OdinDef.CLOCK, use_gpio=False)
            else:
                self.ipcore = ipcore
            self.ad7175 = self.ipcore.ad717x

        if i2c_ext and i2c_power:
            eeprom = CAT24C32(OdinDef.EEPROM_DEV_ADDR, i2c_ext)
            nct75 = NCT75(OdinDef.NCT75_DEV_ADDR, i2c_ext)
            self.tca9538 = TCA9538(OdinDef.TCA9538_ADDR, i2c_ext)
            self.ad5667_batt = AD5667R(OdinDef.DAC_BATT_ADDR, i2c_power,
                                       ref_mode=OdinDef.DAC_REF_MODE, mvref=OdinDef.DAC_VREF)
            self.ad5667_charge = AD5667R(OdinDef.DAC_CHARGE_ADDR, i2c_power,
                                         ref_mode=OdinDef.DAC_REF_MODE, mvref=OdinDef.DAC_VREF)
            self.ch1_output_config = dict()
            self.ch2_output_config = dict()
            self.ch1_input_config = dict()
            self.ch2_input_config = dict()
            super(Odin, self).__init__(eeprom, nct75, range_table=odin_range_table)
        else:
            raise OdinException("Invalid parameter, please check")
Exemplo n.º 3
0
    def __init__(self, i2c, ad7175=None, fault_pin=None, ipcore=None):
        if ipcore:
            if isinstance(ipcore, basestring):
                axi4_bus = AXI4LiteBus(ipcore, HPPSU001Def.MIX_DAQT1_REG_SIZE)
                ipcore = MIXDAQT1SGR(
                    axi4_bus,
                    'AD7175',
                    ad717x_mvref=HPPSU001Def.AD7175_MVREF,
                    code_polar=HPPSU001Def.AD7175_CODE_POLAR,
                    reference=HPPSU001Def.AD7175_REFERENCE_SOURCE,
                    buffer_flag=HPPSU001Def.AD7175_BUFFER_FLAG,
                    clock=HPPSU001Def.AD7175_CLOCK,
                    use_spi=False,
                    use_gpio=False)
        elif ad7175:
            if isinstance(ad7175, basestring):
                axi4_bus = AXI4LiteBus(ad7175, HPPSU001Def.AD7175_REG_SIZE)
                ad7175 = MIXAd7175SG(
                    axi4_bus,
                    mvref=HPPSU001Def.AD7175_MVREF,
                    code_polar=HPPSU001Def.AD7175_CODE_POLAR,
                    reference=HPPSU001Def.AD7175_REFERENCE_SOURCE,
                    buffer_flag=HPPSU001Def.AD7175_BUFFER_FLAG,
                    clock=HPPSU001Def.AD7175_CLOCK)
        else:
            ad7175 = MIXAd7175SGEmulator('mix_ad7175_sg_emulator',
                                         HPPSU001Def.AD7175_MVREF)

        super(HPPSU001002, self).__init__(i2c, ad7175, fault_pin, ipcore,
                                          hppsu001002_calibration_info,
                                          hppsu001002_range_table)
Exemplo n.º 4
0
def create_dmm_dbg(ad7175_bus_name, i2c_bus_name, axi4_bus_name):
    dmm_dbg = DMM010001Debuger()

    if axi4_bus_name == '':
        daqt1 = MIXDAQT1SGREmulator(axi4_bus=None,
                                    ad717x_chip='AD7175',
                                    ad717x_mvref=5000,
                                    use_spi=False,
                                    use_gpio=False)
        ad7175 = None
    elif 'MIX_DAQT' in axi4_bus_name:
        daqt1_axi4_bus = AXI4LiteBus(axi4_bus_name, 65535)
        daqt1 = MIXDAQT1SGR(axi4_bus=daqt1_axi4_bus,
                            ad717x_chip='AD7175',
                            ad717x_mvref=5000,
                            use_spi=False,
                            use_gpio=False)
        ad7175 = None
    else:
        daqt1 = None
        ad717x_axi4_bus = AXI4LiteBus(ad7175_bus_name, 8192)
        ad7175 = MIXAd7175SG(ad717x_axi4_bus, 5000)

    if i2c_bus_name == '':
        i2c_bus = None
    else:
        if utility.is_pl_device(i2c_bus_name):
            axi4_bus = AXI4LiteBus(i2c_bus_name, 256)
            i2c_bus = MIXI2CSG(axi4_bus)
        else:
            i2c_bus = I2C(i2c_bus_name)

    dmm_dbg.dmm = DMM010001(ad7175, i2c_bus, daqt1)
    dmm_dbg.dmm.module_init()
    return dmm_dbg
Exemplo n.º 5
0
def create_mimic_dbg(ipcore_name, ad7175_bus_name, vref, i2c_bus_name):
    mimic_dbg = DMM003004Debuger()
    daqt1 = None
    ad7175 = None
    if ipcore_name != '':
        axi4_bus = AXI4LiteBus(ipcore_name, 9548)
        daqt1 = MIXDAQT1SGR(axi4_bus,
                            ad717x_mvref=vref,
                            use_spi=False,
                            use_gpio=False)
    elif ad7175_bus_name != '':
        axi4_bus = AXI4LiteBus(ad7175_bus_name, 256)
        ad7175 = MIXAd7175SG(axi4_bus, vref)

    if i2c_bus_name == '':
        i2c_bus = None
    else:
        if utility.is_pl_device(i2c_bus_name):
            axi4_bus = AXI4LiteBus(i2c_bus_name, 256)
            i2c_bus = MIXI2CSG(axi4_bus)
        else:
            i2c_bus = I2C(i2c_bus_name)

    mimic_dbg.mimic = DMM003004(i2c_bus, daqt1, ad7175)
    mimic_dbg.mimic.post_power_on_init()
    return mimic_dbg
Exemplo n.º 6
0
    def __init__(self, i2c=None, ipcore=None, ad7175=None):

        if ipcore:
            if isinstance(ipcore, basestring):
                daqt1_axi4_bus = AXI4LiteBus(ipcore,
                                             DMM003004Def.MIXDAQT1_REG_SIZE)
                self.ip = MIXDAQT1SGR(
                    axi4_bus=daqt1_axi4_bus,
                    ad717x_chip='AD7175',
                    ad717x_mvref=DMM003004Def.ADC_VREF_VOLTAGE_5000mV,
                    use_spi=True,
                    use_gpio=False)
                self.ad7175 = self.ip.ad717x
            else:
                self.ip = ipcore
                self.ad7175 = self.ip.ad717x
        elif ad7175:
            if isinstance(ad7175, basestring):
                axi4_bus = AXI4LiteBus(ad7175, DMM003004Def.AD7175_REG_SIZE)
                self.ad7175 = MIXAd7175SG(
                    axi4_bus, mvref=DMM003004Def.ADC_VREF_VOLTAGE_5000mV)
            else:
                self.ad7175 = ad7175
        else:
            raise DMM003004Exception("Invalid parameter, please check")

        super(DMM003004, self).__init__(i2c,
                                        ipcore,
                                        ad7175,
                                        DMM003004Def.EEPROM_DEV_ADDR,
                                        DMM003004Def.SENSOR_DEV_ADDR,
                                        DMM003004Def.CAT9555_DEV_ADDR,
                                        range_table=dmm003004_range_table)
        self.function_info = dmm003004_function_info
Exemplo n.º 7
0
    def __init__(self,
                 i2c,
                 ad7175=None,
                 ipcore=None,
                 eeprom_dev_addr=DaggerDef.EEPROM_DEV_ADDR,
                 sensor_dev_addr=DaggerDef.NCT75_DEV_ADDR):

        if ipcore and ad7175:
            raise DaggerException(
                'ipcore and ad7175 can not be existed at the same time')

        self.ipcore = ipcore
        if ipcore is not None:
            if isinstance(ipcore, basestring):
                axi4_bus = AXI4LiteBus(ipcore, DaggerDef.MIX_DAQT1_REG_SIZE)
                self.ipcore = MIXDAQT1SGR(
                    axi4_bus,
                    'AD7175',
                    ad717x_mvref=DaggerDef.AD7175_MVREF,
                    code_polar=DaggerDef.AD7175_CODE_POLAR,
                    reference=DaggerDef.AD7175_REFERENCE_SOURCE,
                    buffer_flag=DaggerDef.AD7175_BUFFER_FLAG,
                    clock=DaggerDef.AD7175_CLOCK,
                    use_spi=False,
                    use_gpio=False)
            else:
                self.ipcore = ipcore
            self.ad7175 = self.ipcore.ad717x
        elif ad7175:
            if isinstance(ad7175, basestring):
                axi4_bus = AXI4LiteBus(ad7175, DaggerDef.AD7175_REG_SIZE)
                self.ad7175 = MIXAd7175SG(
                    axi4_bus,
                    mvref=DaggerDef.AD7175_MVREF,
                    code_polar=DaggerDef.AD7175_CODE_POLAR,
                    reference=DaggerDef.AD7175_REFERENCE_SOURCE,
                    buffer_flag=DaggerDef.AD7175_BUFFER_FLAG,
                    clock=DaggerDef.AD7175_CLOCK)
            else:
                self.ad7175 = ad7175
        else:
            raise DaggerException("Invalid parameter, please check")

        self.eeprom = CAT24C32(eeprom_dev_addr, i2c)
        self.nct75 = NCT75(sensor_dev_addr, i2c)
        super(DaggerBase, self).__init__(self.eeprom,
                                         self.nct75,
                                         range_table=dagger_range_table)

        self.ad7175.config = {
            "ch0": {
                "P": "AIN0",
                "N": "AIN1"
            },
            "ch1": {
                "P": "AIN2",
                "N": "AIN3"
            }
        }
Exemplo n.º 8
0
    def __init__(self,
                 i2c,
                 ipcore=None,
                 ad7175=None,
                 eeprom_dev_addr=MimicDef.EEPROM_DEV_ADDR,
                 sensor_dev_addr=MimicDef.SENSOR_DEV_ADDR,
                 cat9555_dev_addr=MimicDef.CAT9555_DEV_ADDR,
                 range_table=mimic_range_table):

        self.eeprom = CAT24C32(eeprom_dev_addr, i2c)
        self.sensor = NCT75(sensor_dev_addr, i2c)
        self.cat9555 = CAT9555(cat9555_dev_addr, i2c)

        if ipcore:
            if isinstance(ipcore, basestring):
                daqt1_axi4_bus = AXI4LiteBus(ipcore,
                                             MimicDef.MIXDAQT1_REG_SIZE)
                self.ip = MIXDAQT1SGR(
                    axi4_bus=daqt1_axi4_bus,
                    ad717x_chip='AD7175',
                    ad717x_mvref=MimicDef.ADC_VREF_VOLTAGE_5000mV,
                    use_spi=True,
                    use_gpio=False)
                self.ad7175 = self.ip.ad717x
            else:
                self.ip = ipcore
                self.ad7175 = self.ip.ad717x
        elif ad7175:
            if isinstance(ad7175, basestring):
                axi4_bus = AXI4LiteBus(ad7175, MimicDef.AD7175_REG_SIZE)
                self.ad7175 = MIXAd7175SG(
                    axi4_bus, mvref=MimicDef.ADC_VREF_VOLTAGE_5000mV)
            else:
                self.ad7175 = ad7175
        else:
            raise MimicException("Invalid parameter, please check")

        self.ad7175.config = {
            'ch0': {
                'P': 'AIN0',
                'N': 'AIN1'
            },
            'ch1': {
                'P': 'AIN2',
                'N': 'AIN3'
            }
        }
        self.measure_path = dict()

        super(MimicBase, self).__init__(self.eeprom,
                                        self.sensor,
                                        range_table=range_table)

        self.function_info = mimic_function_info
        self.module_calibration_info = range_table
Exemplo n.º 9
0
    def __init__(self, i2c, ad7175=None, range_ctrl_pin=None,
                 meter_ctrl_pin=None, ipcore=None):

        if ad7175 and range_ctrl_pin and meter_ctrl_pin and not ipcore:
            if isinstance(ad7175, basestring):
                axi4 = AXI4LiteBus(ad7175, WolverineDef.PLAD7175_REG_SIZE)
                self.ad7175 = MIXAd7175SG(axi4, mvref=WolverineDef.MVREF, code_polar=WolverineDef.POLAR,
                                          clock=WolverineDef.CLOCK)
            else:
                self.ad7175 = ad7175
            self.range_ctrl_pin = range_ctrl_pin
            self.meter_ctrl_pin = meter_ctrl_pin
        elif not ad7175 and not range_ctrl_pin and not meter_ctrl_pin and ipcore:
            if isinstance(ipcore, basestring):
                axi4_bus = AXI4LiteBus(ipcore, WolverineDef.MIX_DAQT1_REG_SIZE)
                self.ipcore = MIXDAQT1SGR(axi4_bus, 'AD7175', ad717x_mvref=WolverineDef.MVREF,
                                          code_polar=WolverineDef.POLAR, clock=WolverineDef.CLOCK, use_gpio=True)
            else:
                self.ipcore = ipcore
            self.ad7175 = self.ipcore.ad717x
            gpio = self.ipcore.gpio
            self.range_ctrl_pin = Pin(gpio, WolverineDef.RANGE_SEL_BIT)
            self.meter_ctrl_pin = Pin(gpio, WolverineDef.METER_SEL_BIT)
            self.tag_pins = [
                Pin(gpio, WolverineDef.TAG_BASE_PIN + x,
                    WolverineDef.GPIO_OUTPUT_DIR) for x in range(4)
            ]
        elif not ad7175 and range_ctrl_pin and meter_ctrl_pin and ipcore:
            if isinstance(ipcore, basestring):
                axi4_bus = AXI4LiteBus(ipcore, WolverineDef.MIX_DAQT1_REG_SIZE)
                self.ipcore = MIXDAQT1SGR(axi4_bus, 'AD7175', ad717x_mvref=WolverineDef.MVREF,
                                          code_polar=WolverineDef.POLAR, clock=WolverineDef.CLOCK, use_gpio=True)
            else:
                self.ipcore = ipcore
            self.ad7175 = self.ipcore.ad717x
            self.range_ctrl_pin = range_ctrl_pin
            self.meter_ctrl_pin = meter_ctrl_pin
            gpio = self.ipcore.gpio
            self.tag_pins = [
                Pin(gpio, WolverineDef.TAG_BASE_PIN + x,
                    WolverineDef.GPIO_OUTPUT_DIR) for x in range(4)
            ]
        else:
            raise WolverineException("Invalid parameter, please check")

        eeprom = CAT24C32(WolverineDef.EEPROM_DEV_ADDR, i2c)
        nct75 = NCT75(WolverineDef.NCT75_DEV_ADDR, i2c)
        super(Wolverine, self).__init__(eeprom, nct75, range_table=wolverine_range_table)

        self.channel_path = {'range_sel_bit': self.range_ctrl_pin, 'meter_sel_bit': self.meter_ctrl_pin}
        self.measure_path = dict()
        self.measure_path['range'] = WolverineDef.VOLT_5V
Exemplo n.º 10
0
def create_wolverine_dbg(ad7175_bus_name, vref, i2c_bus0_name, i2c_bus1_name,
                         i2c_dev_addr1, range_sel_bit, meter_sel_bit,
                         ip_dev_name):

    if ad7175_bus_name == '':
        ad7175 = None
    else:
        axi4_bus = AXI4LiteBus(ad7175_bus_name, 8192)
        ad7175 = MIXAd7175SG(axi4_bus, vref)
    if i2c_bus0_name == '':
        i2c_bus0 = None
    else:
        if utility.is_pl_device(i2c_bus0_name):
            axi4_bus = AXI4LiteBus(i2c_bus0_name, 256)
            i2c_bus0 = MIXI2CSG(axi4_bus)
        else:
            i2c_bus0 = I2C(i2c_bus0_name)

    if i2c_bus1_name == '':
        cat9555 = None
    else:
        if utility.is_pl_device(i2c_bus1_name):
            axi4_bus = AXI4LiteBus(i2c_bus1_name, 256)
            i2c_bus1 = MIXI2CSG(axi4_bus)
        else:
            i2c_bus1 = I2C(i2c_bus1_name)
        cat9555 = CAT9555(i2c_dev_addr1, i2c_bus1)

    if ip_dev_name == '':
        ipcore = None
    else:
        axi4_bus = AXI4LiteBus(ip_dev_name, 0x8000)
        ipcore = MIXDAQT1SGR(axi4_bus,
                             ad717x_chip='AD7175',
                             use_spi=False,
                             use_gpio=True)

    if range_sel_bit == '':
        range_sel_bit = None
    else:
        range_sel_bit = int(range_sel_bit)

    if meter_sel_bit == '':
        meter_sel_bit = None
    else:
        meter_sel_bit = int(meter_sel_bit)

    wolverine_dbg = WolverineDebugger(
        Wolverine(i2c_bus0, ad7175, Pin(cat9555, range_sel_bit),
                  Pin(cat9555, meter_sel_bit), ipcore))
    return wolverine_dbg
Exemplo n.º 11
0
    def __init__(self, i2c, ad7175=None, ipcore=None):

        self.eeprom = CAT24C32(Scope002006Def.EEPROM_DEV_ADDR, i2c)
        self.sensor = NCT75(Scope002006Def.SENSOR_DEV_ADDR, i2c)

        if ipcore:
            if isinstance(ipcore, basestring):
                axi4_bus = AXI4LiteBus(ipcore,
                                       Scope002006Def.MIX_DAQT1_REG_SIZE)
                ipcore = MIXDAQT1SGR(
                    axi4_bus,
                    'AD7175',
                    ad717x_mvref=Scope002006Def.AD7175_MVREF,
                    code_polar=Scope002006Def.AD7175_CODE_POLAR,
                    reference=Scope002006Def.AD7175_REFERENCE_SOURCE,
                    buffer_flag=Scope002006Def.AD7175_BUFFER_FLAG,
                    clock=Scope002006Def.AD7175_CLOCK,
                    use_spi=False,
                    use_gpio=True)
            ipcore.ad717x.config = {"ch0": {"P": "AIN0", "N": "AIN1"}}
            self.ad7175 = ipcore.ad717x
            self.gpio = ipcore.gpio
            self.tag_pins = [
                Pin(self.gpio, Scope002006Def.TAG_BASE_PIN + x,
                    Scope002006Def.GPIO_OUTPUT_DIR) for x in xrange(4)
            ]
        elif ad7175:
            if isinstance(ad7175, basestring):
                axi4_bus = AXI4LiteBus(ad7175, Scope002006Def.AD7175_REG_SIZE)
                ad7175 = MIXAd7175SG(
                    axi4_bus,
                    mvref=Scope002006Def.AD7175_MVREF,
                    code_polar=Scope002006Def.AD7175_CODE_POLAR,
                    reference=Scope002006Def.AD7175_REFERENCE_SOURCE,
                    buffer_flag=Scope002006Def.AD7175_BUFFER_FLAG,
                    clock=Scope002006Def.AD7175_CLOCK)

            ad7175.config = {"ch0": {"P": "AIN0", "N": "AIN1"}}
            self.ad7175 = ad7175
        else:
            raise Scope002006Exception('Use one of aggregated IP or AD717X')

        super(Scope002006, self).__init__(self.eeprom,
                                          self.sensor,
                                          range_table=scope002006_range_table)
Exemplo n.º 12
0
    def __init__(self, ad7175=None, i2c=None, ipcore=None):
        if ipcore and ad7175:
            raise Dmm010Exception('Not allowed to use both aggregated IP and AD717X')

        if i2c:
            self.tca9538 = TCA9538(DMM010Def.TAC9538_I2C_ADDR, i2c)
            self.eeprom = CAT24C32(DMM010Def.CAT24C32_I2C_ADDR, i2c)
            self.sensor = NCT75(DMM010Def.NCT75_I2C_ADDR, i2c)
        else:
            self.tca9538 = TCA9538Emulator(DMM010Def.TAC9538_I2C_ADDR)
            self.eeprom = EepromEmulator("eeprom_emulator")
            self.sensor = NCT75Emulator("nct75_emulator")

        if ipcore:
            if isinstance(ipcore, basestring):
                axi4_bus = AXI4LiteBus(ipcore, DMM010Def.MIX_DAQT1_REG_SIZE)
                ipcore = MIXDAQT1SGR(axi4_bus, "AD7175", ad717x_mvref=DMM010Def.ADC_VREF_VOLTAGE_5000mV,
                                     code_polar=DMM010Def.AD7175_CODE_POLAR,
                                     reference=DMM010Def.AD7175_REFERENCE_SOURCE,
                                     buffer_flag=DMM010Def.AD7175_BUFFER_FLAG,
                                     clock=DMM010Def.AD7175_CLOCK,
                                     use_spi=False, use_gpio=False)
            self.ad7175 = ipcore.ad717x
        elif ad7175:
            if isinstance(ad7175, basestring):
                axi4_bus = AXI4LiteBus(ad7175, DMM010Def.PLAD7175_REG_SIZE)
                ad7175 = MIXAd7175SG(axi4_bus, mvref=DMM010Def.ADC_VREF_VOLTAGE_5000mV,
                                     code_polar=DMM010Def.AD7175_CODE_POLAR,
                                     reference=DMM010Def.AD7175_REFERENCE_SOURCE,
                                     buffer_flag=DMM010Def.AD7175_BUFFER_FLAG,
                                     clock=DMM010Def.AD7175_CLOCK)
            self.ad7175 = ad7175
        else:
            self.ad7175 = MIXAd7175SGEmulator('ad7175_emulator', DMM010Def.ADC_VREF_VOLTAGE_5000mV)

        self.ad7175.config = {
            "ch0": {"P": "AIN0", "N": "AIN1"},
            "ch1": {"P": "AIN2", "N": "AIN3"}
        }

        super(DMM010001, self).__init__(self.eeprom, self.sensor, cal_table=dmm010_calibration_info,
                                        range_table=dmm010_range_table)
        self.continuous_sample_channel = None
        self.measure_path = None
Exemplo n.º 13
0
def create_elektra_dbg(i2c_name, spi_name, ad717x_name, gpio_id, ipcore_name):
    scope_dbg = ElektraDebuger()
    if i2c_name == '':
        i2c_bus = None
    else:
        if utility.is_pl_device(i2c_name):
            axi4_bus = AXI4LiteBus(i2c_name, 256)
            i2c_bus = MIXI2CSG(axi4_bus)
        else:
            i2c_bus = I2C(i2c_name)

    if spi_name == '':
        spi_bus = None
    else:
        axi4_bus = AXI4LiteBus(spi_name, 8192)
        spi_bus = MIXQSPISG(axi4_bus)

    ipcore = None
    ad7175 = None
    vref = 5000
    if ipcore_name != '':
        axi4_bus = AXI4LiteBus(ipcore_name, 9548)
        ipcore = MIXDAQT1SGR(axi4_bus,
                             ad717x_mvref=vref,
                             use_spi=True,
                             use_gpio=False)
    elif ad717x_name != '':
        axi4_bus = AXI4LiteBus(ad717x_name, 256)
        ad7175 = MIXAd7175SG(axi4_bus, vref)

    if gpio_id == '':
        gpio_bus = None
    else:
        io = GPIO(gpio_id, "output")
        gpio_bus = Pin(io, gpio_id, "output")

    scope_dbg.elektra = EL004002A(i2c=i2c_bus,
                                  spi=spi_bus,
                                  ad7175=ad7175,
                                  gpio=gpio_bus,
                                  ipcore=ipcore)
    return scope_dbg
Exemplo n.º 14
0
def create_psu_dbg(i2c_ext, i2c_power, ad7175_bus_name, ipcore,
                   i2c_ext_use_tca9548_ch, i2c_power_use_tca9548_ch,
                   tca9548_addr):
    psu_dbg = OdinDebuger()
    daqt1 = None
    ad7175 = None
    if ipcore != '':
        axi4_bus = AXI4LiteBus(ipcore, 9548)
        daqt1 = MIXDAQT1SGR(axi4_bus,
                            ad717x_mvref=2500,
                            use_spi=False,
                            use_gpio=False)
    elif ad7175_bus_name != '':
        axi4_bus = AXI4LiteBus(ad7175_bus_name, 256)
        ad7175 = MIXAd7175SG(axi4_bus, 2500)

    if i2c_ext != '':
        if 'AXI4' in i2c_ext or 'MIX' in i2c_ext:
            axi4_bus = AXI4LiteBus(i2c_ext, 256)
            i2c_bus_ext = MIXI2CSG(axi4_bus)
        else:
            i2c_bus_ext = I2C(i2c_ext)

    if i2c_power != '':
        if 'AXI4' in i2c_power or 'MIX' in i2c_power:
            axi4_bus = AXI4LiteBus(i2c_power, 256)
            i2c_bus_power = MIXI2CSG(axi4_bus)
        else:
            i2c_bus_power = I2C(i2c_power)

    if i2c_ext_use_tca9548_ch != '' or i2c_power_use_tca9548_ch != '':
        tca9548_i2c = TCA9548(int(tca9548_addr), i2c_bus_ext)
        if i2c_ext_use_tca9548_ch != '':
            i2c_bus_ext = I2CDownstreamBus(tca9548_i2c,
                                           int(i2c_ext_use_tca9548_ch))
        if i2c_power_use_tca9548_ch != '':
            i2c_bus_power = I2CDownstreamBus(tca9548_i2c,
                                             int(i2c_power_use_tca9548_ch))

    psu_dbg.psu = Odin(i2c_bus_ext, i2c_bus_power, ad7175, daqt1)
    psu_dbg.psu.module_init()
    return psu_dbg
Exemplo n.º 15
0
    def __init__(self, i2c, ad7175=None, ipcore=None):

        if ipcore:
            if isinstance(ipcore, basestring):
                axi4_bus = AXI4LiteBus(ipcore,
                                       Scope002006Def.MIX_DAQT1_REG_SIZE)
                ipcore = MIXDAQT1SGR(
                    axi4_bus,
                    'AD7175',
                    ad717x_mvref=Scope002006Def.AD7175_MVREF,
                    code_polar=Scope002006Def.AD7175_CODE_POLAR,
                    reference=Scope002006Def.AD7175_REFERENCE_SOURCE,
                    buffer_flag=Scope002006Def.AD7175_BUFFER_FLAG,
                    clock=Scope002006Def.AD7175_CLOCK,
                    use_spi=False,
                    use_gpio=False)
            ipcore.ad717x.config = {"ch0": {"P": "AIN0", "N": "AIN1"}}
            self.ad7175 = ipcore.ad717x
        elif ad7175:
            if isinstance(ad7175, basestring):
                axi4_bus = AXI4LiteBus(ad7175, Scope002006Def.AD7175_REG_SIZE)
                ad7175 = MIXAd7175SG(
                    axi4_bus,
                    mvref=Scope002006Def.AD7175_MVREF,
                    code_polar=Scope002006Def.AD7175_CODE_POLAR,
                    reference=Scope002006Def.AD7175_REFERENCE_SOURCE,
                    buffer_flag=Scope002006Def.AD7175_BUFFER_FLAG,
                    clock=Scope002006Def.AD7175_CLOCK)

            ad7175.config = {"ch0": {"P": "AIN0", "N": "AIN1"}}
            self.ad7175 = ad7175
        else:
            ad7175 = MIXAd7175SGEmulator('ad7175_emulator', 2500)
            ad7175.config = {"ch0": {"P": "AIN0", "N": "AIN1"}}

            self.ad7175 = ad7175

        super(Scope002006, self).__init__(i2c, ad7175, ipcore,
                                          Scope002006Def.EEPROM_DEV_ADDR,
                                          Scope002006Def.SENSOR_DEV_ADDR,
                                          scope002006_calibration_info,
                                          scope002006_range_table)
Exemplo n.º 16
0
def create_dagger_dbg(ip_name, i2c_name, ad717x_name):
    dagger_dbg = None
    if utility.is_pl_device(i2c_name):
        axi4_bus = AXI4LiteBus(i2c_name, 256)
        i2c = MIXI2CSG(axi4_bus)
    else:
        i2c = I2C(i2c_name)

    if ip_name == '':
        axi4_bus = AXI4LiteBus(ad717x_name, 0x8000)
        ad717x = MIXAd7175SG(axi4_bus, 5000)
        dagger_dbg = DaggerDebugger(Dagger(i2c, ad717x))
    else:
        axi4_bus = AXI4LiteBus(ip_name, 256)
        mix_daqt1 = MIXDAQT1SGR(axi4_bus,
                                ad717x_mvref=5000,
                                use_spi=False,
                                use_gpio=False)
        dagger_dbg = DaggerDebugger(Dagger(i2c, ipcore=mix_daqt1))
    return dagger_dbg
Exemplo n.º 17
0
def create_hppsu001002_dbg(i2c_bus_name, axi4_bus_name, gpio_device_name,
                           fault_pin_id):
    hppsu001002_dbg = HPPSU001002Debugger()
    if i2c_bus_name == '':
        i2c_bus = None
    else:
        i2c_bus = I2C(i2c_bus_name)

    if gpio_device_name == '':
        fault_pin = GPIO(int(fault_pin_id))
    else:
        axi4_bus = AXI4LiteBus(gpio_device_name, 256)
        gpio = PLGPIO(axi4_bus)
        fault_pin = Pin(gpio, int(fault_pin_id))

    if axi4_bus_name == '':
        daqt1 = MIXDAQT1Emulator(axi4_bus=None,
                                 ad717x_chip='AD7175',
                                 ad717x_mvref=5000,
                                 use_spi=False,
                                 use_gpio=False)
        ad7175 = None
    elif 'MIX_DAQT' in axi4_bus_name or 'MIX_AD717X_SG' in axi4_bus_name:
        daqt1_axi4_bus = AXI4LiteBus(axi4_bus_name, 65535)
        daqt1 = MIXDAQT1SGR(axi4_bus=daqt1_axi4_bus,
                            ad717x_chip='AD7175',
                            ad717x_mvref=5000,
                            use_spi=False,
                            use_gpio=False)
        ad7175 = None
    else:
        daqt1 = None
        ad717x_axi4_bus = AXI4LiteBus(axi4_bus_name, 0x4000)
        ad7175 = MIXAd7175SG(ad717x_axi4_bus, 5000)

    hppsu001002_dbg.hppsu = HPPSU001002(i2c=i2c_bus,
                                        ad7175=ad7175,
                                        fault_pin=fault_pin,
                                        ipcore=daqt1)
    hppsu001002_dbg.hppsu.module_init()
    return hppsu001002_dbg
Exemplo n.º 18
0
def create_scope_dbg(axi4_bus_name, i2c_bus_name):
    scope_dbg = Scope002006Debuger()

    if axi4_bus_name == '':
        daqt1 = MIXDAQT1SGREmulator(axi4_bus=None,
                                    ad717x_chip='AD7175',
                                    ad717x_mvref=2500,
                                    use_spi=False,
                                    use_gpio=False)
        ad7175 = None
    elif 'MIX_Scope' in axi4_bus_name:
        daqt1_axi4_bus = AXI4LiteBus(axi4_bus_name, 0x8000)
        daqt1 = MIXDAQT1SGR(axi4_bus=daqt1_axi4_bus,
                            ad717x_chip='AD7175',
                            ad717x_mvref=2500,
                            use_spi=False,
                            use_gpio=False)
        ad7175 = None
    elif 'MIX_DAQT' in axi4_bus_name:
        daqt1_axi4_bus = AXI4LiteBus(axi4_bus_name, 0x8000)
        daqt1 = MIXDAQT1SGR(axi4_bus=daqt1_axi4_bus,
                            ad717x_chip='AD7175',
                            ad717x_mvref=2500,
                            use_spi=False,
                            use_gpio=False)
        ad7175 = None
    else:
        daqt1 = None
        ad717x_axi4_bus = AXI4LiteBus(axi4_bus_name, 0x8192)
        ad7175 = MIXAd7175SG(ad717x_axi4_bus, 2500)

    if i2c_bus_name == '':
        i2c_bus = None
    else:
        i2c_bus = I2C(i2c_bus_name)

    scope_dbg.scope002006 = Scope002006(i2c=i2c_bus,
                                        ad7175=ad7175,
                                        ipcore=daqt1)
    return scope_dbg
Exemplo n.º 19
0
    def open(self, use_spi, use_gpio):
        '''
        MIXPSU001SGR open device

        Examples:
            psu001.open()

        '''

        # AD717x will be created.
        self.ad717x_axi4_bus = AXI4LiteSubBus(
            self.axi4_bus, MIXPSU001SGRDef.MIX_AD717X_IPCORE_ADDR,
            MIXPSU001SGRDef.AD717X_REG_SIZE)

        if self.ad717x_chip == "AD7175":
            self.ad717x = MIXAd7175SG(self.ad717x_axi4_bus, self.ad717x_mvref,
                                      self.code_polar, self.reference,
                                      self.buffer_flag, self.clock)
        elif self.ad717x_chip == "AD7177":
            self.ad717x = MIXAd7177SG(self.ad717x_axi4_bus, self.ad717x_mvref,
                                      self.code_polar, self.reference,
                                      self.buffer_flag, self.clock)
        else:
            raise MIXPSU001SGRException("Unsupported AD717x chip type %s." %
                                        (self.ad717x_chip))

        # if use_gpio is True, MIXGPIOSG will be created.
        if use_gpio is True:
            self.gpio_axi4_bus = AXI4LiteSubBus(
                self.axi4_bus, MIXPSU001SGRDef.MIX_GPIO_IPCORE_ADDR,
                MIXPSU001SGRDef.GPIO_REG_SIZE)
            self.gpio = MIXGPIOSG(self.gpio_axi4_bus)
        # if use_spi is True, MIXQSPISG will be created.
        if use_spi is True:
            self.spi_axi4_bus = AXI4LiteSubBus(
                self.axi4_bus, MIXPSU001SGRDef.MIX_SPI_IPCORE_ADDR,
                MIXPSU001SGRDef.SPI_REG_SIZE)
            self.spi = MIXQSPISG(self.spi_axi4_bus)
Exemplo n.º 20
0
def create_omega_dbg(axi4_bus_name, spi_axi4_bus_name, i2c_bus_name):
    omega = OmegaDebuger()

    if axi4_bus_name == '':
        daqt1 = MIXDAQT1SGREmulator(axi4_bus=None, ad717x_chip='AD7175', ad717x_mvref=5000,
                                    use_spi=True, use_gpio=False)
        ad7175 = None
        spi_bus = None
    elif 'DAQT1' in axi4_bus_name:
        daqt1_axi4_bus = AXI4LiteBus(axi4_bus_name, 0x8000)
        daqt1 = MIXDAQT1SGR(axi4_bus=daqt1_axi4_bus, ad717x_chip='AD7175', ad717x_mvref=5000,
                            use_spi=True, use_gpio=False)
        ad7175 = None
        spi_bus = None
    else:
        daqt1 = None
        ad717x_axi4_bus = AXI4LiteBus(axi4_bus_name, 0x8192)
        ad7175 = MIXAd7175SG(ad717x_axi4_bus, 5000)

        if spi_axi4_bus_name == '':
            spi_bus = None
        else:
            spi_axi4_bus = AXI4LiteBus(spi_axi4_bus_name, 0x8192)
            spi_bus = PLSPIBus(spi_axi4_bus)

    if i2c_bus_name == '':
        i2c_bus = None
    else:
        axi4_bus = AXI4LiteBus(i2c_bus_name, 256)
        i2c_bus = MIXI2CSG(axi4_bus)

    omega.omega = Omega(i2c=i2c_bus,
                        ip=daqt1,
                        ad7175=ad7175,
                        spi=spi_bus)
    return omega
Exemplo n.º 21
0
    def __init__(self,
                 i2c,
                 spi=None,
                 ad7175=None,
                 ipcore=None,
                 eeprom_dev_addr=OmegaDef.EEPROM_DEV_ADDR,
                 sensor_dev_addr=OmegaDef.SENSOR_DEV_ADDR,
                 cat9555_dev_addr=OmegaDef.CAT9555_DEV_ADDR,
                 cal_info=None,
                 range_table=None):

        if ipcore and ad7175:
            raise OmegaException(
                'Not allowed to use both aggregated IP and AD7175 at the same time'
            )
        elif ipcore and spi:
            raise OmegaException(
                'Not allowed to use both aggregated IP and MIXQSPI at the same time'
            )

        if i2c:
            self.eeprom = CAT24C32(eeprom_dev_addr, i2c)
            self.sensor = NCT75(sensor_dev_addr, i2c)
            self.cat9555 = CAT9555(cat9555_dev_addr, i2c)
        else:
            self.eeprom = EepromEmulator("eeprom_emulator")
            self.sensor = NCT75Emulator("nct75_emulator")
            self.cat9555 = CAT9555Emulator(cat9555_dev_addr, None, None)

        if ipcore is None:
            if isinstance(ad7175, basestring):
                ad717x_axi4_bus = AXI4LiteBus(ad7175,
                                              OmegaDef.PLAD7175_REG_SIZE)
                ad7175 = MIXAd7175SG(ad717x_axi4_bus,
                                     OmegaDef.ADC_VREF_VOLTAGE_5000mV)
            elif ad7175:
                self.ad7175 = ad7175
            else:
                self.ad7175 = MIXAd7175SGEmulator(
                    "mix_ad7175_sg_emulator", OmegaDef.ADC_VREF_VOLTAGE_5000mV)

            self.spi = spi or PLSPIBusEmulator('spi_emulator',
                                               OmegaDef.SPI_REG_SIZE)
            self.ad9832 = AD9832(
                self.spi) if self.spi is not None else AD9832Emulator(
                    "ad9832_emulator")
        else:
            if isinstance(ipcore, basestring):
                daqt1_axi4_bus = AXI4LiteBus(ipcore,
                                             OmegaDef.MIXDAQT1_REG_SIZE)
                ipcore = MIXDAQT1SGR(
                    axi4_bus=daqt1_axi4_bus,
                    ad717x_chip='AD7175',
                    ad717x_mvref=OmegaDef.ADC_VREF_VOLTAGE_5000mV,
                    use_spi=True,
                    use_gpio=False)

            self.ipcore = ipcore
            self.spi = self.ipcore.spi
            self.ad7175 = self.ipcore.ad717x
            self.ad9832 = AD9832(
                self.spi) if self.spi is not None else AD9832Emulator(
                    "ad9832_emulator")

        self.line_select = None
        self.ad7175.config = {
            "ch0": {
                "P": "AIN0",
                "N": "AIN1"
            },
            "ch1": {
                "P": "AIN2",
                "N": "AIN3"
            }
        }

        super(OmegaBase, self).__init__(self.eeprom,
                                        self.sensor,
                                        cal_table=cal_info,
                                        range_table=range_table)

        # RMS Voltage of DDS Output wave during board initialization
        self.dds_value_dict = {
            '20Hz': None,
            '100Hz': None,
            '200Hz': None,
            '1kHz': None,
            '10kHz': None,
            '30kHz': None,
            '100kHz': None,
        }

        self.omega_line_select = omega_line_select
        # calibration info
        self.omega_calibration_info = omega_calibration_info
Exemplo n.º 22
0
    def __init__(self,
                 axi4_bus=None,
                 fft_data_cnt=None,
                 ad717x_chip="ad7175",
                 ad717x_mvref=5000,
                 code_polar="bipolar",
                 reference="extern",
                 buffer_flag="enable",
                 clock="crystal"):
        if isinstance(axi4_bus, basestring):
            # device path; create axi4lite instance
            self.axi4_bus = AXI4LiteBus(axi4_bus, MIXAUT5SGRDef.REG_SIZE)
        else:
            self.axi4_bus = axi4_bus

        if self.axi4_bus is None:
            self.analyzer = MIXFftAnalyzerSGEmulator(
                'mix_fftanalyzer_sg_emulator')
            self.signal_source = MIXSignalSourceSGEmulator(
                "mix_signalsource_sg_emulator")
            self.gpio = MIXGPIOSGEmulator("mix_gpio_sg_emulator", 256)
            if ad717x_chip == 'ad7175':
                self.ad717x = MIXAd7175SGEmulator("mix_ad7175_sg_emulator",
                                                  2500)
            else:
                self.ad717x = MIXAd7177SGEmulator("mix_ad7177_sg_emulator",
                                                  2500)
        else:
            self.fft_analyzer_axi4_bus = AXI4LiteSubBus(
                self.axi4_bus, MIXAUT5SGRDef.MIX_FFT_ANAYLZER_IPCORE_ADDR,
                MIXAUT5SGRDef.MIX_FFT_REG_SIZE)
            self.analyzer = MIXFftAnalyzerSG(self.fft_analyzer_axi4_bus,
                                             fft_data_cnt)

            self.signal_source_axi4_bus = AXI4LiteSubBus(
                self.axi4_bus, MIXAUT5SGRDef.MIX_SIGNAL_SOURCE_IPCORE_ADDR,
                MIXAUT5SGRDef.MIX_SIGNAL_SOURCE_REG_SIZE)
            self.signal_source = MIXSignalSourceSG(self.signal_source_axi4_bus)

            self.gpio_axi4_bus = AXI4LiteSubBus(
                self.axi4_bus, MIXAUT5SGRDef.MIX_GPIO_IPCORE_ADDR,
                MIXAUT5SGRDef.MIX_GPIO_REG_SIZE)

            self.gpio = MIXGPIOSG(self.gpio_axi4_bus)

            self.ad717x_chip = ad717x_chip
            self.ad717x_mvref = ad717x_mvref
            self.code_polar = code_polar
            self.reference = reference
            self.buffer_flag = buffer_flag
            self.clock = clock

            # self.open()
            self.ad717x_axi4_bus = AXI4LiteSubBus(
                self.axi4_bus, MIXAUT5SGRDef.MIX_AD717X_IPCORE_ADDR,
                MIXAUT5SGRDef.AD717X_REG_SIZE)

            if self.ad717x_chip == "ad7175":
                self.ad717x = MIXAd7175SG(self.ad717x_axi4_bus,
                                          self.ad717x_mvref, self.code_polar,
                                          self.reference, self.buffer_flag,
                                          self.clock)
            elif self.ad717x_chip == "ad7177":
                self.ad717x = MIXAd7177SG(self.ad717x_axi4_bus,
                                          self.ad717x_mvref, self.code_polar,
                                          self.reference, self.buffer_flag,
                                          self.clock)
            else:
                raise MIXDAQT5Exception("Unsupported AD717x chip type %s." %
                                        (self.ad717x_chip))
Exemplo n.º 23
0
    def __init__(self,
                 i2c,
                 ad7175=None,
                 range_sel=None,
                 meter_sel=None,
                 ipcore=None):

        if i2c and ad7175 and range_sel and meter_sel and not ipcore:
            if isinstance(ad7175, basestring):
                axi4 = AXI4LiteBus(ad7175, WolverineDef.PLAD7175_REG_SIZE)
                self.ad7175 = MIXAd7175SG(axi4,
                                          mvref=WolverineDef.MVREF,
                                          code_polar=WolverineDef.POLAR,
                                          clock=WolverineDef.CLOCK)
            else:
                self.ad7175 = ad7175
            self.range_sel = range_sel
            self.meter_sel = meter_sel
        elif i2c and not ad7175 and not range_sel and not meter_sel and ipcore:
            if isinstance(ipcore, basestring):
                axi4_bus = AXI4LiteBus(ipcore, WolverineDef.MIX_DAQT1_REG_SIZE)
                self.ipcore = MIXDAQT1SGR(axi4_bus,
                                          'AD7175',
                                          ad717x_mvref=WolverineDef.MVREF,
                                          code_polar=WolverineDef.POLAR,
                                          clock=WolverineDef.CLOCK,
                                          use_gpio=True)
            else:
                self.ipcore = ipcore
            self.ad7175 = self.ipcore.ad717x
            gpio = self.ipcore.gpio
            self.range_sel = Pin(gpio, WolverineDef.RANGE_SEL_BIT)
            self.meter_sel = Pin(gpio, WolverineDef.METER_SEL_BIT)
        elif i2c and not ad7175 and range_sel and meter_sel and ipcore:
            if isinstance(ipcore, basestring):
                axi4_bus = AXI4LiteBus(ipcore, WolverineDef.REG_SIZE)
                self.ipcore = MIXDAQT1SGR(axi4_bus,
                                          'AD7175',
                                          ad717x_mvref=WolverineDef.MVREF,
                                          code_polar=WolverineDef.POLAR,
                                          clock=WolverineDef.CLOCK,
                                          use_gpio=False)
            else:
                self.ipcore = ipcore
            self.ad7175 = self.ipcore.ad717x
            self.range_sel = range_sel
            self.meter_sel = meter_sel
        elif not i2c and not ad7175 and not range_sel and not meter_sel and not ipcore:
            self.ad7175 = MIXAd7175SGEmulator("ad7175_emulator",
                                              WolverineDef.EMULATOR_REG_SIZE)
            self.range_sel = Pin(None, WolverineDef.RANGE_SEL_BIT)
            self.meter_sel = Pin(None, WolverineDef.METER_SEL_BIT)
        else:
            raise WolverineException("Invalid parameter, please check")
        if i2c:
            eeprom = CAT24C32(WolverineDef.EEPROM_DEV_ADDR, i2c)
            nct75 = NCT75(WolverineDef.NCT75_DEV_ADDR, i2c)
            super(Wolverine,
                  self).__init__(eeprom,
                                 nct75,
                                 cal_table=wolverine_calibration_info,
                                 range_table=wolverine_range_table)
        else:
            super(Wolverine,
                  self).__init__(None,
                                 None,
                                 cal_table=wolverine_calibration_info,
                                 range_table=wolverine_range_table)

        self.channel_path = {
            'range_sel_bit': self.range_sel,
            'meter_sel_bit': self.meter_sel
        }
        self.measure_path = {"channel": None, "range": None}
Exemplo n.º 24
0
    def __init__(self,
                 i2c=None,
                 spi=None,
                 ad7175=None,
                 gpio=None,
                 ipcore=None):

        if (ipcore and i2c):
            if isinstance(ipcore, basestring):
                daqt1_axi4_bus = AXI4LiteBus(ipcore,
                                             EL004002ADef.MIXDAQT1_REG_SIZE)
                self.ipcore = MIXDAQT1SGR(
                    axi4_bus=daqt1_axi4_bus,
                    ad717x_chip='AD7175',
                    ad717x_mvref=EL004002ADef.ADC_VREF_VOLTAGE_5000mV,
                    use_spi=True,
                    use_gpio=False)
            else:
                self.ipcore = ipcore

            super(EL004002A,
                  self).__init__(i2c=i2c,
                                 spi=None,
                                 blade=None,
                                 gpio=None,
                                 volt_ch1=EL004002ADef.VLOT_CH1,
                                 volt_ch2=EL004002ADef.VLOT_CH2,
                                 curr_ch1=EL004002ADef.CURR_CH1,
                                 curr_ch2=EL004002ADef.CURR_CH2,
                                 eeprom_dev_addr=ElektraDef.EEPROM_DEV_ADDR,
                                 sensor_dev_addr=ElektraDef.SENSOR_DEV_ADDR,
                                 ipcore=self.ipcore,
                                 cat9555_dev_addr=ElektraDef.CAT9555_ADDR,
                                 range_table=elektra_range_table)
        elif (ad7175 and i2c and spi and gpio):
            if isinstance(ad7175, basestring):
                axi4_bus = AXI4LiteBus(ad7175, EL004002ADef.AD7175_REG_SIZE)
                self.ad7175 = MIXAd7175SG(
                    axi4_bus, mvref=EL004002ADef.ADC_VREF_VOLTAGE_5000mV)
            else:
                self.ad7175 = ad7175

            super(EL004002A,
                  self).__init__(i2c=i2c,
                                 spi=spi,
                                 blade=None,
                                 gpio=gpio,
                                 volt_ch1=EL004002ADef.VLOT_CH1,
                                 volt_ch2=EL004002ADef.VLOT_CH2,
                                 curr_ch1=EL004002ADef.CURR_CH1,
                                 curr_ch2=EL004002ADef.CURR_CH2,
                                 eeprom_dev_addr=ElektraDef.EEPROM_DEV_ADDR,
                                 sensor_dev_addr=ElektraDef.SENSOR_DEV_ADDR,
                                 ipcore=None,
                                 cat9555_dev_addr=ElektraDef.CAT9555_ADDR,
                                 range_table=elektra_range_table)
        else:
            raise ElektraException(
                '__init__ error! Please check the parameters!')

        self.ad7175.config = {
            "ch0": {
                "P": "AIN0",
                "N": "AIN4"
            },
            "ch1": {
                "P": "AIN1",
                "N": "AIN4"
            },
            "ch2": {
                "P": "AIN2",
                "N": "AIN4"
            },
            "ch3": {
                "P": "AIN3",
                "N": "AIN4"
            }
        }

        self.spi.set_mode('MODE2')