This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DAC63004WCSP-EVM: GUI initialization Error,

Part Number: DAC63004WCSP-EVM


Tool/software:

Hello,

I am getting the following error when attempting to run the DAC 63004WCSP-EVM GUI.

I have tried uninstalling/reinstalling the GUI. I have also tried downloading Labview Runtime straight from NI. The FTDI drivers are also in place. 

Any guidance on how to fix this issue?

 

Thank you,

Daniel

  • Hi Daniel, 

    Do you see both of these dll files in the install directory? 

    Outside of the steps you have already followed, we've had trouble debugging this issue with users. It seems like some company firewalls or file permissions prevent the GUI from installing correctly, or accessing certain files/directories once installed. Is it possible to try installing with firewalls disabled? 

    We have python examples that use the same set of FTDI drivers that will work with the EVM if you would like to try those instead of the GUI. 

    Best,

    Katlynne 

  • Hi Katlynne,

    Python would be an excellent solution. Where can I find those examples?

    -Daniel

  • Hi Daniel, 

    Try these. Your computer needs to be able to import ft4222 python library, or pre install it. 

    Best,

    Katlynne Jones

  • ft4222 library successfully imported. Did you mean to attach some example scripts or just point me to the documentation?

    Thanks,

    Daniel

  • My mistake, I meant to attach these two files. 

    from FTDI_SMARTDAC import *
    
    if __name__ == '__main__':
        ftdiObject = FtdiController()
        ftdiObject.getFtdiDeviceInfo()
    
        # I2C Communication Initialisation
        ftdiObject.initializeI2C(speed=100)  # Valid speed between 60K bps to 3400K bps (100K bps set)
    
        # Register writes for Programmable Latching comparator
        ftdiObject.i2cWrite(deviceAddress=0x48, regAddr=0xD1, regData=0x0000) # Powering up device output with VDD as reference
        ftdiObject.i2cWrite(deviceAddress=0x48, regAddr=0xD2, regData=0x0800) # Configures the GPI pin as Margin-High, Low trigger
        ftdiObject.i2cWrite(deviceAddress=0x48, regAddr=0x21, regData=0x0998) # Configure Channel 2 with DAC DATA
        ftdiObject.i2cWrite(deviceAddress=0x48, regAddr=0xD3, regData=0x0418) # Enables GPI pin, and NMV write initiated
    
        # # Register reads to verify register writes
        # time.sleep(3)  #Wait time for NVM write
        # readback = ftdiObject.i2cRead(deviceAddress=0x48, regAddr=0xD1)
        # print("regAddr", hex(0xD1), "regData", readback)
        # readback = ftdiObject.i2cRead(deviceAddress=0x48, regAddr=0xD2)
        # print("regAddr", hex(0xD2), "regData", readback)
        # readback = ftdiObject.i2cRead(deviceAddress=0x48, regAddr=0x21)
        # print("regAddr", hex(0x21), "regData", readback)
    
        ftdiObject.closeHandle()
    
    """
    User Guide LibFT4222 : http://www.ftdichip.com/Support/Documents/AppNotes/AN_329_User_Guide_for_LibFT4222.pdf
    D2XX Programmer's Guide : https://www.ftdichip.com/Support/Documents/ProgramGuides/D2XX_Programmer's_Guide(FT_000071).pdf
    python library : https://gitlab.com/msrelectronics/python-ft4222/-/tree/master
    """
    #!/bin/env python
    import ft4222
    import enum
    import time
    
    
    class GpioIOConfig(enum.Enum):
        OUTPUT = ft4222.GPIO.Dir.OUTPUT
        INPUT = ft4222.GPIO.Dir.INPUT
    
    
    class GpioPortConfig(enum.Enum):
        GPIO2 = ft4222.GPIO.Port.P2
        GPIO3 = ft4222.GPIO.Port.P3
    
    
    class FtdiController:
        def __init__(self):
            self.availableDevices = []
            self.deviceInstance = None
            self.initializedCommunicationMode = None
    
        def getFtdiDeviceInfo(self):
            """
            Since DCNF0 & DCMF1 pins of FT4222H are grounded for Hadron EVM, we are in Mode 0 (2 USB Interfaces), Refer Page 6 of User Guide.
            FT4222 A : 1 SPI host, SPI target, I2C host, or I2C target device
            FT4222 B : 1 GPIO device
            """
            self.availableDevices.clear()
            noOfDevices = ft4222.createDeviceInfoList()                 # This function builds a device information list and returns the number of D2XX devices connected to the system. The list contains information about both unopen and open devices.
            if noOfDevices == 0:
                raise Exception('No FTDI Devices detected in the system')
            else:
                for i in range(noOfDevices):
                    deviceData = ft4222.getDeviceInfoDetail(i, False)  # Set False to avoid a slow call to createDeviceInfoList.
                    print(deviceData)
                    self.availableDevices.append(deviceData['description'])
                print('Valid Devices : ', self.availableDevices)
    
        def closeHandle(self):
            """
            Closes FTDI device handle
            """
            self.deviceInstance.close()
    
        def dataWriteList(self, number):
            """
            Converts a decimal number into a python list of 8-bit numbers
            255 -> [0, 255]
            288 -> [1, 32]
            :param number: Valid Decimal Number
            :return: List of 8-bit numbers
            """
            strBin = str(bin(number)[2:])
            strBin = '0' * (((len(strBin) + 7) & - 8) - len(strBin)) + strBin
    
            writeList = []
            for i in range(len(strBin) // 8):
                writeList.append(int(strBin[i * 8: (i + 1) * 8], 2))
    
            if len(writeList) < 2:   # We need 2 bytes of data for Hadron
                writeList.insert(0, 0)
    
            return writeList
    
        def initializeI2C(self, speed):
            """
            FT4222 A : 1 SPI master, SPI target, I2C master, or I2C target device
                :param speed: Valid speed between 60K bps to 3400K bps
            """
            usbInterface = b'FT4222 A'
    
            if speed < 60 or speed > 3400:
                raise Exception('Valid speed for I2C is between 60K bps to 3400K bps')
    
            if usbInterface in self.availableDevices:
                self.deviceInstance = ft4222.openByDescription(usbInterface)        # Open a handle to an usb device by description
                self.deviceInstance.i2cMaster_Init(speed)                           # The speed of I2C transmission. It ranges from 60K bps to 3400K bps
                self.initializedCommunicationMode = 'I2C'
            else:
                raise Exception('Cannot initialize I2C Communication, valid device not detected')
    
        def i2cWrite(self, deviceAddress, regAddr, regData):
            """
            Write using I2C
            :param deviceAddress: int
            :param regAddr: int
            :param regData: int
            """
            if self.initializedCommunicationMode == 'I2C':
                dataArray = bytearray([regAddr] + self.dataWriteList(regData))
                self.deviceInstance.i2cMaster_Write(addr=deviceAddress, data=dataArray)
            else:
                raise Exception('Device not initialized for I2C, run initializeI2C() function to initialize, currently initialized mode : ' + self.initializedCommunicationMode)
    
        def i2cRead(self, deviceAddress, regAddr):
            """
            Read using I2C
            :param deviceAddress: int
            :param regAddr: int
            :return: readData : str (hex)
            """
            if self.initializedCommunicationMode == 'I2C':
                self.deviceInstance.i2cMaster_Write(addr=deviceAddress, data=regAddr)
                data = self.deviceInstance.i2cMaster_Read(addr=deviceAddress, bytesToRead=2)
                int_val = int.from_bytes(data, 'big')
                return hex(int_val)
            else:
                raise Exception('Device not initialized for I2C, run initializeI2C() function to initialize, currently initialized mode : ' + self.initializedCommunicationMode)
    
        def initializeGpio(self, gpio2=GpioIOConfig.OUTPUT, gpio3=GpioIOConfig.OUTPUT):
            """
            FT4222 B : 1 GPIO device
            :param gpio2: Use to configure GPIO for input or output, it must be a valid GpioConfig enum
            :param gpio3: Use to configure GPIO for input or output, it must be a valid GpioConfig enum
            """
            usbInterface = b'FT4222 B'
    
            if usbInterface in self.availableDevices:
                if isinstance(gpio2, GpioIOConfig) and isinstance(gpio3, GpioIOConfig):
                    self.deviceInstance = ft4222.openByDescription(usbInterface)        # Open a handle to an usb device by description
                    self.deviceInstance.setSuspendOut(False)                            # use GPIO2 as gpio (not suspend out)
                    self.deviceInstance.setWakeUpInterrupt(False)                       # # use GPIO3 as gpio (not wakeup)
                    self.deviceInstance.gpio_Init(gpio2=gpio2.value, gpio3=gpio3.value)
                    self.initializedCommunicationMode = 'GPIO'
                else:
                    raise Exception('gpio2 and gpio3 parameters must be of GpioIOConfig enum type')
            else:
                raise Exception('Cannot initialize GPIO, valid device not detected')
    
        def writeGpio(self, gpioPort, value):
            """
            Write to the GPIO Ports of FTDI, the GPIO's must be initialized for Output
            :param gpioPort: valid GpioPortConfig enum
            :param value: valid bool value
            """
            if self.initializedCommunicationMode == 'GPIO':
                if isinstance(gpioPort, GpioPortConfig):
                    if isinstance(value, bool):
                        self.deviceInstance.gpio_Write(gpioPort.value, value)
                    else:
                        raise Exception('value parameter must be of bool type')
                else:
                    raise Exception('gpioPort parameter must be of GpioPortConfig enum type')
            else:
                raise Exception('Device not initialized for GPIO, run initializeGpio() function to initialize, currently initialized mode : ' + self.initializedCommunicationMode)
    
        def readGpio(self, gpioPort):
            """
            Read from the GPIO Ports of FTDI, the GPIO's must be initialized for Input
            :param gpioPort: valid GpioPortConfig enum
            """
            if self.initializedCommunicationMode == 'GPIO':
                if isinstance(gpioPort, GpioPortConfig):
                    return self.deviceInstance.gpio_Read(gpioPort.value)
                else:
                    raise Exception('gpioPort parameter must be of GpioPortConfig enum type')
            else:
                raise Exception('Device not initialized for GPIO, run initializeGpio() function to initialize, currently initialized mode : ' + self.initializedCommunicationMode)