Go to Post That box you think you see is only an illusion. - Alan Anderson [more]
Home
Go Back   Chief Delphi > Technical > Electrical > CAN
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 04-04-2011, 07:45 PM
John Heden John Heden is offline
Registered User
FRC #1073
 
Join Date: Jan 2011
Location: Hollis, NH
Posts: 29
John Heden is an unknown quantity at this point
Re: Unexplained intermittent CAN / 2CAN Jaguar problems at GSR

Quote:
Originally Posted by jtdowney View Post
R50A states "The DAP-1522 radio is connected to the cRIO-FRC Ethernet port 1 (either directly or via a CAT5 Ethernet pigtail)." We took this to mean that under no circumstance can an active device (2CAN) sit between the DAP-1522 and the cRIO. That leaves two choices, connect the 2CAN to the DAP-1522 or connect the 2CAN to Ethernet port 2 on the cRIO.

My teams robot (programmed with Java using IterativeRobot) has gone through one event with our 2CAN plugged into our DAP-1522 and have had no CAN related trouble. We were running cRIO v28 (v29 wasn't out at the time) and 2CAN firmware v2.5 with the SVN rev 66 plugin on the cRIO. We have 6 black jaguars on the CAN bus with no sensor inputs or limit switches.

Perhaps we were very fortunate during our regional but we have not had any serious CAN issues (knock on wood) since build. All of our trouble then could be traced back to poorly made cables when we did have problems.

I am hoping our luck caries us through championship.
Greetings,

R59 adds some expansion to R50 stating:
<R59> If CAN-bus communications are used, the CAN-bus must be connected to the cRIO-FRC through either the Ethernet network connected to Port 1, Port 2, or the DB-9 RS-232 port connection.

Our 2CAN connection directly to the radio is probably a rule violation (inadvertent) but was an attempt to prevent errors when we were connected (legally) to port 1. A port 2 to 2CAN connection will be our next experiment to try to avoid this issue.

john
Reply With Quote
  #2   Spotlight this post!  
Unread 04-04-2011, 09:16 PM
jtdowney jtdowney is offline
Boiler Up
AKA: John Downey
FRC #4302 (Robophins)
Team Role: Mentor
 
Join Date: Sep 2006
Rookie Year: 2006
Location: Chicago
Posts: 300
jtdowney has a brilliant futurejtdowney has a brilliant futurejtdowney has a brilliant futurejtdowney has a brilliant futurejtdowney has a brilliant futurejtdowney has a brilliant futurejtdowney has a brilliant futurejtdowney has a brilliant futurejtdowney has a brilliant futurejtdowney has a brilliant futurejtdowney has a brilliant future
Re: Unexplained intermittent CAN / 2CAN Jaguar problems at GSR

Quote:
Originally Posted by John Heden View Post
Greetings,

R59 adds some expansion to R50 stating:
<R59> If CAN-bus communications are used, the CAN-bus must be connected to the cRIO-FRC through either the Ethernet network connected to Port 1, Port 2, or the DB-9 RS-232 port connection.

Our 2CAN connection directly to the radio is probably a rule violation (inadvertent) but was an attempt to prevent errors when we were connected (legally) to port 1. A port 2 to 2CAN connection will be our next experiment to try to avoid this issue.

john
What R59 means to me is that the 2CAN (or any custom circuit) is allowed to be on the 10.0.0.0/8 subnet and communicate through port 1 by being connected to the DAP-1522. It does not mean you can directly wire the 2CAN between the cRIO and the DAP-1522 because that would violate R50.
__________________
John Downey
Lead Robot Inspector - Purdue IndianaFIRST District
Whitney Young Magnet High School/Robophins (FRC 4302) - Mentor (2013-current)
Midwest Regional Planning Committee - Member (2012-current)
Boilermaker Regional Planning Committee - Member (2011-2014)
Robot Inspector (2008-current)
Purdue FIRST Programs - Staff Advisor (2008-2011)
Lafayette-Jefferson High School/Precision Guessworks (FRC 1646) - Mentor (2006-2011)
Reply With Quote
  #3   Spotlight this post!  
Unread 04-04-2011, 10:05 PM
MikeE's Avatar
MikeE MikeE is offline
Wrecking nice beaches since 1990
no team (Volunteer)
Team Role: Engineer
 
Join Date: Nov 2008
Rookie Year: 2008
Location: New England -> Alaska
Posts: 381
MikeE has a reputation beyond reputeMikeE has a reputation beyond reputeMikeE has a reputation beyond reputeMikeE has a reputation beyond reputeMikeE has a reputation beyond reputeMikeE has a reputation beyond reputeMikeE has a reputation beyond reputeMikeE has a reputation beyond reputeMikeE has a reputation beyond reputeMikeE has a reputation beyond reputeMikeE has a reputation beyond repute
Re: Unexplained intermittent CAN / 2CAN Jaguar problems at GSR

I was experimenting with the CAN bus on our spare electronics board earlier and discovered some characteristics caused by termination problems which might be helpful.
I'm not claiming this is the cause of many, or indeed any, CAN issues for other teams but it is one potential failure mode.

Our practice board uses the documented terminator of an RJ-12 with a 100ohm resistor crimped between pins 3 & 4. (We also added a short length of telephone wire crimped into pins 1 & 6 as a handle for insertion / extraction which I don't believe has any bearing on the issues.)
DMM testing showed a ~100ohm resistance as expected. However at some stage the resistor leads had bent towards each other to the point where they were almost touching, creating a potential short on the CANH & CANL lines. Mechanical shock could potentially cause them to touch for an instant.

I discovered that when the lines were shorted even briefly the CAN bus failed completely. Interestingly, removing the short did not restore CAN, and neither did removing the short and rebooting the cRIO. However removing the short and power-cycling the robot did restore CAN. I predict that just power-cycling the Jaguars would have the same effect, but I didn't test this (although our code would still need to be rerun to initialize CAN properly).

We are using serial-CAN so we could still control the bridging BlackJag using RS232 while the CAN bus was out. I conclude that only seeing the bridging Jaguar is a useful diagnostic indicator for a potential terminator problem - sorry 2CAN users.

Last edited by MikeE : 04-04-2011 at 10:07 PM. Reason: stylistic reasons
Reply With Quote
  #4   Spotlight this post!  
Unread 04-05-2011, 12:03 AM
drakesword drakesword is offline
Registered User
AKA: Bryant
FRC #0346 (Robohawks)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2004
Location: USA
Posts: 200
drakesword is on a distinguished road
Re: Unexplained intermittent CAN / 2CAN Jaguar problems at GSR

Did some experimenting this weekend

We used last years robot with a 2CAN on port 1 and tested the following with 4 jags. Using code to time, we ran the robot for two minutes and printed out the total number of errors

A) 6 Conductor wires with bad routing (had a few cables wrapped around power cables)
B) 6 Conductor wires with good routing (not near power wires)
C) 2 Conductor wires with bad routing
D) 2 Conductor wires with good routing
E) 120 Ohm Termination
F) 100 Ohm Termination
G) Using PID
H) Using just voltage control
I) Having a dead battery

