Download "user manual"
Transcript
Chapter 4: User Peripherals This helps to break up DC levels on the bus and provides plenty of edges in the bitstream which are used for resynchronisation. An error frame in the CAN protocol is simply six dominant bits in a row. This allows any CAN controller to assert an error onto the bus as soon as the error is detected without having to wait until the end of a message. Error counters: The CAN controller moves between a number of error states that allow a node to fail in an elegant fashion without blocking the bus. Internally each CAN controller has two counters - a receive error counter and a transmit error counter. These counters will count up when receiving or transmitting an error frame. If either counter reaches 128 then the CAN controller will enter an ‘error passive’ mode. In this mode it still responds to error frames but if it generates an error frame, it writes recessive bits in place of dominant bits. If the transmit error counter reaches 255 then the CAN controller will go into a bus-off condition and take no further part in CAN communication. The CPU must intervene to reinitialise the controller and put it back onto the bus. Both these mechanisms are to ensure that if a node goes faulty, it will fail gracefully and not block the bus by continually generating error frames. 4.13.4.4 CAN Bus Error Handling Error conditions within the STR9 Can controller are reported in the status register The status register contains the error warning flags and a Last Error code that details the last fault that occurred on the CAN bus. This register contains flags for bus-off and error passive conditions, as well as an early warning error limit, which is set when the error counters reach a count of 96. In addition to the error flags, there is a last error code field which reports the type of error condition that was last encountered. In addition, the error counter register allows you to read the current values held in the transmit and receive error counters. © Hitex (UK) Ltd. Page 141