03-09-2023 09:47 AM - edited 03-09-2023 09:49 AM
Hi everybody, long story short. Our society buyed a ready to use acquisition system beased on cRIO 9056, + some modules (2x ni 9208, 1 x ni 9239 ,ni 9423, ni 9411 , ni 9481). we work on windows 10 x64 under qt and visual studio msvc 2019 x64
Unfortunatly we've been ripped off,as the software does not do half the job we need and we do not have any response to our questions.
We decided to implement our own.
1) we do not have the admin password , so we can't update rio internal drivers are in 20.1
2) we downloaded both ni-compactrio-device-drivers_20.5_suite_online_repack and ni-daqmx_20.1_online_repack3 and installed them on our computer
3) max is working fine, and see all the hardware (cf image1.png)
4) auto test is ok
5)test panel are working fine (cf image2.png)
6)the ip address of the cRio is reachable, the rio and all the hardware are seen as remote systems.
So we decided to test the data acquisition through nidamx library very insired from a ni sample program
#include <stdio.h>
#include <NIDAQmx.h>
#define DAQmxErrChk(functionCall) if( DAQmxFailed(error=(functionCall)) ) goto Error; else
int32 CVICALLBACK EveryNCallback(TaskHandle taskHandle, int32 everyNsamplesEventType, uInt32 nSamples, void *callbackData);
int32 CVICALLBACK DoneCallback(TaskHandle taskHandle, int32 status, void *callbackData);
int main(void)
{
int error=0;
char errBuff[2048]={'\0'};
TaskHandle taskHandle=0;
/*********************************************/
// DAQmx Configure Code
/*********************************************/
DAQmxErrChk(DAQmxCreateTask("", &taskHandle));
DAQmxErrChk(DAQmxCreateAICurrentChan(taskHandle, "Mod1/ai0", "", DAQmx_Val_Cfg_Default, -0.020, 0.020, DAQmx_Val_Current, DAQmx_Val_Default, 249.0, ""));
getchar();
return 0;
}
Error:
if( DAQmxFailed(error) )
DAQmxGetExtendedErrorInfo(errBuff,2048);
if( taskHandle!=0 ) {
/*********************************************/
// DAQmx Stop Code
/*********************************************/
DAQmxStopTask(taskHandle);
DAQmxClearTask(taskHandle);
}
if( DAQmxFailed(error) )
printf("DAQmx Error %s",errBuff);
printf("End of program, press Enter key to quit\n");
getchar();
return 0;
}
int32 CVICALLBACK EveryNCallback(TaskHandle taskHandle, int32 everyNsamplesEventType, uInt32 nSamples, void *callbackData)
{
int32 error=0;
char errBuff[2048]={'\0'};
static int totalRead=0;
int32 read=0;
float64 data[1000];
/*********************************************/
// DAQmx Read Code
/*********************************************/
DAQmxErrChk (DAQmxReadAnalogF64(taskHandle,1000,10.0,DAQmx_Val_GroupByScanNumber,data,1000,&read,NULL));
if( read>0 ) {
printf("Acquired %d samples. Total %d\r",(int)read,(int)(totalRead+=read));
fflush(stdout);
}
Error:
if( DAQmxFailed(error) ) {
DAQmxGetExtendedErrorInfo(errBuff,2048);
/*********************************************/
// DAQmx Stop Code
/*********************************************/
DAQmxStopTask(taskHandle);
DAQmxClearTask(taskHandle);
printf("DAQmx Error: %s\n",errBuff);
}
return 0;
}
int32 CVICALLBACK DoneCallback(TaskHandle taskHandle, int32 status, void *callbackData)
{
int32 error=0;
char errBuff[2048]={'\0'};
// Check to see if an error stopped the task.
DAQmxErrChk (status);
Error:
if( DAQmxFailed(error) ) {
DAQmxGetExtendedErrorInfo(errBuff,2048);
DAQmxClearTask(taskHandle);
printf("DAQmx Error: %s\n",errBuff);
}
return 0;
}
As you can see it's just the configuration code for now, the callback is not set yet.
Unfortunatly we've got this error:
DAQmx Error Device identifier is invalid.
Device Specified: Mod1
Task Name: _unnamedTask<0>
Status Code: -200220End of program, press Enter key to quit
we tried "Mod1/ai0", "cRIO1/Mod1/ai0", and as many combination we could think about with the same result.
So for now we are stuck... soon we'll be done unfortunatly.
Any idea of what can be wrong, where is our mistake ?
Thank you very much.
Have a nice day.
Solved! Go to Solution.
03-09-2023 01:12 PM
Firstly, you can reformat the cRIO using a bootable USB to remove the password. See Provisioning a Controller to the NI Linux Real-Time Operating System. You can skip the BIOS updating and configuration part.
You are seeing the error because you are running the code on the Windows host PC and the program is searching for the resource on the Windows. To access the resource on the cRIO, you must deploy the code to the cRIO. And since cRIO is running Linux RT, the program must be compiled for Linux. See Cross-Compiling ANSI C NI-DAQmx Examples for Linux RT Using Microsoft Visual Studio Code
03-10-2023 02:15 AM
Oh, thank you very much for the quick answer. I'm not very familiar with Ni instruments.
So, first question that comes in my mind is:
Ok, I presume it may be possible, to format the cRio, but i'm very afraid to start with something that does not fit our needs, to nothing at all.
1) is there a way to backup and restore the cRio to prevent a desaster ?
2) in fact the project is "simply" to find a way to add a reading of anlalogs/digitals and writing to some digital , and relay all that trough a whatever protocol for example modbus.
As it we will be able to add our own calculation engine and data analysis sytem on top of the way too basic actual software.
n.b. we are absolute beginner with ni hardware/software, and in fact our job is to compute from datas not to acquire those datas. So your help is very appreciated.
Thank you very much.
03-10-2023 08:44 AM
1) is there a way to backup and restore the cRio to prevent a desaster ?
When we talk about backing up files, it is usually just backing up important files, not the entire OS. Considering that you just start using that cRIO, I don't think you have any important files saved on the cRIO yet. Formatting is the process of booting from an external USB, instead of the hard disk on the cRIO. The installation USB will then wipe up the entire disk and install the fresh OS. The formatting actually restores the hard disk to a workable state, if the OS is not working due to file corruption.
2) in fact the project is "simply" to find a way to add a reading of anlalogs/digitals and writing to some digital , and relay all that trough a whatever protocol for example modbus.
As it we will be able to add our own calculation engine and data analysis sytem on top of the way too basic actual software.
There is another way of acquiring data without deploying the program to the cRIO, via ni/grpc-device: gRPC server providing remote access to NI device driver APIs.
Basically, you install the gRPC server on the cRIO, then you can use gRPC client API (C# or Python) from the Windows host PC. However, the communicate is done via TCP/IP and this introduces some latency. Since you are writing to digital at the same time, if the program changes the output based on the input, I wouldn't recommend using this method as there will be an obvious delay for the control. You should stick with the C programming that runs on the cRIO directly.
in fact our job is to compute from datas not to acquire those datas.
I don't understand. How can you compute the data without acquiring the data in the first place?
03-10-2023 12:10 PM
The Replication And Deployment (RAD) utility can be used to backup and retore cRIO targets. The bad news is, if you do not have the Admin password for the target it may not work, and you will have to restore the Linux OS by creating a Restore USB drive.
You will also need to download and install the NI Linux RT System Image. This contains the runtime NI Linux RT OS and the software/drivers that need to be installed on the cRIO. You perform all the installation with NI MAX.
As for the code sample you posted, it looks like it is a LabWindows/CVI example, as I see CVICallback functions (event handlers). If you plan on writing code for the cRIO take a look at the tutorials for cross compiling on a NI Linux RT target.
If you are not familiar with the cRIO, you should note that it consists a processor running a real time version of Linux (NI Linux RT), that you can access through an SSH session. There is also and FPGA that, if you wish, can be programmed. If you are using NI-DAQmx mode the FPGA is not something you need to worry about.
03-17-2023 01:25 AM
@ZYOng for what you do not understand: yes of course you are right, data acquisition comes in the first place, however usually or we use an acquisition we masterize and that runs a "whatever-bus", mainly modbus that sends raw datas in binary, or and this is the case here, we buy a system from somebody that is supposed to meet our specification. You need to understand we are only 2 coders and there's a huge project to realize.
Thank you all anyway, the people how made the acquisition system finally gave us the admin password. With your advise, we may be able
1) to backup and restore the system, security first, loose all if we do not succed the next step could lead to a worse situation.
2) use C, as we are not familiar at all with labview for now to implement a modbus slave tcp/ip server, or in place or on top of the existant.
So, I may post for asking some help times to times but fortunatly I see now some solutions, and it leads us to think about the cRio twice.
To be honnest, I was very near to decide "we will not use this .!**###5''((" , it's expensive, it's a blackbox, it does not do what we want.
The fact is more complex, for some reason , somebody did not do a good job with it. The hardware is still expensive BUT now, we realize that we have a kind of FPGA soc with a RT Linux in hands, and may be , with experience, we will be able to make it gives us much more than we expected at a first glance.
The bad news, is we are a very little society with very litlle founding and France is not like US. "Is there some risk with you project ?" "Of course ! it's r&d , it's a proof of concept !" "then ... bye bye"
The good news is we are looking for fundings, and now, if we got the results we expect, NI hardware is on the table and we look at it as it is, may be a step forward that will unlock or ease some new features in our project.
So, something bad happened that could lead to something good as a result.