[comedi] Q: ext. triggered AO waveform
Andrey <[email protected]> Sun, 17 Apr 2022 08:34:47 -0700 (PDT)
| Newsgroups | gmane.linux.comedi |
|---|---|
| Message-ID | <[email protected]> |
------=_Part_1106_527121450.1650209687932
Content-Type: multipart/alternative;
boundary="----=_Part_1107_1136147060.1650209687932"
------=_Part_1107_1136147060.1650209687932
Content-Type: text/plain; charset="UTF-8"
Hello,
I'd like to generate AO waveform triggered by an external pulse
generator.
Hardware: NI PCI-6281 (8k samples output FIFO, up to 2.8 Ms/s).
Waveform is about 4k samples * 500ns sampling rate = 2 millisecond length
External trigger is connected to PFI0 and about 10Hz (every 100 millisecond)
comedi_board_info output is:
overall info:
version code: 0x00074c
driver name: ni_pcimio
board name: pci-6281
number of subdevices: 14
subdevice 0:
...
subdevice 1:
type: 2 (analog output)
flags: 0x02127000
number of channels: 2
max data value: 65535
ranges:
all chans: [-10 V,10 V] [-5 V,5 V] [-2 V,2 V] [-1 V,1 V] [-5 V,15 V] [0
V,10 V] [3 V,7 V] [4 V,6 V]
command:
start: ext|int
scan_begin: timer|ext
convert: now
scan_end: count
stop: none|count
command structure filled with probe_cmd_generic_timed for 1 channels:
start: int 0
scan_begin: timer 350
convert: now 0
scan_end: count 1
stop: count 2
...
It seems there is no other way for the command structure
(except might be flags=CMDF_WRITE;
which I don't know what is for,
though it makes little difference)
subdev = 1;
flags = 0;
start_src = TRIG_EXT;
start_arg = CR_EDGE;
scan_begin_src = TRIG_TIMER;
scan_begin_arg = 500;
convert_src = TRIG_NOW;
convert_arg = 0;
scan_end_src = TRIG_COUNT;
scan_end_arg = 1;
stop_src = TRIG_COUNT;
stop_arg = 4096;
dump_cmd() out
subdevice: 1
start: ext 1073741824
scan_begin: timer 500
convert: now 0
scan_end: count 1
stop: count 4096
The test is writing the same waveform buffer
and waiting for SDF_RUNNING (0x08000000 - command is running) == 0
then cancel the command (I don't know why it should be there,
but without it write() would give 'Invalid argument')
comedi_command();
write();scan_begin: timer 500
convert: now 0
scan_end: count 1
stop: count 4096
The test is writing the same waveform buffer
and waiting for SDF_RUNNING (0x08000000 - command is running) == 0
then cancel the command (I don't know why it should be there,
but without it write() would give 'Invalid argument')
comedi_command();
write();
comedi_internal_trigger();
while (1) {
while ((flgs=comedi_get_subdevice_flags()) & 0x08000000) usleep(10000);
comedi_cancel();
comedi_command();
write();
comedi_internal_trigger();
}
flgs==0xa127003 while waiting for the trigger
then it changes to 0x2127003 after comedi_cancel() it's 0x2127000
after write() it's already 0xa127003
but without comedi_internal_trigger() it wouldn't go.
After a few minutes it stops with flgs==0xa127003
no matter how many ext. trigger pulses are there.
Having no idea what is the reason,
I've tried to add comedi_internal_trigger() when it stopping
but only got in return 'Resource temporarily unavailable'.
I'd appreciate any suggestion might help.
Is there an alternative to just polling for the flag ?
comedi_internal_trigger();
while (1) {
while ((flgs=comedi_get_subdevice_flags()) & 0x08000000) usleep(10000);
comedi_cancel();
comedi_command();
write();
comedi_internal_trigger();
}
flgs==0xa127003 while waiting for the trigger
then it changes to 0x2127003 after comedi_cancel() it's 0x2127000
after write() it's already 0xa127003
but without comedi_internal_trigger() it wouldn't go.
After a few minutes it stops with flgs==0xa127003
no matter how many ext. trigger pulses are there.
Having no idea what is the reason,
I've tried to add comedi_internal_trigger() when it stopping
but only got in return 'Resource temporarily unavailable'.
I'd appreciate any suggestion might help.
By the way, is there an alternative to just polling for the flag ?
Thanks,
Andrew
--
You received this message because you are subscribed to the Google Groups "Comedi: Linux Control and Measurement Device Interface" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/comedi_list/02b358a8-1ab7-4eef-930d-eeecfbdb0529n%40googlegroups.com.
------=_Part_1107_1136147060.1650209687932
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<br>Hello,<br> I'd like to generate AO waveform triggered  =
;by an external pulse generator.<br><br>Hardware: NI PCI-6281 (8k sam=
ples output FIFO, up to 2.8 Ms/s).<br>Waveform is about 4k samples * 500ns =
sampling rate =3D 2 millisecond length<br>External trigger is connect=
ed to PFI0 and about 10Hz (every 100 millisecond)<br><br>comedi_board_info =
output is:<br>overall info:<br> version code: 0x00074c<br> driv=
er name: ni_pcimio<br> board name: pci-6281<br> number of subde=
vices: 14<br>subdevice 0:<br> ...<br>subdevice 1:<br> type: 2 (=
analog output)<br> flags: 0x02127000<br> number of channels: 2<=
br> max data value: 65535<br> ranges:<br> all chan=
s: [-10 V,10 V] [-5 V,5 V] [-2 V,2 V] [-1 V,1 V] [-5 V,15 V] [0 V,10 V] [3 =
V,7 V] [4 V,6 V]<br> command:<br> start: ext|int<br>&nbs=
p; scan_begin: timer|ext<br> convert: now<br> &nb=
sp; scan_end: count<br> stop: none|count<br> command str=
ucture filled with probe_cmd_generic_timed for 1 channels:<br> =
start: int 0<br> scan_begin: timer 350<br> conve=
rt: now 0<br> scan_end: count 1<br> stop: count 2=
<br>...<br><br>It seems there is no other way for the command structure<br>=
(except might be flags=3DCMDF_WRITE;<br>which I don't know what is for,<br>=
<div>though it makes little difference)</div><div>subdev =3D 1;<br>flags =
=3D 0;<br>start_src =3D TRIG_EXT;<br>start_arg =3D CR_EDGE;<br>scan_begin_s=
rc =3D TRIG_TIMER;<br>scan_begin_arg =3D 500;<br>convert_src =3D TRIG_NOW;<=
br>convert_arg =3D 0;<br>scan_end_src =3D TRIG_COUNT;<br>scan_end_arg =3D 1=
;<br>stop_src =3D TRIG_COUNT;<br>stop_arg =3D 4096;<br><br>dump_cmd() out<b=
r>subdevice: 1<br>start: ext =
1073741824<br>scan_begin: timer 500<br>convert: =
now 0<br>scan_end: count &nb=
sp;1<br>stop: count 4096<br><br>The test =
is writing the same waveform buffer<br>and waiting for SDF_RUNNING (0x08000=
000 - command is running) =3D=3D 0<br>then cancel the command (I don'=
t know why it should be there,<br>but without it write() would give 'Invali=
d argument')<br><br>comedi_command();<br>write();scan_begin: timer &=
nbsp;500<br>convert: now 0<br>scan_end: &n=
bsp; count 1<br>stop: count =
4096<br><br>The test is writing the same waveform buffer<br>and waiting for=
SDF_RUNNING (0x08000000 - command is running) =3D=3D 0<br>then cance=
l the command (I don't know why it should be there,<br>but without it write=
() would give 'Invalid argument')<br><br><br>comedi_command();<br>write();<=
br>comedi_internal_trigger();<br>while (1) {<br> while ((flgs=3Dcomed=
i_get_subdevice_flags()) & 0x08000000) usleep(10000);<br> comedi_=
cancel();<br> comedi_command();<br> write();<br> comedi_i=
nternal_trigger();<br>}<br><br>flgs=3D=3D0xa127003 while waiting for the tr=
igger<br>then it changes to 0x2127003 after comedi_cancel() it's 0x2127000<=
br>after write() it's already 0xa127003<br>but without comedi_internal_trig=
ger() it wouldn't go.<br><br>After a few minutes it stops with flgs=3D=3D0x=
a127003<br>no matter how many ext. trigger pulses are there.<br><br>Having =
no idea what is the reason,<br>I've tried to add comedi_internal_trigger() =
when it stopping<br>but only got in return 'Resource temporarily unavailabl=
e'.<br><br>I'd appreciate any suggestion might help.<br><br>Is there an alt=
ernative to just polling for the flag ?<br><br>comedi_internal_trigger();<b=
r>while (1) {<br> while ((flgs=3Dcomedi_get_subdevice_flags()) & =
0x08000000) usleep(10000);<br> comedi_cancel();<br> comedi_comm=
and();<br> write();<br> comedi_internal_trigger();<br>}<br><br>=
flgs=3D=3D0xa127003 while waiting for the trigger<br>then it changes to 0x2=
127003 after comedi_cancel() it's 0x2127000<br>after write() it's already 0=
xa127003<br>but without comedi_internal_trigger() it wouldn't go.<br><br>Af=
ter a few minutes it stops with flgs=3D=3D0xa127003<br>no matter how many e=
xt. trigger pulses are there.<br><br>Having no idea what is the reason,<br>=
I've tried to add comedi_internal_trigger() when it stopping<br>but only go=
t in return 'Resource temporarily unavailable'.<br><br>I'd appreciate any s=
uggestion might help.<br><br>By the way, is there an alternative to just po=
lling for the flag ?</div><div><br></div><div>Thanks,</div><div>  =
; Andrew<br></div><div><br></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;Comedi: Linux Control and Measurement Device Interface" group.<br=
/>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:[email protected]">comedi_=
[email protected]</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/d/msgid/comedi_list/02b358a8-1ab7-4eef-930d-eeecfbdb0529n%40googlegroups=
.com?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.com/d/ms=
gid/comedi_list/02b358a8-1ab7-4eef-930d-eeecfbdb0529n%40googlegroups.com</a=
>.<br />
------=_Part_1107_1136147060.1650209687932--
------=_Part_1106_527121450.1650209687932--