Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

RT code does not work on the cRIO more than once

I can not run the same RT code on my cRIO more than once, If I stop the program I have to restart the cRIO in order to compile the RT code again.

I am using a Flat squence in my code, the first sequence is to make the settings and open the FPGA target, the middle squence obtains 6 indivisual while loops which share the same stop button, and the last sequence is where we close the FPGA target and list the errors.

No errors come up. when i press the end button all the loops stop working and it goes to last sequence to close the FPGA taget, so I guess there should be no more code running on the target.

when i click tun on the RT cide again, some times i get the error that the target is disconnected, some times i get the error there is another application running on the target.

What could be the problem?

 

0 Kudos
Message 1 of 9
(6,728 Views)

Hi Amir,

 

It would be hugely useful if you could post you code... and, perhaps, a screen capture of the behaviour you are seeing. A picture paints a thousand words, as they say

 

Robot Happy

 

In the mean time, "the target being disconnected" could be due to the RT CPU being maxed out - effectively starving the network communications. Are you controlling the execution rate of the 6 loops that make up the main body of your code? What sort of CPU usage do you see when the code is running (check this with distributed system manager)?

 

Also, which versions of software have you deployed to you cRIO? There was a well-documented bug with timesync 1.1.1 that caused cRIOs to become unresponsive. It has since been resolved in newer versions of the RIO software. Please see the following KB for more details.

 

http://digital.ni.com/public.nsf/allkb/ACBF4794FF06C0EC8625796B0050B001

 

Some final food for thought...

I am surprised that you are not seeing any errors. Are you monitoring error clusters throughout your code?

Are you confident that execution does reach your 3rd sequence cell (the shut down stage)? Could execution be stuck somewhere in the preceeding code?

 

Thanks for your time,

Best wishes,

Rich Roberts
Senior Marketing Engineer, National Instruments
Connect on LinkedIn: https://www.linkedin.com/in/richard-roberts-4176a27b/
Message 2 of 9
(6,702 Views)

Hi Rich

Thanks for your reply; it is always nice to see someone is here to help.

 

I have attached the RT and FPGA code I wrote, (I made it as clean as I could). I am controlling the execution rate of the 6 loops that make up the main body of my code, you can see in the code that FPGA reference out is connected to individual read write controls for each loop, I don’t know if it is necessary to connect them all to separate close FPGA targets!

 

I personally think my last loop (accelerometer) made so much trouble for the cRIO! From the first day when I added the basic average RMS/DC.vi in the code it started to act strangely.

 

I have attached a photo from MAX showing the software installed on cRIO, I don’t see any timesync!

 

I don’t see any errors in the error clusters, and I am sure it does reach the last sequence. I do not have access to the cRIO right now, I should get it back next week, and then I will send you some photos from the errors I get when trying to run the RT code again.

 

And about CPU, well, when the RT code is running it usually goes up to 70% usage. But the last time I checked, when I clicked the stop button it went up to 100% and never came back down, when I click the run button again nothing worked (it was showing that it was running but no readings, like a freezed screen), and then when I clicked the stop button it was not stopping anything.

 

So what do you think the problem is?

0 Kudos
Message 3 of 9
(6,686 Views)

Thanks for the response. The issue you mention regarding the increased CPU useage when you stop the code concerns me. 

 

Could you please work towards confirming whether execution reaches the final frame? Even if you add a front panel LED to turn on in that final frame.

 

If code does reach the final frame (thereby confirming that all of the main body of code in frame 2 has finished), then the CPU usage must be a consequence of that final frame.

 

Does the 100% CPU usage occur even when you make the "FTP Log File" button false? If not, the culpret could be the FTP file put function.

 

Disable FTP Log.JPG

 

I would also recommend wiring the error wires throughout all of your code, merging them to a single wire, and wiring them to an error out indictator on the front panel. I would remove the simple error handler functions, and just rely on that front panel control.

 