A C E F Had an average of 16 errors
B Had an average of 12 errors
*G Had an average of 17 errors*
H Had an average of 8 Errors
I Had an average of 29 Errors

Now an interesting trend we saw with PID marked with *
Not many errors were seen with just normal movements. We used current control first set to max at 40 Amps then set with 20 amps max. With 40 amps the robot drove without a problem. With 20 amps we had issues turning (wheels are out of alignment) but more interesting was when the robot stalled or near stalled (with 20 amps) we through MANY MANY MORE errors then if we didnt stall. So at a 20 amp stall there were more can errors. But with draws approaching 40 amps (without stalling) there were less errors.

This seems to indicate more along the lines of an issue with either the firmware on the JAG with PID and higher calculation or with the driver on the cRIO waiting for a response that cannot be returned due to said calculations . . .

Obviously with a low battery or high draws you will have more errors due to jags browning out.
Reply With Quote
  #5   Spotlight this post!  
Unread 04-05-2011, 09:27 AM
Hugh Meyer's Avatar
Hugh Meyer Hugh Meyer is offline
Registered User
FRC #1741 (Red Alert Robotics)
Team Role: Mentor
 
Join Date: Feb 2009
Rookie Year: 2008
Location: Greenwood Indiana
Posts: 158
Hugh Meyer has much to be proud ofHugh Meyer has much to be proud ofHugh Meyer has much to be proud ofHugh Meyer has much to be proud ofHugh Meyer has much to be proud ofHugh Meyer has much to be proud ofHugh Meyer has much to be proud ofHugh Meyer has much to be proud of
Re: Unexplained intermittent CAN / 2CAN Jaguar problems at GSR

Bryant,

How did the "D" option turn out? I didn't see it in the results.

