Go to Post I don't think we really fit into those rigidly defined categories, my team builds our robot. - AdamHeard [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 12-04-2014, 15:18
adciv adciv is offline
One Eyed Man
FRC #0836 (RoboBees)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2010
Location: Southern Maryland
Posts: 478
adciv is a name known to alladciv is a name known to alladciv is a name known to alladciv is a name known to alladciv is a name known to alladciv is a name known to all
On interrupts and analog sampling

We're starting to look at some of the more advanced functions in lab view and we have some questions.

What is the sampling rate of the analog inputs?

How many interrupts can we have per analog/digital input?

Are the interrupts triggered off the fpga or the processor?

What is the delay between the time an input changes and the interrupt is exerted?

How many interrupts can we have total?

Are there any other limitations concerning interupts?

The goal of this would be to eliminate polling inputs in the code.

Thank you for any help you can give us.
__________________
Quote:
Originally Posted by texarkana View Post
I would not want the task of devising a system that 50,000 very smart people try to outwit.
Reply With Quote
  #2   Spotlight this post!  
Unread 12-04-2014, 15:31
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,100
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: On interrupts and analog sampling

Quote:
Originally Posted by adciv View Post
The goal of this would be to eliminate polling inputs in the code.
Why? What is the problem you are trying to solve?


Reply With Quote
  #3   Spotlight this post!  
Unread 12-04-2014, 15:57
adciv adciv is offline
One Eyed Man
FRC #0836 (RoboBees)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2010
Location: Southern Maryland
Posts: 478
adciv is a name known to alladciv is a name known to alladciv is a name known to alladciv is a name known to alladciv is a name known to alladciv is a name known to all
Re: On interrupts and analog sampling

I want to eliminate the processor time used by needles polling of inputs that have not changed. If this operates similarly to the hardware interupts I've used in microprocessors then I should also be able to improve system response without consuming additional resources.
__________________
Quote:
Originally Posted by texarkana View Post
I would not want the task of devising a system that 50,000 very smart people try to outwit.
Reply With Quote
  #4   Spotlight this post!  
Unread 12-04-2014, 16:13
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,833
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: On interrupts and analog sampling

What is your understanding of how the FPGA works?

The FPGA processes all the robot inputs.
The processor where your code runs just asks the FPGA for the current values.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
Reply With Quote
  #5   Spotlight this post!  
Unread 12-04-2014, 16:34
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,100
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: On interrupts and analog sampling

Quote:
Originally Posted by adciv View Post
I want to eliminate the processor time used by needles polling of inputs that have not changed.
The only polling that should be going on in your code is in a control loop when your controller needs the feedback. As Mark mentioned in his post, the FPGA receives and processes the inputs independently of the CPU, and makes the results available on-demand from the CPU.

If you are considering running your controller code in an Interrupt Service Routine that is almost always a very bad idea.


Reply With Quote
  #6   Spotlight this post!  
Unread 12-04-2014, 17:42
adciv adciv is offline
One Eyed Man
FRC #0836 (RoboBees)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2010
Location: Southern Maryland
Posts: 478
adciv is a name known to alladciv is a name known to alladciv is a name known to alladciv is a name known to alladciv is a name known to alladciv is a name known to all
Re: On interrupts and analog sampling

My understanding is the fpga acts as a pass through. For all inputs and outputs and it is also how the system watchdog is controlled. The fpga is also where the Gyro analog value is integrated/processed, encoders are counted and possibly a few other things.

There is an explicit labview vi provided in the frc wpi VIs called interupt which is what I am trying to find out about. It pauses the code loop it is in until the condition is met. It appears to also use the fpga based on some of the calls I see when I examine it.

I am interested in using this over polling the sensors inputs on the robot. We have to pool these continuously in order to have some of the automation functions we use. Our poll rates have varied over the years from 100 ms to 20ms. If we could eliminate this in favor of interrupts based on when our sensor inputs change we could reduce our processor utilization.
__________________
Quote:
Originally Posted by texarkana View Post
I would not want the task of devising a system that 50,000 very smart people try to outwit.
Reply With Quote
  #7   Spotlight this post!  
Unread 12-04-2014, 23:46
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,100
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: On interrupts and analog sampling

Quote:
Originally Posted by adciv View Post
Our poll rates have varied over the years from 100 ms to 20ms. If we could eliminate this in favor of interrupts based on when our sensor inputs change we could reduce our processor utilization.
The amount of CPU it takes to retrieve updated inputs from FPGA every 20ms is miniscule. If you are running out of throughput margin, interrupts will not solve your problem.



Reply With Quote
  #8   Spotlight this post!  
Unread 13-04-2014, 08:00
adciv adciv is offline
One Eyed Man
FRC #0836 (RoboBees)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2010
Location: Southern Maryland
Posts: 478
adciv is a name known to alladciv is a name known to alladciv is a name known to alladciv is a name known to alladciv is a name known to alladciv is a name known to all
Re: On interrupts and analog sampling

Agreed, The processor time to retrieve it at 20ms is minimal. But if I'd like to get better performance, equal to 1ms for instance, along with the requisite processing of those inputs, that is not minimal. As to why I may want 1ms performance? Because I'm interested in the limits of the capabilities of the system.

