Error recovery using MCP2515 can controller
"Chuck Hackett" <[email protected]>
| Newsgroups | gmane.comp.hardware.bus.can |
|---|---|
| Message-ID | <[email protected]> |
I have been using the MCP2515 for a couple of years now driven by an Atmel ATMega1284p microcontroller. My bus is running at 125kbps. I am experienced in communications software but this is my first use of CAN bus. All nodes are of my design. The basic network is functioning fine but I am really not clear on how I should handle error states (Bus-Off, Transmit Error-Passive, Receive Error-Passive, Transmit Error Warning, Receive Error Warning, etc.). Does anyone have C/C++ driver code I can pattern after or even a flowchart for the firmware side of error recovery? What "bus occupancy rate" can I expect? I have heard someone say that I should only design to 30% occupancy. Since the controller handles bus arbitration I assumed the only effect of an "overloaded" bus was the possible stall of the xmit queue due to constant higher priority traffic. What are the visible effects of an "overloaded" bus? As background: My hobby is ride-on live steam locomotives that run on 7 1/2" gauge track (http://whitetrout.net/Chuck/844) . I am developing this CAN application as part of an automatic signaling system for 7 1/2" gauge track. Trains are detected by the shunts that cause on the track. My system supports everything using one power pair buried next to the track as well as a CAT-5/6 data cable in the same conduit. When the bus lengths get too long I break the bus and insert a segment 'bridge' that forwards messages between bus segments. The whole railroad is about 4,000 feet long (http://cpgrr.org) and located in Florida woods - so lightning protection of the nodes and the CAN bus has been a major challenge! Cheers, Chuck Hackett "Good judgment comes from experience, experience comes from bad judgment" 7.5" gauge Union Pacific Northern (4-8-4) 844 http://www.whitetrout.net/Chuck -- Archives and useful links: http://groups.yahoo.com/group/CANbus Subscribe and unsubscribe at www.vector.com/canlist/ Report any problems to <[email protected]>