-Hugh
Reply With Quote
  #6   Spotlight this post!  
Unread 04-05-2011, 11:16 AM
drakesword drakesword is offline
Registered User
AKA: Bryant
FRC #0346 (Robohawks)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2004
Location: USA
Posts: 200
drakesword is on a distinguished road
Re: Unexplained intermittent CAN / 2CAN Jaguar problems at GSR

Sorry forgot to list it.

Yes the average was 11 errors which we didn't find as a significant improvement over B.


Another small note I forgot to add is that with B and D is we encountered these errors even if the robot was not moving at all for the entire 2 minutes.

I do believe the case that it is processor starving.

I have not looked at the source of the jag firmware but does thae jag ever decide to "drop" a frame to keep up with timing of the PID? Or could there be an interrupt overriding the sending of a frame?

When I was messing with the jags on my own I was sending one frame to each Jag I wanted to control. Then the jags would execute the command until another one was sent.

So in that situation I would say "Move the motor X rotations" and not do anything else. The Jag happily went on its job making the motor go X revolutions.

Its my understanding that this has been modified for safety (which is understandable) to require the "trusted" heartbeat. Does anyone know the interval that the heartbeat must be receive in order to keep it alive? and Does anyone know the actually rate in which the heartbeat is being sent?
Reply With Quote
  #7   Spotlight this post!  
Unread 04-05-2011, 12:35 PM
mjcoss mjcoss is offline
Registered User
FRC #0303
 
Join Date: Jan 2009
Location: Bridgewater,NJ
Posts: 70
mjcoss is a jewel in the roughmjcoss is a jewel in the roughmjcoss is a jewel in the roughmjcoss is a jewel in the rough
Re: Unexplained intermittent CAN / 2CAN Jaguar problems at GSR

I'm all in favor of trying to standardize information and see if any picture emerges.

1) Correct/Proper wiring both CAN and Power.
CAN wiring is correct, and has proper termination
2) Ground isolation of components.
Not sure about this.
3) CAN Interface used, Serial or 2CAN
2CAN connected to port 2 of CRIO. Currently running firmware 2.1, but think that updating to 2.5 would be a good idea.
4) Type of JAGS used, Black, Grey, Both
9 Black Jags all running firmware 92.
5) The programming language used
C++
6) The control mode(s) used.
Voltage mode
7) encoders, pots, limit switches are being used.
limit switches are connected to 3 Jags

We built two robots, and so I've been playing with our B bot to see if I can find the root cause of our timeouts.

Some observations:
1) Even in disabled mode, I occasionally see timeouts. Now there is some polling done in disabled mode to check the status of the limit switches, but the traffic should small, and there really shouldn't be any problem at all.

2) I did accidentally make the problem worse, and this lead me to believe that it was a CAN bus bandwidth issue. Instead of using the Jaguars to implement a PID loop for our lifter, we are using the CRIO. I created a separate task to monitor the setpoint, and speed adjustments. Originally, the task ran 100 times a second. This triggered a large number of timeout messages. Slowing down the task down reduced the timeout messages. But after reading through this thread, it's not clear to me why this should be the case.

3) Autonomous mode seems to be much more sensitive to timeout issues than teleop.

And finally one question: I've seen posts in this thread that suggest adding capacitors to reduce noise. Is there any consensus on doing that? What size capacitors? How exactly should they be wired?

Thanks.
Reply With Quote
  #8   Spotlight this post!  
Unread 04-05-2011, 11:09 PM
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
Re: Unexplained intermittent CAN / 2CAN Jaguar problems at GSR

A heartbeat or trusted command is required every 100ms for a Jaguar to stay enabled.
(The "set output" messages are trusted commands. The heartbeat will keep all the Jaguars enabled, but if you want to use trusted commands, you will need to update the output of every Jaguar that you want to keep enabled.)
I believe resuming the heartbeat will NOT cause your motors to move again if the output is not re-sent. (This makes sense with the behavior I remember, but I have not explicitly tested for this behavior.)

EDIT:
mjcoss, I can probably answer some of your questions.

Yes, in updating all your motors every 10ms, you will see many timeout issues. Setting the output takes 5-10ms (often 8ms) for a single Jaguar.

