08-05-2013 12:11 PM
Dear All,
I have a PCIe-6363 and a PCIe-6537 card installed on the same computer and connected by an RTSI cable. The PCIe-6537 receives sample clock from PCIe-6363 through RTSI . I generate a counter output task on PCIe-6363, and identify the relevant PFI as the sample clock source for a digital output task on PCIe-6537. With this configuration, I can achieve maximum 25 MHz sample rate (low and high times in a counter task can be minimum 2 periods of the timebase).
Is it possible to get a higher clock from PCIe-6363 for use as sample clock on another card?
Thank you very much in advance for your comments.
Aside: In my application, the PCIe-6363 also provides a reference clock to PLL of another card that needs to be operated in synchronization with PCIe-6537. I attempted to generate the reference clock also from PCIe-6537, but it didn't work since the ref. clock should always be on (not only when the DO task is running). So I can't use PCIe-6537's internal sample clock.
08-06-2013 10:51 PM
MYY,
Take a look at this article about timing and synchronization. Specifically look at section 7 for an example of exporting and routing clock signals over a RTSI cable. Rather than use a Counter Output task to generate the sample clock to send across the RTSI bus, you should be able to simply route the sample clock of the PCIe-6363. The steps in this article will help you determine what signals can be routed. Once you've determined which signals can be routed, you can use the DAQmx Connect Terminals VI to connect the terminals in LabVIEW. For instance, you may be able to route the sample clock of the PCIe-6363 to a RTSI line, then import that to the PCIe-6537. Let me know what you think and thanks for posting!
Timing and Synchronization Features of DAQmx
08-09-2013 03:11 PM
Dear Robert,
Thank you for your reply. I worked on the issue today (yesterday was a holiday here). As you have suggested, I concentrated on routing internal signals of PCIe-6363 to RTSI and PFI lines. I tried most of the signals that appear in MAX. Unfortunately I couldn't manage to obtain something higher than 25 MHz. Actually I can route the 100 MHz timebase, which is >25 MHz, but this doesn't help me for: i) pulsewidth of the external sample clock of PCIe-6537 should not be <10 ns, and ii) I need a variable sample clock (in 10 MHz steps for example) from 20 to 50 MHz.
As far as I can see, I must in any case generate a dummy task on PCIe-6363. Analog tasks, digital tasks, or frequency output; none of these can go beyond 20 MHz. Counters are still the most promising part for me. I will go over this again next week, and certainly let you know if I can find a solution.
08-12-2013 04:29 PM
MYY,
I'm not entirely sure, but it may be possible to divide down the 100MHz sample clock. The only caveat would be that the task would have to be stopped and started again to change the frequency. Let me know what you find out next week. This is certainly an interesting question.
08-13-2013 01:49 PM
Dear Robert,
Thank you once again for your kind reply. The problem is now solved.
As a summary, the starting point for this discussion was a requirement for synchronization between PCIe6537 and some other card (not mentioned here) that will be kilometers away in a real application. Since PCIe6537 doesn’t have a PLL or reference clock, I decided to use PCIe6363 for synchronization, which should already be installed on the same computer as PCIe6537 for other reasons. According to my plan, it would provide a sample clock to PCIe6537, and a 10 MHz reference clock to the other card. This worked fine, but I couldn’t get a sample rate higher than 25 MHz, and so couldn’t use PCIe6537 to its full capacity.
I found some threads on NI discussion forums, followed them today, and they worked. The key discovery for me was the existence of two alternative output behaviors (toggle and pulse) for an exported counter output event. Toggle is the default behavior. When I changed it to pulse, I was able to obtain output frequencies of 100MHz/N with N = 2, 3, 4, ….
The threads I benefited are as follows:
Pulsed vs Toggled Output Modes using Counter Hardware
Maximum Output Frequency for 6601/6602 Counter/Timer Boards
NI-DAQmx: Generating a 40 MHz Pulse Train with Counter Output
highest output frequency with NI 6602
I also write relevant parts of my program below. I use Matlab, and call DAQmx library from there.
For clarity, I first define two string variables as:
PCIe6363 = ‘/Dev1’;
PCIe6537 = ‘/Dev2’;
It is possible to export a reference clock from PCIe6363 as below. PFI5 here is arbitrary.
ec = calllib('nicaiu','DAQmxConnectTerms',[PCIe6363 '/10MHzRefClock'],[PCIe6363 '/PFI5'],DAQmx_Val_DoNotInvertPolarity);
The reference clock reamins on as long as the program runs. Before exiting the program, we can release PFI5 as:
ec = calllib('nicaiu','DAQmxDisconnectTerms',[PCIe6363 '/10MHzRefClock'],[PCIe6363 '/PFI5']);
Next, I generate a dummy counter output task on PCIe6363, which will provide the sample clock to a buffered digital output task on PCIe6537:
SampleClockTaskHandle = uint32([]);
sampleClockTaskHandlePtr = libpointer('uint32Ptr',SampleClockTaskHandle);
[ec,~,SampleClockTaskHandle] = calllib('nicaiu','DAQmxCreateTask','',sampleClockTaskHandlePtr);
initialDelay = int32(2);
lowTicks = int32(2); % should be 2 for 50 MHz
highTicks = int32(2); % should be 2 for 50 MHz
ec = calllib('nicaiu','DAQmxCreateCOPulseChanTicks',SampleClockTaskHandle,[PCIe6363 '/ctr0'],'',[PCIe6363 '/100MHzTimebase'],DAQmx_Val_Low,initialDelay,lowTicks,highTicks);
PCIe6537 accepts external sample clock from either its PFI4 or RTSI7 terminals. In the following two lines, I route the output terminal of PCIe6363/Counter0 to PCIe6363/RTSI7. This way, the output will travel from PCIe6363 to PCIe6537 over each card’s RTSI7 terminals. We could also leave the counter in its default configuration (i.e. output terminal PFI12) and rely on DAQmx’s implicit routing. In this case, the following two lines should be taken out.
outputTerminal = [PCIe6363 '/RTSI7']; outputTerminalPtr = libpointer('cstring',outputTerminal);
ec = calllib('nicaiu','DAQmxSetCOPulseTerm',SampleClockTaskHandle,[PCIe6363 '/ctr0'],outputTerminalPtr);
Then I configure timing. Since we just need a periodic pulse train, we can use implicit timing here (no need for a buffered task).
sampsPerChanToAcquire = uint64(1e8); % total # of pulses that will be generated by the task. 1e8 is arbitrary.
ec = calllib('nicaiu','DAQmxCfgImplicitTiming',SampleClockTaskHandle,DAQmx_Val_ContSamps,sampsPerChanToAcquire);
This is the most critical step to achieve >25 MHz signals from PCIe-6363. We change the output behavior of the counter:
ec = calllib('nicaiu','DAQmxSetExportedCtrOutEventOutputBehavior',SampleClockTaskHandle,DAQmx_Val_Pulse);
And we finally start the dummy sample clock task:
ec = calllib('nicaiu','DAQmxStartTask',SampleClockTaskHandle);
The task on PCIe6537 was a buffered digital output task in my case. So I used DAQmxCfgSampClkTiming to configure its timing. I will focus on timing and skip other details of this task, since they are not relevant to the discussion here. Depending on whether the sample clock is routed explicitly by us over RTSI7, or implicitly by DAQmx software, we can use one of the following two alternatives:
Explicit routing to RTSI7:
ec = calllib('nicaiu','DAQmxCfgSampClkTiming',DoTaskHandle,[PCIe6537 '/RTSI7'],rate,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,sampsPerChanToAcquire);
Implicit routing to the default output terminal of PCIe6363/Counter0:
ec = calllib('nicaiu','DAQmxCfgSampClkTiming', DoTaskHandle,[PCIe6363 '/PFI12'],rate,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps, sampsPerChanToAcquireGP);
The advantage of the former alternative could be that PFI12 on PCIe6363 can be used for other tasks (I didn’t check; this is just a guess), while the advantage of the latter is its simplicity.
The only thing that is not clear to me in this picture is the following: On Page-5 of the PCIe6537 specifications sheet, it is stated that the imported sample clock frequency range is 0-25 MHz when imported over RTSI7, and 0-50 MHz when imported over PFI4. However, with both alternatives mentioned above, I can get 50 MHz sample rate. I check this by writing 1010… in the DO task and observing 25 MHz on an oscilloscope. Maybe the “first alternative” is not as low-level as I think and still involves PFI channels (PFI4 on PCIe6537 and PFI12 on PCIe6363).
In summary, I can now transfer sample clocks up to 50 MHz from PCIe6363 to PCIe6537.
Best wishes to all the members of this forum, who share their solutions generously.
M. Yavuz Yüce