Chapter 23 Controller Area Network (CAN).pdf
Chapter 23 Controller Area Network (CAN).pdf
Chapter 23 Controller Area Network (CAN).pdf
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Functional Description www.ti.com<br />
<strong>23</strong>.3.12 Parity Check Mechanism<br />
The D<strong>CAN</strong> provides a parity check mechanism to ensure data integrity of message RAM data. For each<br />
word (32 bits) in message RAM, one parity bit will be calculated. The formation of the different words is<br />
according to the message RAM representation in RDA mode, see Section <strong>23</strong>.3.18.4.<br />
Parity information is stored in the message RAM on write accesses and will be checked against the stored<br />
parity bit from message RAM on read accesses.<br />
The Parity check functionality can be enabled or disabled by PMD bit field in the <strong>CAN</strong> control register.<br />
In case of disabled parity check, the parity bits in message RAM will be left unchanged on write access to<br />
data area and no check will be done on read access.<br />
If parity checking is enabled, parity bits will be automatically generated and checked by the D<strong>CAN</strong>. The<br />
parity bits could be read in debug/suspend mode (see Section <strong>23</strong>.3.18.3) or in RDA mode (see<br />
Section <strong>23</strong>.3.18.4). However, direct write access to the parity bits is only possible in these two modes with<br />
parity check disabled.<br />
A parity bit will be set, if the modulo-2-sum of the data bits is 1. This definition is equivalent to: The parity<br />
bit will be set, if the number of 1 bits in the data is odd.<br />
NOTE: The parity scheme is tied to even parity at the device level.<br />
<strong>23</strong>.3.12.1 Behavior on Parity Error<br />
On any read access to message RAM (e.g., during start of a <strong>CAN</strong> frame transmission), the parity of the<br />
message object will be checked. If a parity error is detected, the PER bit in the error and status register<br />
will be set. If error interrupts are enabled, an interrupt would also be generated. In order to avoid the<br />
transmission of invalid data over the <strong>CAN</strong> bus, the D bit of the message object will be reset.<br />
The message object data can be read by the host CPU, independently of parity errors. Thus, the<br />
application has to ensure that the read data is valid, e.g., by immediately checking the parity error code<br />
register (D<strong>CAN</strong> PERR) on parity error interrupt.<br />
NOTE: During RAM initialization, no parity check will be done.<br />
<strong>23</strong>.3.12.2 Parity Testing<br />
Testing the parity mechanism can be done by enabling the bit RamDirectAccess ( RDA) and manually<br />
writing the parity bits directly to the dedicated RAM locations. With this, data and parity bits could be<br />
checked when reading directly from RAM.<br />
NOTE: If parity check was disabled, the application has to ensure correct parity bit handling in order<br />
to prevent parity errors later on when parity check is enabled.<br />
4054 <strong>Controller</strong> <strong>Area</strong> <strong>Network</strong> (<strong>CAN</strong>) SPRUH73E–October 2011–Revised May 2012<br />
Submit Documentation Feedback<br />
Copyright © 2011–2012, Texas Instruments Incorporated