My lab groups wants me to integrate the software for HMC833LP6GE into MatLab so it can run their code. Is this option available, and if so, how would I do this?
Our eval board software controls the HMC833LP6GE through the FT2232C chip (datasheet attached). FTDI provides drivers for this chip which can be used with Matlab. There is a discussion on the Matlab site with more details...
MATLAB Central - USB & FTDI & Compiler
Ok. So am I suppose to create a mex file that connects the HMC833LP6GE software with MatLab? I was somewhat lost reading that thread because I didn't really know what I was reading about. I thought mex files were only for C/Fortran, which are programming languages, whereas the HMC833lP6GE is software by itself??
You don't need mex files. Message #5 in the above Matlab discussion describes the syntax and message #16 and #17 show code examples. I haven't tried this myself.
Before you can talk to the HMC833 you must install the FTDI driver. The easiest way to do this is just install the eval board software at "Hittite Microwave - HMC833LP6GE, Wideband PLL + VCOs ". I have attached the programing guide for the FTDI driver.
Ok, I will try this. Could you explain what this is specifically supposed to do? I just know that it should help me in"communicating" with HMC833LP6GE.
Also, my group specifically wants to make the MHC833LP6GE run a frequency sweep. Is there anything else I would need to do then, or does "communicating" with the HMC833LP6GE mean controlling the frequency?
The FTDI driver allows you to write high level code to control the FT2232C chip via USB. The high level code could be written in any language such as Matlab, C#, VB.net, Python or C++. You can use the FT2232C MPSSE capability (see section 9.6 of the FT2232C datasheet) to generate a HMC833 SPI bit stream. The following diagram from the HMC833 datasheet describes how the three SPI signals (SCK, SDI and SEN) must change to write 24 data bits (d23:d0) to the register set by r4:r0.
For example -- say you want to set the frequency of the HMC833 to 2500MHz. When the reference frequency is 50MHz you must program N=2500/50=50d = 0x32. N is stored in Register 0x03 (see section 1.12.1 of the HMC833 datasheet) which means r4:r0=0x03 or 00011b. The 24 bit data is 0x000032 or
Now create the 32 bit data stream by concatenating d23:d0 with r4:r0 and setting the last three bits to zero:
00000000000000000011001000011000b <-- these are the bit transitions required on SDI to set Reg 0x03=0x32.
You create this bit stream using the FT2232C MPSEE capability to clock SDI data out on every negative SCK transition. Page 8 in the attached "AN2232C" appnote describes how to do this. You must write a sequence of bytes to the FT2232C using the FT_Write driver function.
lpBuffer = 0x11 the MPSEE command to send SDI bits on the falling edge of SCK
lpBuffer = 0x03 this tells the FT2232 to send 4 data bytes
lpBuffer = 0x00 this is upper byte of the 16 bit "number of bytes to send" value
lpBuffer = 0x00 this is d23:d16
lpBuffer = 0x00 this is d15:d8
lpBuffer = 0x32 this is d7:d0
lpBuffer = 0x18 this is r4:r0 concatenated with the 3 least significant bits set to zero
status = FT_Write (handle, lpBuffer, 7)
This example only shows a single register write to the HMC833. To completely configure the part you must program all registers described in section 2.0 of the datasheet. Change frequency by writing the frequency control registers (0x03 and 0x04). We do not have any sweep capability on the HMC833.
Thanks for the thorough explanation. But, I think the main problem I have right now is just getting code to work. Specifically, I have noticed in that MatLab dicussion you linked that their example code uses the FTDI functions.When I downloaded the driver folder, I saw that there was a .dll file and a .h file. When I tried to use this in the loadlibrary function, I get this error for a ton of functions
"The data type 'error' used by function FT_Write does not exist. "
I think this is because there are certain data types in C that are not supported in Matlab, so doesn't that mean I need to write a mex file?(Edit: I have tried what post 12 on the USB&FTDI&COMPILER suggested, and when that didn't work, tried to redefine other data types. But, it still doesn't work.)
Also, if I used loadlibrary and errors for some functions do not pop up, like FT_Read, does that mean I can use them in Matlab? I tried with FT_Read in Matlab and it didn't work, but perhaps that is due to other protocols that I am not aware of.
Also, you mentioned how install the FTDI VCP drivers will make the HMC833LP6GE appear as a virtual comp port. They however, are still USB Serial Converter A and B for me.
Retrieving data ...