From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

usb raw balk frequency measurement

I have send data from xilinx to pc via  usb port, and use usb raw bulk to get data

Untitled.png.

Is There any way to get frequency of input signal?

 

0 Kudos
Message 1 of 8
(2,696 Views)

I don't know anything about reading from USB devices, but here's a few suggestions.

 

1) You need to move the VISA open outside the loop

2) What freq are you expecting?  Hz, kHz, MHz?

3) The high resolution timer is probably a good start.

4) String to byte array?  Are you sure that's how you should convert the data for plotting.

 

Anyway, here's an example timer and fixed VISA loop.

usb_bulk-in_read_timing.png

 

 

 

0 Kudos
Message 2 of 8
(2,682 Views)

Thanks for reply


@cstorey wrote:

I don't know anything about reading from USB devices, but here's a few suggestions.

 

1) You need to move the VISA open outside the loop

2) What freq are you expecting?  Hz, kHz, MHz?

3) The high resolution timer is probably a good start.

4) String to byte array?  Are you sure that's how you should convert the data for plotting.

 

Anyway, here's an example timer and fixed VISA loop.

usb_bulk-in_read_timing.png

 

 

 



the output of visa read is string of characters as i know, so i have to change them to byte array.

the frequency range from Hz-MHz

0 Kudos
Message 3 of 8
(2,666 Views)

Ok, so did that work for you?

0 Kudos
Message 4 of 8
(2,657 Views)

No Sir, It did not work, When i change frequency from xilinx, i have to change the number of bytes to read in visa read component.And it is not efficient way.

What i did i build DDS In Xilinx and send data to PC via cypress USB.

Below is the schematic of my board.

and as you see in "waveform_gen.vhd" i have done this  by putting reg [31:0] phase = 32'hD1B71; at line "27" to get 20 kHz.

In this way when i put  bytes to read to 1000000 i get 20 Hz, and when get  phase = 32'hD1B71; (27 kHz) i have to change bytes to read to (20/27)*1000000=740740 to get 27 at labview.

 

 

0 Kudos
Message 5 of 8
(2,647 Views)

Hi, there is something I don't quite understand. Why do you have to change the number of bytes you are reading when you change the frequency?

 

Why don't you have a fixed number of bytes to read?

0 Kudos
Message 6 of 8
(2,637 Views)

Ok, I am with you Sir,No problem what is the packet size, But that is what i have noticed.

when i fix the packet size for frequency, i have to change it for the other. i can not figure out ?

 

0 Kudos
Message 7 of 8
(2,628 Views)

If you read the value of the phase register in LabVIEW before trying to read the frequency, you might be able to use that value to programmatically change the input of the VISA read function. That way you could do the appropriate reading for every test. Do you get my idea?

0 Kudos
Message 8 of 8
(2,615 Views)