Peripheral Simulation
For Dallas Semiconductor DS80C400 — CAN Controller
Simulation support for this peripheral or feature is comprised of:
- Dialog boxes which display and allow you to change peripheral configuration.
- VTREGs (Virtual Target Registers) which support I/O with the peripheral.
These simulation capabilities are described below.
CAN0 Communication Dialog
The Controller Area Network (CAN) Controller Communication tab
displays the CAN communication activity on the CAN bus. The Message
number, States, Message Identifier, Message Direction, Channel, Data
Length and Data content are displayed for each message. To clear the
message display, double-click anywhere in the message display
area.
CAN0 Configuration Dialog
The CAN0 Configuration tab configures the on-chip CAN controller.
The CAN controller provides storage for up to 15 message objects
which can be a maximum of 8 bytes long.
Data Memory
-
CMA (CAN Memory Assignment) is set to use
0x401000-0x4010FF for CAN data. If reset, 0x00EE00-0x00EEFF is
used.
Control
-
C0C (CAN 0 Control Register) contains the following
control bits:
-
SWINT (Software Initialization Enable) is set to allow
software access to the first 16 bytes of CAN 0 memory. Setting this
bit disables CAN 0 activity.
-
ERCS (Error Count Select) contains the number of
transmit or receive errors that will cause Error Count Exceeded
(CECE) to set.
-
AUTOB (Autobaud) is set to automatically detect and set
the CAN 0 baudrate based on the data received on the CAN bus.
-
CRST (CAN 0 Reset) is set to reset all CAN 0 registers
to the default state.
-
SIESTA (Siesta Mode Enable) is set to put the CAN 0
controller into low power mode. The bit is cleared by software, CAN
0 bus activity or when either CRST or SWINT bits are set.
-
PDE (Power Down Enable) is set to put the CAN 0
controller into the lowest power mode. Receiving 11 consecutive
data bits or an MCU reset clears this bit.
Status
-
C0S (CAN 0 Status Register) contains the following
status information:
-
TXS (Transmit Status) is set when the last message was
sent without errors.
-
RXS (Receive Status) is set when a message was received
without errors.
-
WKS (Wake-up Status) is set when either the Low Power
(SIESTA) bit or the Power Down Enable (PDE) bit is set.
-
CECE (Error Count Exceeded) is set when the error
counter limit reaches 96, if ERCS is reset, or 128, if ERCS is
set.
-
BUSOFF (Bus Off Status) is set when the bus off state of
the CAN Controller is set.
Interrupts
-
C0IR (CAN 0 Interrupt Register) contains the identifier
of a CAN interrupt request. If zero, no CAN interrupts are
pending.
-
STIE (CAN 0 Interrupt Enable) is set to allow the CAN
controller to generate interrupts. If reset, the CAN controller
cannot generate interrupts.
-
ERIE (CAN Error Interrupt Enable) is set to generate an
interrupt when either the Bus Off (BUSOFF) or the Error Count
Exceeded (CECE) status bits change.
Bus Connection
-
SBCAN (Single Bus CAN) is set to create a 30 message
center CAN module from the CAN 0 and CAN 1 busses. The CAN 0 and
CAN 1 receive inputs and transmit outputs are logically ANDed
together to achieve this.
-
C0_I/O (I/O Enable) is set to assign port pins P5.0 and
P5.1 to CAN 0 receive and transmit functions, respectively.
-
CAN0BA (CAN 0 Bus Active) is set when CAN 0 I/O Enable
(C0_I/O) is set and there is activity on the CAN 0 bus.
Bit Timing Group
-
C0BT0 (CAN Bus Timing Register 0) contains the
Synchronization Jump Width (SJW) and Baud Rate Prescaler (BPR)
settings.
-
C0BT1 (CAN Bus Timing Register 1) contains the Time
Segment Before Sample Point (TSEG1) and Time Segment After Sample
Point (TSEG2) settings.
-
Baudrate displays the current baud rate based on the
Baud Rate Prescaler (BPR) value.
-
BPR (Baud Rate Prescaler) contains the value to be
divided into the oscillator frequency to generate the desired baud
rate.
-
TSEG1 (Time Segment Before Sample Point) contains the
number of time segments within 1 bit time to wait before sampling 1
bit of data.
-
TSEG2 (Time Segment After Sample Point) contains the
number of time segments within 1 bit time to wait after sampling 1
bit of data.
-
SJW (Synchronization Jump Width) contains the maximum
number of time segments 1 bit time may be reduced or lengthened
during message re-synchronization.
Receive Message Stored
-
C0RMS0 (CAN 0 Receive Message Stored Register 0)
indicates which CAN 0 message centers (1-8) have stored a message
since the last read of the register.
-
C0RMS1 (CAN 0 Receive Message Stored Register 1)
indicates which CAN 0 message centers (9-15) have stored a message
since the last read of the register.
Transmit Message Acknowledged
-
C0TMA0 (CAN 0 Transmit Message Acknowledgement Register
0) indicates which CAN 0 message centers (1-8) have successfully
sent a message since the last read of the register. After a read,
this register is cleared to 0.
-
C0TMA1 (CAN 0 Transmit Message Acknowledgement Register
1) indicates which CAN 0 message centers (9-15) have successfully
sent a message since the last read of the register. After a read,
this register is cleared to 0.
Error Counters
-
C0TE (CAN 0 Transmit Error Register) contains the
accumulated number of transmit errors. It is cleared during a
hardware or software reset (CRST) and may also be manually cleared
by software.
-
C0RE (CAN 0 Receive Error Register) contains the
accumulated number of receive errors. It is cleared during a
hardware or software reset (CRST).
Standard Global Mask
-
C0SGM0 (CAN Standard Global Mask Register 0) contains
the upper 8 bits of the 11-bit identifier mask used for the last
incoming message. Mask bits 28-21 are stored here.
-
C0SGM1 (CAN Standard Global Mask Register 1) contains
the lower 3 bits of the 11-bit identifier mask used for the last
incoming message. They are store in bits 7-5 of this register. Bits
4-0 are not used. Mask bits 20-18 are stored here.
-
Mask(11-bit) displays the 11-bit identifier mask
value.
Extended Global Mask
-
C0EGM0 (CAN Extended Global Mask Register 0) contains
mask bits 28-21 of the 29-bit identifier mask used for the last
incoming message.
-
C0EGM1 (CAN Extended Global Mask Register 1) contains
mask bits 20-13 of the 29-bit identifier mask used for the last
incoming message.
-
C0EGM2 (CAN Extended Global Mask Register 2) contains
mask bits 12-5 of the 29-bit identifier mask used for the last
incoming message.
-
C0EGM3 (CAN Extended Global Mask Register 3) contains
mask bits 4-0 of the 29-bit identifier mask used for the last
incoming message. They are stored in bits 7-3 of this register.
Bits 2-0 are not used.
-
Mask(29-bit) displays the 29-bit identifier mask
value.
Message Center 15 Mask
-
C0M15M0 (CAN Message Center 15 Mask Register 0) contains
mask bits 28-21 of the mask value used for the last incoming
message for message center 15.
-
C0M15M1 (CAN Message Center 15 Mask Register 1) holds
bits 20-13 of the mask value used for the last incoming message for
message center 15.
-
C0M15M2 (CAN Message Center 15 Mask Register 2) holds
bits 12-5 of the mask value used for the last incoming message for
message center 15.
-
C0M15M3 (CAN Message Center 15 Mask Register 3) holds
bits 4-0 of the mask value used for the last incoming message for
message center 15. They are stored in bits 7-3 of this register.
Bits 2-0 are not used.
-
Mask (11-bit) displays the 11-bit last message
mask.
-
Mask (29-bit) displays the 29-bit last message
mask.
Media Arbitration & ID Mask
-
C0MA0 (CAN Media Arbitration Register 0) holds the media
ID value to be compared to the first CAN data byte after applying
the media ID mask. This is only used when the Media Identification
Mask Enable (MDME) bit is set.
-
C0MA1 (CAN Media Arbitration Register 1) holds the media
ID value to be compared to the second CAN data byte after applying
the media ID mask. This is only used when the Media Identification
Mask Enable (MDME) bit is set.
-
C0MID0 (CAN Media ID Mask Register 0) holds the media ID
mask value to be applied against the first CAN data byte. This is
only used when the Media Identification Mask Enable (MDME) bit is
set.
-
C0MID1 (CAN Media ID Mask Register 1) holds the media ID
mask value to be applied against the second CAN data byte. This is
only used when the Media Identification Mask Enable (MDME) bit is
set.
CAN0 Message Dialog
The CAN0 Message tab displays and configures the channel settings
for the 15 message channels on the on-chip CAN controller. The list
box displays the current setting for each channel. Use the Select
Channel group below the change channel settings.
Arbitration
-
ID (Message Identifier) displays the 11-bit or 29-bit
message identifier, depending on the state of the Extended or
Standard Identifier (EX/ST) bit.
-
MEME (Message Identification Mask Enable) is set to
enable message ID masking. This allows only messages with ID bits
that match the arbitration register bits and the mask register
bits.
-
MDME (Media Identification Mask Enable)is set to enable
media ID masking. This allows only messages whose bits from the
first 2 data bytes match the arbitration register bits and the mask
register bits.
Format
-
EX/ST (Extended or Standard Identifier) is set if the
message contains 29-bit identifiers, or reset if the message
contains 11-bit identifiers.
-
Length (Data Length) contains the length of the data in
this message. Data can be from 0 to 8 bytes long.
Data Bytes
-
C0MnD0 (CAN Message Byte 0) displays message byte
0 for the selected message center n in hexadecimal
format.
-
C0MnD1 (CAN Message Byte 1) displays message byte
1 for the selected message center n in hexadecimal
format.
-
C0MnD2 (CAN Message Byte 2) displays message byte
2 for the selected message center n in hexadecimal
format.
-
C0MnD3 (CAN Message Byte 3) displays message byte
3 for the selected message center n in hexadecimal
format.
-
C0MnD4 (CAN Message Byte 4) displays message byte
4 for the selected message center n in hexadecimal
format.
-
C0MnD5 (CAN Message Byte 5) displays message byte
5 for the selected message center n in hexadecimal
format.
-
C0MnD6 (CAN Message Byte 6) displays message byte
6 for the selected message center n in hexadecimal
format.
-
C0MnD7 (CAN Message Byte 7) displays message byte
7 for the selected message center n in hexadecimal
format.
Control
-
C0MnC (CAN 0 Message Center n Control
Register) contains the following control bits for message center
n:
-
T/R (Transmit/Receive) is set for transmitted messages,
and reset for received messages.
-
WTOE (Write-over Enable) is set to allow a new message
to overwrite and existing message.
-
MSRDY (CAN 0 Message Center n Ready) is set by
the MCU to indicate it is done updating message attributes and the
message center may be accessed.
-
ETI (Enable Transmit Interrupt) is set to force the
INTRQ bit for this message center to set for every successful
message transmission.
-
ERI (Enable Receive Interrupt) is set to force the INTRQ
bit for this message center to set for every successful message
reception.
-
INTRQ (Interrupt Request) is set to indicate a
successful trnsmission or receptio of a message for this message
center.
-
EXTRQ (Interrupt Pending) is set to indicate that the
CAN controller received a requested for a message transmission, but
it has not been transmitted. When this bit is set, the CAN
controller sets MTRQ.
-
MTRQ (Message Transmit Request) is set to indicate the
CPU or remote node requested a message transmission, but has not
yet completed it.
-
RDW/TIH (Receive Overwrite/Transmit Inhibit) when
receiving, this bit set indicates incoming data may have been
overwritten and is not reliable. When transmitting, setting this
bit directs the MCU not to transmit data while the message content
is being updated.
-
DTUP (Data Updated) is set in receive mode to indicate
that new data has been received and is ready to be read by the MCU.
In transmit mode, software must clear this bit and set the TIH bit
before updating the selected message.
CAN0Bx VTREG
Data Type: unsigned char
The CAN0Bx VTREGs contains the eight bytes of the CAN message.
CAN0B0 is the first byte, CAN0B1 is the second byte, and so on.
-
When the simulated MCU transmits a CAN message, these VTREGs
contain the message data bytes.
-
To simulate a received CAN message, these VTREGs must be
initialized with the message data bytes.
CAN0ID VTREG
Data Type: unsigned long
The CAN0ID VTREG specifies the ID of the CAN message.
-
When the simulated MCU transmits a CAN message, this VTREG
contains the message ID.
-
To simulate a received CAN message, this VTREG must be
initialized with the message ID.
CAN0IN VTREG
Data Type: unsigned char
The CAN0IN VTREG specifies the type of CAN message the simulated
MCU will receive. The values 1-4 are used:
- 1: Message with 11-bit ID.
- 2: Message with 29-bit ID.
- 3: Message Request with 11-bit ID.
- 4: Message Request with 29-bit ID.
For example:
CAN0IN=2; // Input a 29-bit ID message
CAN0L VTREG
Data Type: unsigned char
The CAN0L VTREG specifies the length of the CAN message in
bytes.
-
When the simulated MCU transmits a CAN message, this VTREG
contains the number of bytes in the message.
-
To simulate a received CAN message, this VTREG must be
initialized with the number of bytes in the message.
CAN0OUT VTREG
Data Type: unsigned char
The CAN0OUT VTREG specifies the type of CAN message that was
transmitted by the simulated MCU. The values 1-4 are used:
- 1: Message with 11-bit ID was sent.
- 2: Message with 29-bit ID was sent.
- 3: Message Request with 11-bit ID was sent.
- 4: Message Request with 29-bit ID was sent.