04-30-2019 03:10 AM
Hi,
In our application we use VISA to read and write data to and from digital multimeters (Keysight Agilent - 34461A).
Our application is written in Java and uses JNI to communicate with the VISA library. Below the code of the read function.
The strange this is that this works fine for almost 3 days, reading and writing every 5 minutes the same type of data, and then the following error comes:
-1073807247: VI_ERROR_USER_BUF: A specified user buffer is not valid or cannot be accessed for the required size.
Any ideas / hints?
JNIEXPORT jstring JNICALL Java_com_es_suite_devices_visa_VISA_read (JNIEnv *env, jobject obj, jint handle) { viSetAttribute(vi[handle],VI_ATTR_TMO_VALUE,5000); char* buf = (char*)malloc(81000*16*sizeof(char)); ViUInt32 byteCnt; printf("about to read using VI"); status = viRead (vi[handle], buf, 80000*16, &byteCnt); printf("status:", status); jstring result = (*env)->NewStringUTF(env,buf); free(buf); return result; }
05-01-2019 05:39 AM
Hey CKETELEER,
This might take some time to troubleshoot as it's happening over 3 days... but some points to get you started:
Hope this helps, let us know how you get on.
Rebecca
05-02-2019 06:44 AM
Are you sure that
char* buf = (char*)malloc(81000*16*sizeof(char));
doesn't fail when the error occurs ?