Autonomous is likely more sensitive than Teleop because Teleop sends the output continuously(Theoretically this is every 20ms, but with 4 Jaguars it could be as slow as every 40ms. In LabVIEW, the drive motors are dealt with in near-parallel, which reduces the time by about 50%. I don't know if the other languages do this as well.)
In Autonomous, the output is usually only updated when it changes. This means that if the heartbeat is temporarily prevented from getting through, it will not do anything when it finally DOES get through, unless you've used a trusted output command.
__________________
-- Marshal Horn

Last edited by kamocat : 04-05-2011 at 11:21 PM.
Reply With Quote
  #9   Spotlight this post!  
Unread 04-06-2011, 01:21 AM
Radical Pi Radical Pi is offline
Putting the Jumper in the Bumper
AKA: Ian Thompson
FRC #0639 (Code Red Robotics)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2010
Location: New York
Posts: 655
Radical Pi has a spectacular aura aboutRadical Pi has a spectacular aura aboutRadical Pi has a spectacular aura about
Re: Unexplained intermittent CAN / 2CAN Jaguar problems at GSR

Quote:
Originally Posted by kamocat View Post
Yes, in updating all your motors every 10ms, you will see many timeout issues. Setting the output takes 5-10ms (often 8ms) for a single Jaguar.
You wouldn't happen to have any numbers of what parts of the system these times are coming from, would you? I've been digging through the jaguar source code again and found some interesting stuff in the CAN interface.

CAN/Serial have the lowest priority interrupts, being called whenever new data is on the bus. This interrupt also has the responsibility of interpreting the message and either returning an ACK or any relevant data over the bus. Above that is an interrupt timed every 1ms which reads in any queued commands over CAN, runs a PID tick, checks limit switches, updates LED, and updates the outputs. At an even higher level is the ADC data reader. At the top of the regularly called interrupts is an interrupt for an edge on either the PWM or encoder lines. Obviously above that is the internal watchdog.

So, from what I gather, if a message is sent at an unlucky time, the internal interrupts could be slowing down the response over CAN, with some system conditions increasing the chance of this than others. (ex. PID makes the 1ms run a little longer, an encoder causes more interrupts to be called, etc).

Jumping back to the cRIO, a jaguar has 10ms to ACK before an error is returned. Judging by the 8ms (that was without PID, right?) average posted by kamocat, there isn't much wiggle-room in the system. Here's another interesting fact: last year the timeout was 50ms.

Now, here's a test I'd run if I had the hardware to do so. Connect a jaguar over CAN, attach an encoder and a motor to it. Record an average response time of the jaguar with and without the encoder being spun. If the response time increases by a significant figure with the encoder attached, then possibly the interrupts in the jaguars are causing these problems.

Sorry if I rambled a bit up there, time for sleep
__________________

"To have no errors would be life without meaning. No strugle, no joy"
"A network is only as strong as it's weakest linksys"
Reply With Quote
  #10   Spotlight this post!  
Unread 04-06-2011, 02:01 AM
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
Re: Unexplained intermittent CAN / 2CAN Jaguar problems at GSR

Sorry, I couldn't fish any info out of TI about why this is. My questions on the TI forum were largely left unanswered.

Once I get some more time, I could do some additional testing. That may not be until June.
__________________
-- Marshal Horn
Reply With Quote
  #11   Spotlight this post!  
Unread 04-06-2011, 02:35 PM
mjcoss mjcoss is offline
Registered User
FRC #0303
 
Join Date: Jan 2009
Location: Bridgewater,NJ
Posts: 70
mjcoss is a jewel in the roughmjcoss is a jewel in the roughmjcoss is a jewel in the roughmjcoss is a jewel in the rough
Re: Unexplained intermittent CAN / 2CAN Jaguar problems at GSR

Thanks for the average update times, Marshal. Just as a side note, We're not updating all of the motors, just the ones controlled by the PID loop (2 in this case).

I really would like to understand why I'm seeing intermittent timeouts in disabled mode. I'm going to update the 2CAN firmware tonight and hope that it addresses some of the issues.
Reply With Quote
  #12   Spotlight this post!  
Unread 04-07-2011, 10:17 PM
drakesword drakesword is offline
Registered User
AKA: Bryant
FRC #0346 (Robohawks)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2004
Location: USA
Posts: 200
drakesword is on a distinguished road
Re: Unexplained intermittent CAN / 2CAN Jaguar problems at GSR

Haha bigger issues today! Oh boy, there was a delay in starting the field (roughly 12 mins) when the match started we were only able to drive with one jag WOO. Brought it back (with the power still on) and opened the 2CAN page, We only saw 1 Jag. Power cycled and then we saw all 5!
Reply With Quote
  #13   Spotlight this post!  
Unread 04-08-2011, 12:49 AM
ozrien's Avatar
ozrien ozrien is offline
Omar Zrien
AKA: Omar
no team
Team Role: Mentor
 
Join Date: Sep 2006
Rookie Year: 2003
Location: Sterling Heights, MI
Posts: 516
ozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant future
Re: Unexplained intermittent CAN / 2CAN Jaguar problems at GSR

I've definitely seen this symptom before, where a Jaguar becomes unresponsive until it is power cycled, so I ran some tests tonight and I've managed to reproduce this a number of ways....

Test 1 - 1 2CAN and 1 Black Jaguar.
Take a 2CAN and connect CAN cable from it to single Jaguar. Put termination resistor on Jaguar.
Power 2CAN, 2CAN LED will be orange. [ok]
Bridge CAN High and CAN low together, hold until 2CAN LED turns red. [ok]
Let go of CAN HIgh and CAN low and 2CAN LED will return orange. [ok]
Repeat until 2CAN LED stays red even after unbridging the CAN lines. [not ok]
Power cycle JUST the Jaguar and LED returns to orange. [not ok]

What happens here is when there is no cRIO, webdash, or host of any kind, the 2CAN periodically sends an enum CAN request to see who's out there. If no one responds with a CAN frame of any kind, 2CAN LED goes red to indicate a CAN problem. If 2CAN gets CAN frames within a timeout, LED is orange to indicate no CAN problems and that it's ready for any Ethernet traffic from cRIO/WebDash.

After bridging and unbridging several times the Jaguar no longer responds to the enum request from the 2CAN, which becomes apparent when the LED stays red.

Test 2 - 2 X Black Jag, one is Serial Gateway
Connect Black Jag Serial to PC using serial connection.
Connect Black Jag #2 to Serial Black Jag using CAN.
Open BDC comm
Drive Black Jag #2, setting full throttle. No need for motors.
Begin bridging and unbridging CAN H and CAN L until Black Jag#2 no longer drives (blinks orange). [ok].
Press enum on BDC COmm to refind Jaguars
You will only see the Serial Black Jaguar ID in the drop down [not ok].
Close/open BDC comm and you still will not be able to connect to Black Jag #2 [not ok].
Power cycle Jags and you will be able to resume CAN communication.

Test 3 - CAN tool and 1 Black Jag.
Connect a USB CAN tool to a black Jag.
I used Intrepid Control System's ValueCAN 3, and Vehicle Spy 3 software.
Transmit a 29 bit ID frame with DLC set to zero and arbitration id set to 0x240. This is an enum request.
Confirm Jaguar responds with CAN frame. [ok].
Transmit frame periodically, say 20 ms.
Each frame should have a response frame after each request (few milliseconds). [ok]
Begin bridging and unbridging CAN High and CAN low.
Confirm that CAN tool's transmit error count increases then decreases back to zero each time you bridge and unbridge.
Eventually the Jaguar will no longer respond even after unbridging CAN lines [not ok].

Conclusion
Briding and unbriding the CAN lines can put the Jaguars in to a state that's unrecoverable until you power cycle them. This can happen if the legs of your termination resistor are close together.
I suspect that momentarily losing termination resistor because of bad cable can also cause this symptom. Maybe the Jaguar can't handle Error frames gracefully or gets stuck in Bus off state (see error states in CAN spec, 127 occurrences of 11 recessive bits should bring CAN nodes back into error active state). Or maybe a race condition in the isrs (mentioned earlier in the post).
Reply With Quote
  #14   Spotlight this post!  
Unread 04-11-2011, 02:11 AM
jhersh jhersh is offline
National Instruments
AKA: Joe Hershberger
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 1997
Location: Austin, TX
Posts: 1,006
jhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond repute
Re: Unexplained intermittent CAN / 2CAN Jaguar problems at GSR

Quote:
Originally Posted by drakesword View Post
Its my understanding that this has been modified for safety (which is understandable) to require the "trusted" heartbeat. Does anyone know the interval that the heartbeat must be receive in order to keep it alive? and Does anyone know the actually rate in which the heartbeat is being sent?
Either a heartbeat or a trusted set output command must be received by a Jag within 100ms of the last one to keep the Jag running. Every 15ms, the cRIO checks if the user has sent a trusted set output command within 75ms of the last heartbeat or trusted set output command. If not, it sends a heartbeat. This means that the cRIO will send a heartbeat to keep the Jag running somewhere between 75ms and 90ms (if needed).
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 03:54 AM.

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