Driver Development Kit (DDK)

cancel
Showing results for 
Search instead for 
Did you mean: 

(MHDDK) How to realize the synchronization of read and write for long time by cart PCI6025E

   I've finished the programming of the process read and write for the PCI6025E, I can read and write the data now, I wanna synchronize both of the processes, writing the data into the card just after the reading from the card, and check the wave in the oscilloscope. when I use the SEC , it works, but when I changed to MSEC, the wave only come out for a few seconds, even if I bloc 60sec, and also the wave is not steady. why?

 

    so now the problem is how could I write the data immediately which just read and it's for a long time I asked?

 

 

Thanks in advance!
0 Kudos
Message 1 of 12
(9,912 Views)
Hi Jack,

It appears you missed my reply to your other thread [1]. Rolf may have some good information for you [2].

[1] How to realize the synchronization of read and write by cart PCI6025E
http://forums.ni.com/ni/board/message?board.id=231&view=by_date_ascending&message.id=6656#M6656

[2]  PCI6251: How to Largely Reduce AO FIFO Size or Disable AO FIFO in AO HW Timed DMA Operation?
http://forums.ni.com/ni/board/message?board.id=90&message.id=1681#M1681
Joe Friedchicken
NI Configuration Based Software
Get with your fellow OS users
[ Linux ] [ macOS ]
Principal Software Engineer :: Configuration Based Software
Senior Software Engineer :: Multifunction Instruments Applications Group (until May 2018)
Software Engineer :: Measurements RLP Group (until Mar 2014)
Applications Engineer :: High Speed Product Group (until Sep 2008)
0 Kudos
Message 2 of 12
(9,907 Views)

Hello Jack,

 

as Joe mentioned in his answer to you, I managed to do something similar for an M series DAQ board what you seem to be trying for your E series device.

 

However, my application needs the AI reading and AO waveform generation only for a finite period of time of min 0.2 s and max. 3600 s. For this my driver provides a sufficiently large linear DMA buffer of 128 MByte, which means it can hold exactly 64 MSamples. At full dual channel AI speed of my DAQ board (1 MS/s), the buffer would be full after 65.5 s. So, if the measurement should take longer, then I reduce the sample rate.

 

If "long time" in your case means infinite, then of course you cannot get away with a sufficiently large linear DMA buffer. If "long time" means a few hours, then my approach might be feasible in your case.

 

I had a quick look at the E series datasheet, and according to that, your device has a DMA controller for one DMA channel, and the max. AI sample rate is 200 kS/s which is already above of what you can achieve without using DMA, but the max. AO sample rate is only 10 kS/s and every modern processor can attend this rate software controlled hands down.

 

I have to admit, that I only know the M-series-DDK, however, I assume that also the E-series-DDK comes with an AI-DMA example. You would modify this example to infinite AI reading at max. sample rate. Perhaps you need to modify the DMA buffer mode to kRing. And you would locate and modify the while () loop that reads the new samples from the DMA buffer. You might want to remove any wait cycles and console output, and then this loop will pick up the most recent AI readings from the DMA buffer.

 

Within that loop the next step is to compute the desired AO output, and you will actual write it to the DAC only if two conditions are true:

 

1. your loop read-in at least 20 new AI samples

2. the least significant bit of the AO output changed

 

Does this make sense?

 

Best regards

 

Rolf

 

Message 3 of 12
(9,890 Views)

Hello rolf and joe:

   Thanks so much!

   But the problem is I can't find AI-DMA example in the web, in the reference manual it has ,However,When I download the package, it only doesn't exist the aiex4.cpp.

   Do you have it?

 

 

Thanks!

0 Kudos
Message 4 of 12
(9,885 Views)

Hi Jack,

aiex4.cpp doesn't exist, as far as I can tell. I believe that while the examples were being named, the developer mis-numbered them and just skipped 4 :-S

At any rate, if you already have AI and AO working separately, and you have the I/O performance you application requires, then you may not need to add DMA to your driver. However, if you want to add DMA, it won't be very difficult. In essence, you would need mix code from the S and M Series examples. The S Series example aiex2.cpp shows two things: the few lines of code you need to add DMA objects (lines 70-78), and how to program the STC to use DMA (line 114). And aiex3.cpp from the M Series examples gives a clearer picture of how to control and read the DMA channel.

 

Thanks, Rolf, for your time and help 🙂 I'm grateful for your contributions, and I'm glad to see active developers in the DDK forum.

Joe Friedchicken
NI Configuration Based Software
Get with your fellow OS users
[ Linux ] [ macOS ]
Principal Software Engineer :: Configuration Based Software
Senior Software Engineer :: Multifunction Instruments Applications Group (until May 2018)
Software Engineer :: Measurements RLP Group (until Mar 2014)
Applications Engineer :: High Speed Product Group (until Sep 2008)
0 Kudos
Message 5 of 12
(9,876 Views)

   To be more specific, I am working on a system control application. Therefore, we should be able to read from AI and write to AO. The amount of data is not important (e.g. one input and one output), however the operation has to be kept as long as possible in a continuous manner. The typical sampling rate of my application is 1ms. To be simpler, in the application I am developing, I read the data and write it out immediately. And my "read" is based on the example AIEX1 and the "write" is based on AOEX1.

    Currently, this operation can be made only for few seconds. After then, analog signal disappear from the oscilloscope. My question is what is the correct configuration and the execution sequences for this type of operation.

 

 

Thanks!

0 Kudos
Message 6 of 12
(9,866 Views)

The best thing I can think of is to check the status registers and see if the board is reporting a problem. Also, check to see if the operating system is returning any error codes to your program.

When looking for best practices about programming E Series hardware, the STC RLP manual [1] is really quite detailed. The DDK examples follow the pseudo-code in the manual, and section 2.6.3 directly addresses analog input programming while section 3.6.1 addresses analog output programming.

 

[1] DAQ-STC RLP Manual

http://digital.ni.com/manuals.nsf/websearch/E929838D7D0EE50986256728007FEADF

Joe Friedchicken
NI Configuration Based Software
Get with your fellow OS users
[ Linux ] [ macOS ]
Principal Software Engineer :: Configuration Based Software
Senior Software Engineer :: Multifunction Instruments Applications Group (until May 2018)
Software Engineer :: Measurements RLP Group (until Mar 2014)
Applications Engineer :: High Speed Product Group (until Sep 2008)
0 Kudos
Message 7 of 12
(9,812 Views)

Hello joe:

    Thanks so much for your help!

    I've already figure out this problem, the reason is that I put "bus->destroyaddressspace(bar1)"  in my Read() fonction, but I separated the fonction initial() from the Read() before, so every time I run the Read(), it destroyed the board every time, that sounds so stupid mistake, anyway all is done now.

    But I still find that the max smapling is 1msec, it could be improved?like 0.5 msec or less?

    

 

Thanks for your help!

 

   

 

0 Kudos
Message 8 of 12
(9,761 Views)

Hello Jack,

 

as I said in my message some days ago, I learned from the specs for the PCI-6025E card, the the max. AO sample rate is 10 kHz (0.1 ms/S). Unfortunately, that time I did not look close enough, and later I saw in the small print, that 10 kHz can only be achieved by when using DMA for AO operation, otherwise the sample rate will be 1 kHz (1 ms/S). So, this might be the explanation why you are not able to do faster sampling.

 

Best regards

 

Rolf 

 

0 Kudos
Message 9 of 12
(9,753 Views)

  Thanks rolf!I also find some detail informtion data sheet of the PCI6025E, by default is 1kHZ as you said.

 

 

 

thanks!

0 Kudos
Message 10 of 12
(9,750 Views)