Quantcast
Channel: Instrument Control (GPIB, Serial, VISA, IVI) topics
Viewing all articles
Browse latest Browse all 5565

VISA read freeze with Arudino CDC (USB serial)

$
0
0

Hello Everyone,

I am trying to read a serial port continuously (frame by frame) but VISA is freezing after a random number of reading cycle.

Let me explain my operation -

1. I have programmed an Arduino DUE board to send data through it's "Native USB port" which works on CDC protocol ( acts like a serial port).

 

2. My control loop is set to send a character one "1" to signal an acquisition operation. The Arduino then sends 40448 bytes of data through the port.

3. This operation supposes to happen indefinitely. But the problem is after a while (sometime after ~500 frames, ~6000 frames or sometime ~3000 frames) the Labview Code is freezing. If I reset the Arduino then it's working fine.

 

The LabVIEW code is same as continuous serial read with slight modification.

As far I have read the code is freezing because of the read operation. When it's getting an insufficient amount of data it's waiting for all the data to come through and getting stuck. There are few solutions that I have tried already. They are-

1. Change the read to Asynchronous/synchronous. -> didn't work.

2. Validate bytes at the port before reading -> here some interesting facts that are happening, before the read I am getting no bytes at the port to read but after the read,( if I read 40446) if I place Bytes at port property node then it's giving me there are two bytes left( as I was supposed to read 40448). If bytes at port worked before the read I could be certain about the read amount and the problem would be solved. -> so didn't work.

3. I tried to reinstall the NI-Serial driver-> didn't work.

 

Please help me if anyone has any Idea about this. ( I have attached my code below)

Thanks for reading the long post.


Viewing all articles
Browse latest Browse all 5565

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>