Jump to content
  • 0

USB-1808X Random delay of analog inputs


F. Y.

Question

Hi
I have a USB-1808X and I'm trying to output an analog signal that contains around 160,000 data points at 50KHz via the AOUT0 pin. (which means the duration of the signal is about 3.2 sec). A current signal should be read back simultaneously at the same frequency via CH0H/CH0L as well as a voltage signal via CH1H/CH1L. Everything is fine except there's always a delay (~30 data points) at the beginning of the measured signals. Simply a constant delay is not a problem as I can shift the measurements back or forward in python with that constant to compensate. The problem is, it's not a constant, every time I run the code, the delay can be anything from 25 to 40 points, which makes it impossible to compensate precisely. Is that a hardware limitation or we can do anything better in programming? I'm using ul.a_in_scan() follow by ul.a_out_scan() to do the task. The scan option is BACKGROUND. 

I believe you can ignore the voltage measurement plot (green line) in the following screenshots. The current is more obvious to analysis with in my case. X-axis is the number of data points.

Thank you
 

1.png

2.png

python code1.png

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Hello @F. Y.

Please elaborate on your signal connections.  Is your AOUT0 channel connected to an analog input channel or are both current and voltage signals from an external source?  Try splitting the AOUT0 channel signal into both the CH0H/CH0L and CH1H/CH1L channels.  Disconnect any external signals.  Do you see a delay between the two input channels?  If so, is the delay consistent each time?

Regards,

Fausto

Link to comment
Share on other sites

  • 0

 

Hello,

The USB bus is not a real-time interface, and I would expect it to be something other than simultaneous or consistent.  Also, the driver is managing two tasks with a single microdevice. It's doing the best it can. Instead of a delay, which isn't working, create an analog trigger algorithm that looks at the input signal and determines that the stimulus has begun. One way to do this is to loop the output back into an unused input and start collecting data when the output begins.

Best regards,

John

 

Link to comment
Share on other sites

  • 0
3 hours ago, Fausto said:

Hello @F. Y.

Please elaborate on your signal connections.  Is your AOUT0 channel connected to an analog input channel or are both current and voltage signals from an external source?  Try splitting the AOUT0 channel signal into both the CH0H/CH0L and CH1H/CH1L channels.  Disconnect any external signals.  Do you see a delay between the two input channels?  If so, is the delay consistent each time?

Regards,

Fausto

Hello @Fausto

Yes. Both CH0H/CH0L and CH1H/CH1L are measuring external signals from a battery. AOUT0 output my 50khz signal profile (the blue line) to the battery, and CH0H/CH0L CH1H/CH1L read its signals back. I have tried to measure connect AOUT0 directly to CH0H/CH0L as the picture shows, without any other external load, but the random delay problem persists. The exact delay in time that the device starts to measure the signal seems random. I wonder, maybe there's a function or parameter to set a trigger or something instead of simply executing a_in_scan() and a_out_scan()

Edit: to clarify, there's no delay between the two input channels, the delay is between the AOUT0 and the inputs - there's a random amount of time after the start of the output and the start of the input measurement.

 

3-min.png

Edited by F. Y.
Clarify
Link to comment
Share on other sites

  • 0

I'm new here so take anything I say with a grain of salt. Seems like you expect the communications to the board to happen simultaneously despite the a_in_scan and an_out_scan being executed sequentially over a USB bus, which as other have said may not work. I'm trying to do something similar and my approach has been to output a second signal simultaneously (from a digital output in my case) and trigger the input scan off of that. If your signals are periodic this approach might work for you. If not you could pad the beginning of your output signal with benign values (enough that is takes longer than the delay, and align the trigger timing with the beginning of your real signal.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...