Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: [lpc2000] CAN Bus Real Time Conditions

2006-03-05 by Ake Hedman, eurosource

Dietmar wrote:

> Dear Ladies and Gentlemen,
>
> I have to develop a very safe CAN Bus application that have to resume
> its work after a short circuit on the CAN Bus in real time.
>
> I have developed a CAN Bus Application with up to 40 CAN Bus Members
> on a Line, and it works very very well. All Controllers are Philips
> LPC2129. A few days ago, I simulated a short circuit on the CAN Bus
> lines with a duration of a few Milliseconds. All the CAN Controllers
> went into "Bus Off" State because the Transmission did not work for
> many attempts, and after them, the whole Bus was dead, also the CAN
> Analyzer with its test data (CANalyzer from Vector Informatic) that
> was on the Bus too.
>
> The Philips LPC21xx Data Sheet tells me that after a "Bus Off"
> Condition I have to Reset the RM bit in CANMod and the CAN Controller
> will restart its work. The RXERR and TXERR Counters are in default
> state after "Bus Off", but it does not work.
> May I initialize all the CAN Registers with Reset Values by Software?
>
> At this time, the only way to re-activate the CAN Controller is to
> Reset the \ufffdC (LPC2129) by a Watchdog Reset when detect RM = 1. But
> the Delay to Restart the CAN Bus after Watchdog-Reset is too long for
> my Application with this Method.
>
> Is there anybody who has an Idea to Restart the CAN Bus after
> the "Bus Off" Condition with very short delay in Real Time?
>
> Is there a real way to prevent the CAN Controller from "Bus Off"
> Condition?
>
> What have I to do other than clear the RM bit in CANMOD?
>
> Greetings
>
> Dietmar Wengler


Can the problem be that all your nodes are in bus of and you never get 
out of it as no node send correct frames to get you out of the BusOff
 From the manual

"RM resets and disables
much of the CAN Controller. Also at this time the Transmit Error Counter 
is set to 127 and the Receive Error Counter is cleared.
Software must next clear the RM bit. Thereafter the Transmit Error 
Counter will count down 128 occurrences of the Bus Free
condition (11 consecutive recessive bits). Software can monitor this 
countdown by reading the Tx Error Counter. When this
countdown is complete, the CAN Controller clears BS and ES in CANSR, and 
sets EI in CANSR if EIE in IER is 1."

That is your nodes need to see 128 correct frames after the bus off will 
be removed after you reset the RM bit. If all your nodes are at bus off 
that will not occur.

One way to solve this is to initialize the registers of the controller 
and start again a limited number of times if you detect that you don't 
get out of bus of within a certain time. You should limit the number of 
times you allow this to happen in case your node really is faulty and to 
prevent it from disturbing an otherwise working bus.

/Ake

-- 
 ---
Ake Hedman (YAP - Yet Another Programmer)
eurosource, Brattbergavagen 17, 820 50 LOS, Sweden
Phone: (46) 657 413430 Cellular: (46) 73 0533 146
Company home: http://www.eurosource.se      
Kryddor/Te/Kaffe: http://www.brattberg.com
Personal homepage: http://www.eurosource.se/akhe
Automated home: http://www.vscp.org

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.