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.

USB2ANY: VBA Excel Automation with USB2ANY / LMX2592

Part Number: USB2ANY
Other Parts Discussed in Thread: LMX2592,

We are trying to automate testing of the LMX2592 controlled via the USB2ANY. Our preferred automation is VBA Excel. We tried the ActiveX approach mentioned several places which would be perfect and simple. However, as many others, the communication to the USB2ANY when starting TICS Pro from within Excel VBA using the TI example code with ActiveX, connection cannot be established to the USB2ANY. It blinks 4 rapid blinks on the green LED, then pause, then repeat. Disconnecting and reconnecting is not helpful and only result in errors. Loading TICS Pro manually outside VBA Excel works fine.
I understand the new firmware is moving to TCP based automation, but in the SDK there is only examples for VB, not VBA. Is there any libraries and instructions for how to make this work, preferably as simple as the ActiveX approach. Updated the USB2ANY to latest firmware (2.9.x.). Any help on this would be most appreciated as we are running out of time.

  • Andreas,

    Apologies for leaving you hanging on this question for so long...

    It sounds like you may have some misconceptions about how USB2ANY and TICS Pro are related, so let me clarify: TICS Pro (application) links dynamically to USB2ANY dll of arbitrary version (technically whatever DLL is named "USB2ANY.dll" in the application start directory). Firmware version for USB2ANY is something only USB2ANY dll cares about, does not affect TCP server or ActiveX. The reason TICS Pro application is moving away from ActiveX is because everyone now has 64-bit office/matlab/labview/whatever and can't run 32-bit TICS Pro properly. TICS Pro relies on some Windows USB enumeration utilities that will break in 64-bit mode if not explicitly compiled for it - COM interop utilities will only get you so far it seems. Meanwhile, if we built an x64 TICS Pro, we can't call x86 USB2ANY functions because USB2ANY.dll does not expose any COM interface. The whole point of TCP server change is to give 64-bit applications a way to talk to 32-bit TICS Pro without running into a ton of bugs.

    On the other hand, in 32-bit excel we might have a different issue: Can you try copying the USB2ANY DLL included with TICS Pro into the directory where you launch the excel file from? I think ActiveX changes the application start directory, which may be preventing the USB2ANY DLL from getting loaded... 

    You mentioned the SDK... are you trying to automate just the USB2ANY? or TICS Pro, and through TICS Pro the USB2ANY? Just the USB2ANY offers alternative solutions (assuming 32-bit VBA). An example is below, using the USB2ANY SDK export symbols to declare VBA functions:

    Public Declare Function u2aFindControllers Lib "usb2any" Alias "_u2aFindControllers@0" () As Long

    For your reference, the 4-blink state indicates that the device is connected but suspended - it has not been enumerated. 

    ---

    Having said all that, there's a TICSPro_TCP.py python file included in the program files (x86) install directory, which uses similar APIs to the ActiveX... the python file contains all the documentation for starting and using the TCP server and client. This is the recommended method moving forward. For interop with excel, the simplest option may be collecting data in python, writing everything as csv or tsv, and importing into excel for post-processing.

    I'm going to mark this thread as TI Thinks Resolved because I don't think there's much else we can do for you for ActiveX. This interface is being deprecated and we're not planning to continue supporting it.

    Regards,

    Derek Payne 

  • Hi Derek,

    Thank you for the thorough explanation and background! The initial goal was to automate both TICSPro and USB2ANY, so be able to take advantage of the register map etc for the LMX2592. We ended up just writing everything in VB (starting with the VB example from the SDK), modified the SPI write function to work with the LMX2592. We also wrote a function to load a hex export file from TICSPro and wite content over SPI, so we did not have to set up all the LMX registers manually. After that we just needed to change one register to change LMX frequency for our automation. So then we compiled and opened a shell from VBA and run the executable with one parameter being the frequency. This works sufficiently well for us to move forward, although not the cleanest method. In the future, we may need to refine this and get a true VBA implementation, but I think we can consider it closed for now. Thanks again for your help.