LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Vizualization of serial data flow from CCD chip using STM32

Hi

I am trying to read the data stream from a CCD chip (TCD1304DG). I am using STM32 "Blackpill" to control the chip, which is programmed with minor changes according to this project:
https://curiousscientist.tech/blog/tcd1304-linear-ccd-driving-the-ccd

 

I send the serial data via USB to my ntb and try to plot the intensity on individual pixels.

 

The code in LabView waits for a start character, in my case it is an A that is inserted at the beginning of each buffer sent from STM32. It then has to read all the pixels, which should be 3694 in total, and render them. The pixels have a value from 0 to 255 + space. My problem is probably with synchronization, as my graph "floats", as seen in Plotting_pixels.png. The pixels don't have a precise position, so I'm not able to determine which one the light is hitting.

 

I couldn't find a solution for STM32 here in the forum, hence the custom thread.

 

I would like to avoid FPGA systems and I feel that I am only missing some small thing to finish this project.

Thank you for any advice.

Download All
0 Kudos
Message 1 of 2
(493 Views)

You have several problems and potential problems.

 

The first actual problem is your use of the Serial Port Init function without wiring a FALSE constant to the "use termination character" boolean. Since your data is binary and can contain any byte value from 0 to 255, you can not simply use termination character mode without extra work. The default line feed character used as termination character can occur anywhere in your data except at the end of your message frame, which is completely the opposite of what you need. Disable the termination character and you should already get a lot better operation.

 

The next potential problem that will happen sooner or later is that your binary data also can contain any possible other byte including your A character that you use to indicate the beginning of a message. If you happen to sync on such an embedded A byte that is not your actual sync character, you will be completely off the chart with the rest of your code.

 

But disabling the termination character for VISA Read is the first step to get an even remotely stable communication. Fixing the other potential problem will be a lot more complex, but what you get already may be enough for you.

 

Actually looking at your diagram it seems you are not sending the binary data as is mentioned in the linked article but rather each measurement as an ASCI encoded number with line feed, otherwise you could not get the graph as you show it. So not quite sure what seems the problem then.

Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 2
(432 Views)