Re: [patch] NI DAQ-STC support for non-20MHz external timebase

Frank Mori Hess wrote:
> On Tuesday 11 July 2006 05:43 pm, David MacMahon wrote:
>>1. Allows the external timebase period to be specified (in nanoseconds)
>>in the data[2] field of the instruction when setting the clock mode to
>>COMEDI_RTSI_CLOCK_MODE_SLAVE.
> 
> Use INSN_CONFIG_TIMER_1 in conjunction with TRIG_OTHER to specify what 
> divisor of the external master clock you want to trigger off of.  After 
> all, there is no requirement in general that an external master clock has 
> to generate clocks at a fixed frequency.  See 
> comedi/Documentation/comedi/insn_config for a little more information, and 
> the cb_pcidas64.c driver for an example.

Thanks for the idea, Frank, but I don't think that will work for my 
application on the NI PXI-6031E (at least not conveniently or easily). 
I may not be understanding your idea fully/correctly, but it sounds like 
you're suggesting using GPTC resources to divide the external clock 
frequency to generate timing signals rather than using the existing 
frequency dividers already present in the various subdevices (e.g. 
analog in, analog out, etc).  That's not so great for me since I would 
need to use both of the 6031E's GPTCs (one for scan_begin and one for 
convert).  Please let me know if this is an incorrect interpretation.

I originally tried to get the driver to use the existing frequency 
dividers and divide for only half as many ticks.  The cmd.*_arg fields 
are all in nanoseconds, so I had to set them to be half as long, but 
when I did that things failed because it appeared to the driver that I 
was trying to exceed the board's maximum sampling rate (I'm really only 
trying to do just over half the maximum).

I agree that there is no requirement that an external clock has to be a 
fixed frequency and the patch I submitted doesn't introduce or depend on 
such a requirement (although it does require an integral number of 
nanoseconds per cycle, but that seems consistent with other parts of 
comedi).  If the external clock frequency is changed, the clock mode 
could again be set to slave mode, but with the new period (i.e. no mode 
change, just a period change).  Any acquisition already in progress 
would get corrupted since the dividers would still be set for the old 
frequency.  One would have to call comedi_command again after changing 
the frequency to get the dividers reloaded with new values to get the 
same scan/convert rates with the new clock frequency.

AFAICT, INSN_CONFIG_TIMER_1 is not implemented in the NI drivers (it 
seems to only be implemented in cb_pcidas64.c), so it would still 
require a patch to the NI drivers.  Since I would need to use two GPTCs 
(again, please correct me if I've misinterpreted your idea), I think I 
would also need an INSN_CONFIG_TIMER_2.  Finally, if I use TRIG_OTHER 
for both scan_begin and convert, how would I tell the driver which timer 
to use for which?

Thanks,
Dave

Received on 2006-07-12Z05:51:53