From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read Operation Error VISA: (Hex 0xBFFF0015) Timeout expired before operation completed.

Hi

I'm using Labview 2017.

I want to control a DC motor via  Roboclaw 2X7A motor controller using VISA commands.

I'm using USB serial mode to communicate with it.

So when I tried using the windows driver (software that the company gave) it works pretty fine and I was able to control the duty cycle.

 

Now I opened up VISA test panel in MAX and then tried the basic command *IDN? .This runs into the famous timeout expired error.I tried the possible fixes by reinstalling the drivers that were mentioned in the help.

I have attached the image below for the same.

 

I also tried a basic serial read and write vi in labview ,but it results in the same error.

There is something that I'm missing .

Can you please help in this regard as I have very less time left to finish the deadline.

 

Looking forward

Regards

Denesh

Download All
0 Kudos
Message 1 of 8
(4,445 Views)

Did you look at the manual for it? A quick search of the manual found no *IDN? command. Not all instruments have this command.

 

mcduff

Message 2 of 8
(4,435 Views)

Thanks for the prompt reply.

It's true that the command isn't available on the manual.

So I tried a command from page 64 on the manual which is to drive the motor  forward.The same error persists even then.

I'll attach the screenshot.

 

Regards

0 Kudos
Message 3 of 8
(4,424 Views)

The one thing that stands out in your command is the 'CRC(2 bytes)'. 

It is not supposed to be the literal text, it is a number based on the CRC calculation shown on pg 60 of the manual.

 

-AK2DM

~~~~~~~~~~~~~~~~~~~~~~~~~~
"It’s the questions that drive us.”
~~~~~~~~~~~~~~~~~~~~~~~~~~
Message 4 of 8
(4,419 Views)

Ah that's right .I need to try out the command .I remember that there was a snippet in C in the manual for calculating the crc function.(Pg 60 out of 104 from the manual).

This is the code:

 

#include <stdio.h>
//Calculates CRC16 of nBytes of data in byte array message
unsigned int crc16(unsigned char *packet, int nBytes) {
    for (int byte = 0; byte < nBytes; byte++) {
        unsigned int crc = crc ^ ((unsigned int)packet[byte] << 8);
        for (unsigned char bit = 0; bit < 8; bit++) {
            if (crc & 0x8000) {
                crc = (crc << 1) ^ 0x1021;
            } else {
                crc = crc << 1;
            }
        }
    }
    return crc;
}
int main()
{
        printf("%u\n",crc16(00000001,2));  //For calculating crc16(2 bytes).
    return 0;
}

 

It ran into some errors when I tried compiling it.I'll give it a shot again.

Could you have a look at the code and let me know the exact argument and its type that I need to pass to this function?

I'm assuming that the first argument is the address which passed as "00000001" which I believe is wrong.

Please help

Thanks.

Regards

0 Kudos
Message 5 of 8
(4,414 Views)

Now I  did figure out the way to calculate CRC(2 bytes).Have to give the address "0x80" as the first input argument and 2 as the second.

But that dosn't still solve the error.

There is a different command just to read the status without the crc16 calculation.It's format as given in the manual is: [Address, 90]

So I gave input as 128,90.

Neverthless the same error still persists.

I'm trying these in the VISA test panel in MAX now.I'll attach the image in the end.

Any suggestions?

 

Regards

Denesh

0 Kudos
Message 6 of 8
(4,391 Views)

So you are writing "128,90"  ?  It says you are writing out 6 bytes.

 

In any communication I've used where it was a binary type of protocol, you send bytes of those values.  You should be sending a byte of value 128 and a byte of value 90.  If written in hex, it would be 80 and 5A.  Try wiring a string constant set for hex display and enter 805A.

 

You say you've successfully used the company's software.  Try using a port sniffing program while you are using that so you can see exactly what that is sending out, then duplicate that message with LabVIEW.

Message 7 of 8
(4,372 Views)

Yes that makes sense.Thanks!

I was able to get away from this by using the labview drivers available in the company's website.They made the job easier.I'll try what you suggested anyway.

 

Thanks again

Regards

0 Kudos
Message 8 of 8
(4,370 Views)