LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

[FPGA] Photon counting and acquisition in fast scanning system

Hello,

 

I am building a confocal microscope and am struggling with acquisition of photons and passing them to the host. I am using R Series PCIe-7852R card. In my sytem I am using the resonant scanning mirror with fixed 16kHz frequency and a voltage controlled galvo mirror. The image will be acquired with point scanning using those mirrors. I am using a digital photon counter to acquire photons. So in order to acquire the image, I need to acquire each single pixel separately. Each pixel is built with the photon counts. Photon count is an added number of TTL signal that states whether there was a photon or not. It means, that I have to acquire desired number of pixels in the half of the resonant mirror period (i.e. 62.5us). Resonant mirror is responsible for horizontal scannint, while galvo mirror is responsible for vertical scanning. I can do multiple horizontal scans befor going to another vertical line. The FPGA compilation allowed me to obtain 120MHz clock.

1. For photon counting I am using single cycle timed loop with 120MHz clock rate. Assuming that I would need at least 1 photon count per pixel, I can acquire photons with 120MHz frequency. However, this SCTL is located inside a for loop, which requires at least 6 clock ticks for execution, meaning that I need at least 7 clock ticks per photon. In here my question is: is there any possibility to speed up this loop, or this is best I can do? Also, I realised, that using different clock for the SCTL (e.g. 200MHz) even though it allowed for faster photon counting, however it slowed down the for loop used for pixel acuisition, so effectively the acquisition was slower. 

2. Another problem I am struggling with transfering the data to the host. I try to use FIFO but somehow I do not get good results. I believe that FIFO is overfilled with data, hence it does not transfer the data properly. It doesn't transfer the data at all. So my question is: is FIFO appropriate for such fast data transfer? For example: assuming I have 200 pixels in horizontal direction, 10 resonant scans per line, and 200 vertical pixels, I will have 200*10*200=400000 pixels acquired in 10*200*62.5us=125ms. 

 

I hope someone will be able to help me with that. Thanks in advance for the help.

I attach the vi I use wrote and described above.

Download All
0 Kudos
Message 1 of 4
(3,615 Views)

Hi Piotr,

 

So the problem you have is that the for loop has extra overhead as you have said. In addition to the internal logic (your sctl, FIFO write) there is two ticks overhead for the loop logic which you can never get around.

 

What you will likely need to do is eliminate the outer for loop and use some logic in the SCTL to keep it running but reset the count and send the old count to a FIFO.

 

For my understand. The way the x timing works is that the mirror is constantly moving and the time is the amount of time you expect it to be in range of a specific pixel?

 

For the FIFO you are currently using I16 values which gives an effective rate with your calculations of 6.4MB/s which should be well within the range of the card. However things will have to change here due to 1 anyway. What I would suggest is, on the timeout you put a digital latch so you can see if it times out.

 

One problem is you may have a much higher burst while scanning (depending on the timing) even though the overall rate is low. To solve this have a fast FIFO on the FPGA with depth for a row of data. Then have a second loop that reads this and sends it to the host so that it can spread out the data. Another option then is you could pack 4 pixels into a 64 bit number which can be more efficient

 

James Mc
========
CLA and cRIO Fanatic
My writings on LabVIEW Development are at devs.wiresmithtech.com
0 Kudos
Message 2 of 4
(3,581 Views)

Hi Jamas,

 

Thank you for the hints. I tried to use your suggestions, but now the data is not transferred properly to the host and I got time outs of all my FIFO. However I keep getting time out from the fifos and the data is not beeing passed to the host. Do you have any suggestions?

Download All
0 Kudos
Message 3 of 4
(3,523 Views)

Hi Piotr,

 

I saw your post as I was looking for some resources for the Labview code that I planned to write to control our STED microscopy. I saw "STED" in your vi names although you did not say in the post. However, I am running Labview 2014 so I could not open your file. I was wondering if you could kindly save them with 'save for previous versions'  option in the file menu and send it to me. I have been struggling with coding for several weeks and trying to find relevant posts on NI forum, and I was so glad that I saw your post. BTW, were you able to solve your initial problems? Would you be willing to share with me your code so that I could take a look at it?

 

Thanks so much in advance

LY

0 Kudos
Message 4 of 4
(3,322 Views)