FIRST Robotics Competition Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Analog Trigger as Counter Source

Solved!
Go to solution

We've encountered an intermittant issue. We are using an analog trigger as the source for a counter in a manner very similar to what we did last year as descdribed in this thread. At times, this works wonderfully and expected counter values and periods are returned. However, at times, the counter appears not to count at all. It always returns a count of 1, an infinite period, that the counter is stopped, and no error. When this occurs, we can verify that the analog signal is correct and should be triggering. It i as if the analog trigger is no longer routed to the FPGA counter or the counter is disabled.

Once this issue occurs, it continues until we power-cycle the cRIO. Power cycling the cRIO usually, but not always, results in the counter working again as expected. This behavior makes me wonder if the issue isn't related to resource management in that the FPGA counter isn't released and reacquired between runs or deployments of the code on the cRIO. I doubt we are stoping or closing the counter or closing the analog trigger, but I didn't think this would matter.

I thought this may be related to the race condition described in this thread, but we don't observe an error from Analog Trigger Open and have implenented the data-dependency workaround.

I modified the example I created last year for this year and have attached it. However, just to be clear, we haven't had an opportunity to reproduce this issue with this example. We will try this tomorrow. I'm posting it to provide some context and hopefully others have encountered this issue and are aware of a workaround.

geoff

--
Geoff Schmit
Huskie Robotics, FIRST Team 3061 Lead Mentor
http://team3061.org/
@team3061
0 Kudos
Message 1 of 2
(4,028 Views)
Solution
Accepted by topic author gcs

Sorry for the false alarm. The issue was specific to our code and due to a race condition we introduced. An updated version of the example program that adds the necessary data dependency to work around the above referenced issue is attached in case anyone has similar needs.

geoff

--
Geoff Schmit
Huskie Robotics, FIRST Team 3061 Lead Mentor
http://team3061.org/
@team3061
0 Kudos
Message 2 of 2
(2,958 Views)