Now, is it possible to get any of my questions answered at all? I asked this so I could to further my understanding of how the system works, not so I could justify why I'm asking the question in the first place.
__________________
Quote:
Originally Posted by texarkana View Post
I would not want the task of devising a system that 50,000 very smart people try to outwit.

Last edited by adciv : 13-04-2014 at 08:08.
Reply With Quote
  #9   Spotlight this post!  
Unread 13-04-2014, 08:09
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,752
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: On interrupts and analog sampling

I marked the direct answers with ***s. My advice is at the bottom.

-------------------------------------
What is the sampling rate of the analog inputs?
*** The number is dependent on the I/O module. It is printed on the case of each module, but may need some explanation. I believe you will find that it is 500kS/s aggregate. It can run slower, can throw away values, and WPILib implements a scan list which can read interleaved channels and doesn't have to read them sequentially. This allows some channels to effectively read higher rates and others lower.

How many interrupts can we have per analog/digital input?
*** Eight total, any mix.

Are the interrupts triggered off the fpga or the processor?
*** The fpga raises the interrupt on the cpu. The cpu executes a low level handler, and for LV, it runs a form of deferred procedure.

What is the delay between the time an input changes and the interrupt is exerted?
*** I don't have numbers for the latency between I/O and the scheduling of your code, but it should be quite small.

How many interrupts can we have total?
*** Eight.

Are there any other limitations concerning interrupts?
*** The limits are the I/O conditions that are programmed into the fpga. With the fpga tools, you could have alternate conditions and you could synthesize more.

The goal of this would be to eliminate polling inputs in the code.
*** Advice
As Ether pointed out, the code to grab a raw analog voltage is quick. The scaling calculations add a bit of overhead, but for most FRC mechanisms it is reasonable to use the simple polling loop to monitor and control your device. The interrupts are available and fair game, but they are a bit more advanced and you shouldn't overuse them.

For any given device that you are trying to control or respond to, I'd first calculate how quickly you need to respond. Use the distance and rate of travel, or whatever your phenomena is to calculate your response time. Can you afford to check once a second, ten times, one hundred times, or do you need to read even faster. As this number gets higher, the overhead of doing it in the CPU gets in the way, but this is dependent on how efficient you are at doing it. The interrupt mechanism essentially moves the poll into the fpga. It adds it to the latching code that moves the value from the bus into the buffer or register, accumulates, calculates a level trigger, etc. This is still polled, but it is now in someone else's loop.

I didn't find an FRC example for interrupts, and the one in Find Examples assumes you have the FPGA tools in order to compile for different cRIOs. So be sure to start with something simple and make sure that your assumptions are correct.

Greg McKaskle
Reply With Quote
  #10   Spotlight this post!  
Unread 13-04-2014, 08:16
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,752
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: On interrupts and analog sampling

Sorry I couldn't get to your post yesterday, I was at the MI state champs. It was far more exciting than reading CD.

I did find just a bit of documentation on FRC interrupts, like this http://first.wpi.edu/Images/CMS/Firs...UsersGuide.pdf page sixteen. It still isn't that in-depth.

Please post additional questions or findings as you get them.

Greg McKaskle
Reply With Quote
  #11   Spotlight this post!  
Unread 13-04-2014, 08:19
adciv adciv is offline
One Eyed Man
FRC #0836 (RoboBees)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2010
Location: Southern Maryland
Posts: 478
adciv is a name known to alladciv is a name known to alladciv is a name known to alladciv is a name known to alladciv is a name known to alladciv is a name known to all
Re: On interrupts and analog sampling

Thank you. We've been adjusting the polling rate for optimization, but sometimes we've had to slow down the system. In some years, we've had a large number of sensors and all the polling and processing starts to push us up higher than we'd prefer.
__________________
Quote:
Originally Posted by texarkana View Post
I would not want the task of devising a system that 50,000 very smart people try to outwit.
Reply With Quote
  #12   Spotlight this post!  
Unread 13-04-2014, 23:19
tcjinaz tcjinaz is offline
Tim
FRC #3853
Team Role: Mentor
 
Join Date: May 2011
Rookie Year: 2011
Location: Arizona
Posts: 206
tcjinaz has a spectacular aura abouttcjinaz has a spectacular aura about
Re: On interrupts and analog sampling

Quote:
Originally Posted by Greg McKaskle View Post
Sorry I couldn't get to your post yesterday, I was at the MI state champs. It was far more exciting than reading CD.

I did find just a bit of documentation on FRC interrupts, like this http://first.wpi.edu/Images/CMS/Firs...UsersGuide.pdf page sixteen. It still isn't that in-depth.

Please post additional questions or findings as you get them.

Greg McKaskle
Is the RTL for the FPGA is available? I know it will probably force me into VHDL, but I'll survive.
(just heading for really dangerous

Tim
I love acronyms; this post had a TLA, a FLA, and a nested FLA with an underlying five letter acronym...
__________________
Software Mentor
3853 Pridetronics[

Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 20:08.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi