Keil Logo

Peripheral Simulation

For Dallas Semiconductor DS80C390 — CAN1 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.

CAN1 Communication Dialog

CAN1 Communication

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.

CAN1 Configuration Dialog

CAN1 Configuration

The CAN1 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 0x401100-0x4110FF for CAN data. If reset, 0x00EF00-0x00EFFF is used.

Control

  • C1C (CAN 1 Control Register) contains the following control bits:
  • SWINT (Software Initialization Enable) is set to allow software access to the first 16 bytes of CAN 1 memory. Setting this bit disables CAN 1 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 1 baudrate based on the data received on the CAN bus.
  • CRST (CAN 1 Reset) is set to reset all CAN 1 registers to the default state.
  • SIESTA (Siesta Mode Enable) is set to put the CAN 1 controller into low power mode. The bit is cleared by software, CAN 1 bus activity or when either CRST or SWINT bits are set.
  • PDE (Power Down Enable) is set to put the CAN 1 controller into the lowest power mode. Receiving 11 consecutive data bits or an MCU reset clears this bit.

Status

  • C1S (CAN 1 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

  • C1IR (CAN 1 Interrupt Register) contains the identifier of a CAN interrupt request. If zero, no CAN interrupts are pending.
  • STIE (CAN 1 Interrupt Enable) is set to allow the CAN controller to generate interrupts. If reset, the CAN controller cannot generate interrupts.
  • ERIE (CAN 1 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.
  • C1_I/O (I/O Enable) is set to assign port pins P5.2 and P5.3 to CAN 1 receive and transmit functions, respectively.
  • CAN1BA (CAN 1 Bus Active) is set when CAN 1 I/O Enable (C1_I/O) is set and there is activity on the CAN 1 bus.

Bit Timing Group

  • C1BT0 (CAN Bus Timing Register 0) contains the Synchronization Jump Width (SJW) and Baud Rate Prescaler (BPR) settings.
  • C1BT1 (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

  • C1RMS0 (CAN 1 Receive Message Stored Register 0) indicates which CAN 1 message centers (1-8) have stored a message since the last read of the register.
  • C1RMS1 (CAN 1 Receive Message Stored Register 1) indicates which CAN 1 message centers (9-15) have stored a message since the last read of the register.

Transmit Message Acknowledged

  • C1TMA0 (CAN 1 Transmit Message Acknowledgement Register 0) indicates which CAN 1 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.
  • C1TMA1 (CAN 1 Transmit Message Acknowledgement Register 1) indicates which CAN 1 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

  • C1TE (CAN 1 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.
  • C1RE (CAN 1 Receive Error Register) contains the accumulated number of receive errors. It is cleared during a hardware or software reset (CRST).

Standard Global Mask

  • C1SGM0 (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.
  • C1SGM1 (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

  • C1EGM0 (CAN Extended Global Mask Register 0) contains mask bits 28-21 of the 29-bit identifier mask used for the last incoming message.
  • C1EGM1 (CAN Extended Global Mask Register 1) contains mask bits 20-13 of the 29-bit identifier mask used for the last incoming message.
  • C1EGM2 (CAN Extended Global Mask Register 2) contains mask bits 12-5 of the 29-bit identifier mask used for the last incoming message.
  • C1EGM3 (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

  • C1M15M0 (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.
  • C1M15M1 (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.
  • C1M15M2 (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.
  • C1M15M3 (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

  • C1MA0 (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.
  • C1MA1 (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.
  • C1MID0 (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.
  • C1MID1 (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.

CAN1 Message Dialog

CAN1 Message

The CAN1 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

  • C1MnD0 (CAN Message Byte 0) displays message byte 0 for the selected message center n in hexadecimal format.
  • C1MnD1 (CAN Message Byte 1) displays message byte 1 for the selected message center n in hexadecimal format.
  • C1MnD2 (CAN Message Byte 2) displays message byte 2 for the selected message center n in hexadecimal format.
  • C1MnD3 (CAN Message Byte 3) displays message byte 3 for the selected message center n in hexadecimal format.
  • C1MnD4 (CAN Message Byte 4) displays message byte 4 for the selected message center n in hexadecimal format.
  • C1MnD5 (CAN Message Byte 5) displays message byte 5 for the selected message center n in hexadecimal format.
  • C1MnD6 (CAN Message Byte 6) displays message byte 6 for the selected message center n in hexadecimal format.
  • C1MnD7 (CAN Message Byte 7) displays message byte 7 for the selected message center n in hexadecimal format.

Control

  • C1MnC (CAN 1 Message Center n Control Register) conatins the following ontrol 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 1 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.

CAN1Bx VTREG
Data Type: unsigned char

The CAN1Bx VTREGs contains the eight bytes of the CAN message. CAN1B0 is the first byte, CAN1B1 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.

CAN1ID VTREG
Data Type: unsigned long

The CAN1ID 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.

CAN1IN VTREG
Data Type: unsigned char

The CAN1IN 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:

CAN1IN=2;  // Input a 29-bit ID message

CAN1L VTREG
Data Type: unsigned char

The CAN1L 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.

CAN1OUT VTREG
Data Type: unsigned char

The CAN1OUT 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.
Get more information about the
Peripheral Simulation Capabilities
of the µVision Debugger.
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.