For instance, the "error out 2" indicator in the above image will only show an error genberated from the FTP and file delete function... not from anywhere else in your code. And, ofcourse, if the false case executes you will will only see a default error (ie. no error!)

 

Thanks,

Rich Roberts
Senior Marketing Engineer, National Instruments
Connect on LinkedIn: https://www.linkedin.com/in/richard-roberts-4176a27b/
0 Kudos
Message 4 of 9
(6,678 Views)

Hi Rich

I just saw the CPU thing myself too, I don’t have the cRIO here now but I can check it using a remote screen application. Now that I checked the memory usage while my colleague is using it, it goes up to 99% when running the RT code while CPU usage stays at 69%; I guess that is not good! Robot surprised

I will be able to check if the code reaches the last frame by Tuesday, but I know for sure that it will do the same even if the FTP log file is false (it is on false by default).

I will fix the wirings for errors too. May I ask if you see any problems with the last loop? I remember when I did add that average “RMS/DC.vi” it was giving me an error that a library is not found on the target so it could not load the code and still when I restarted the cRIO it did run it with no errors. That error happened randomly but not always, and it had a word “RMS” inside that library that is why I think it could be a problem.

Still, I know if I send you some images of the errors I get, you will understand me better. I will do that as soon as I have the hardware back.  

Thank you for your help

Amir

0 Kudos
Message 5 of 9
(6,675 Views)

Hi Rich

Today was the testing day; here are the results of the tests:

The code definitely goes to the last frame, I did put an LED indicator which goes to true if the code gets to the last frame. I fixed the error wirings by connecting them all to a “mergserrors.vi” and then to an “errorout” indicator.

The result is still the same, here is what happened:

1-      I ran the RT code for the first time, the code was loaded to the cRIO and was running as expected, and the CPU usage went up to 75%.

2-      I stopped the code the CPU usage went back to about 5%, I started it again and it went back to 75% and was working fine.

3-      Then I stopped it again but this time when I clicked run, the CPU went to 100% and there was nothing happening other than one of my LEDs was blinking on the screen (that is what it is suppose to do in the code).

In all cases I checked to see if the code reaches the last frame and it did. I did not change nothing else in the code what so ever. There were no errors in the error out.

I have attached a screen shot from NI distributed system manager. (cpu-usage.png)

After the above problem I tried to restart the cRIO using MAX and I got the error in image (max-error.png); I did wait for another 20 seconds and tried again, this time it did restart the device with no errors.

After restarting I tried to run the RT code again, and it gave me the error in image (after-restart.png); again I did wait for another 20 seconds and it did run the code correctly.

I have done the start and stop test again on it and same results, the third time it did not run the code as expected.

Second test:

This time I changed something in the RT code after running the first time. I added an indicator and a switch to the code to make the code different from what it was. Here is the error I got when tried to run it again (code-change.png).

When I restarted the cRIO with MAX and ran the code again everything seemed to be fine. I stopped the code again and pressed run, same CPU problem.

I hope that was clear. Now what shall we do?! Robot Sad

Amir 

Download All
0 Kudos
Message 6 of 9
(6,631 Views)

here is the image for last error i could not attach it to the same message: 

0 Kudos
Message 7 of 9
(6,630 Views)

Here is an update on the problem, it does not matter how many times I click on run until the system stops working but the amount of time it was running the first time. If we leave it on for a long time and then stop and rerun it, it wont work.

0 Kudos
Message 8 of 9
(6,578 Views)

Hi Amir, 

 

Are you still having problems with you cRIO code? 

What is the status of the problem? 

The message on the code-change picture appears to say its a possible issue with the software on you cRIO, Have you checked and loaded all the software onto your cRIO correctly through MAX? 

Since your last messages have you tryed any other steps to try and resolve your problem? 

 

Thanks,

Nathan
Applications Engineer
National Instruments UK & Ireland
0 Kudos
Message 9 of 9
(6,445 Views)