Main Content

ARM Cortex-M4 - MCAN

The Controller Area Network (CAN) is a serial communications protocol that efficiently supports distributed real time control with a high level of security.

The MCAN module supports both Classic CAN and CAN FD (CAN with flexible data-rate) specifications. The CAN FD feature allows high throughput and increased payload per data frame. The Classic CAN and CAN FD devices can coexist on the same network without any conflict.

Protocol mode

Select the CAN type. CAN type can either be Classic CAN or CAN-FD.

MCAN module clock frequency (=connectivity manager (ARM Cortex-M) clock) in MHz

Displays the MCAN module clock frequency (=connectivity manager (ARM Cortex-M) clock) in MHz.

MCAN bit clock frequency (MCAN module clock freq/4) in MHz

Displays the MCAN bit clock frequency (MCAN module clock freq/4) in MHz.

Nominal bit rate prescaler (NBRP: 1 to 512)

Nominal Bit Rate Prescaler(NBRP). The value by which the oscillator frequency is divided for generating the bit time quanta. The bit time is built up from a multiple of this quanta. Valid values for the bit rate prescaler are 1 to 512.

Nominal time segment 1 (NTSEG1: 2 to 256)

Nominal Time Segment(NTGEG) before sample point. Valid values are 2 to 256.

Nominal time segment 2 (NTSEG2: 2 to 128)

Nominal Time Segment(NTSEG) after sample point. Valid values are 2 to 128.

Closest achievable nominal baud rate (MCAN bit clock/NBRP/(NTSEG1+NTSEG2)) in bits/sec

Closest achievable MCAN baud rate calculated based on parameters and given formula.

Nominal re-synchronization jump width (NSJW: 1 to 128)

Nominal Resynchronization Jump Width (NSJW). Valid values are 1 to 128.

Enable bit rate switching

Enables bit rate switching between nominal bit rate and data bit rate.

This parameter is available only for CAN-FD protocol mode.

Data bit rate prescaler (DBRP: 1 to 32)

Data Bit Rate Prescaler (DBRP). The value by which the oscillator frequency is divided for generating the bit time quanta. The bit time is built up from a multiple of this quanta. Valid values for the bit rate prescaler are 1 to 32.

This parameter is available only for CAN-FD protocol mode and if Enable bit rate switching parameter is enabled.

Data time segment 1 (DTSEG1: 1 to 32)

Data Time Segment (DTSEG1) before sample point . Valid values are 1 to 32.

This parameter is available only for CAN-FD protocol mode and if Enable bit rate switching parameter is enabled.

Data time segment 2 (DTSEG2: 1 to 16)

Data Time Segment (DTSEG2) after sample point (DTSEG2). Valid values are 1 to 16.

This parameter is available only for CAN-FD protocol mode and if Enable bit rate switching parameter is enabled.

Data baud rate (MCAN bit clock/DBRP/(DTSEG1+DTSEG2)) in bits/sec

Closest achievable MCAN data baud rate calculated based on data parameters and given formula.

This parameter is available only for CAN-FD protocol mode and if Enable bit rate switching parameter is enabled.

Data re-synchronization jump width (DSJW: 1 to 16)

Data Resynchronization Jump Width (DSJW). Valid values are 1 to 16.

This parameter is available only for CAN-FD protocol mode and if Enable bit rate switching parameter is enabled.

Mode

Select the operating mode for MCAN. Mode can be Normal, Internal loopback or Bus monitoring.

Pin assignment(Tx)

Select a GPIO pin for the MCAN data transmission.

Pin assignment(Rx)

Select a GPIO pin for the MCAN data reception.

Transmission mode

Select the mode of transmission. Transmission mode can either be FIFO or Queue.

Enable blocking mode for Rx FIFO 0

Enable blocking mode for FIFO 0 data reception.

Enable blocking mode for Rx FIFO 1

Enable blocking mode for FIFO 1 data reception.

Update global filter configuration

Enable this parameter to update standard and extended filter IDs.

Reject remote frames standard

Rejects all remote frames with 11-bit standard IDs when enabled else the remote frames will be filtered as per the settings from Update standard filter elements.

Reject remote frames extended

Rejects all remote frames with 29-bit extended IDs when enabled else the remote frames will be filtered as per the settings from Update extended filter elements.

Non-matching frames standard

Defines how received messages with 11-bit standard IDs that do not match any element from Update standard filter elements are treated. Non-matching frames standard can be:

  • Accept in Rx FIFO 0

  • Accept in Rx FIFO 1

  • Reject

Non-matching frames extended

Defines how received messages with 29-bit extended IDs that do not match any element fromUpdate extended filter elements are treated. Non-matching frames extended can be:

  • Accept in Rx FIFO 0

  • Accept in Rx FIFO 1

  • Reject

Update standard filter elements

Select this parameter to update the standard 11bit ID filter elements parameters. Up to 128 filter elements can be configured for 11-bit standard IDs.

Select standard filter

Select the standard filter element number. Filter number ranges between 0 to 127.

All enabled filter elements are used for acceptance filtering of standard frames. Acceptance filtering stops at the first matching enabled filter element or when the end of the filter list is reached.

Filter # configuration

Select one of the following parameter for the standard filter element selected using Select standard filter parameter.

  • Disable filter element

  • Store in Rx FIFO 0 if filter matches

  • Store in Rx FIFO 1 if filter matches

  • Reject ID if filter matches

  • Set priority if filter matches

  • Set priority and store in FIFO 0 if filter matches

  • Set priority and store in FIFO 1 if filter matches

  • Store into Rx Buffer

Filter # type (filter type will be ignored if filter configuration is stored into Rx buffer)

Select one of the following parameter for the standard filter type selected using Select standard filter parameter.

  • Range filter (from ID1 to ID2) - For range filter the ID2 >= ID1

  • Dual filter - Two dedicated message IDs is provided. To filter one specific message ID, the ID2 = ID1

  • Classic ID and mask filter (ID1 = filter, ID2 = mask) - A 0 bit at the filter mask (SFID2) will mask out the corresponding bit position of the configured Message ID filter (SFID1) and the value of the received Message ID at that bit position is not relevant for acceptance filtering. Only those bits of the received Message ID where the corresponding mask bits are 1 are relevant for acceptance filtering.

Filter # ID1

Specify the standard Filter ID 1.

Filter # ID2 (provide buffer number if filter configuration is stored into Rx buffer)

Specify the standard Filter ID 2. Provide the buffer number if filter configuration is stored into Rx buffer.

Update extended filter elements

Select this parameter to update the extended filter elements parameters.

Select extended filter

Select the extended filter element number. Filter number ranges between 0 to 63.

All enabled filter elements are used for acceptance filtering of extended frames. Acceptance filtering stops at the first matching enabled filter element or when the end of the filter list is reached.

Filter # configuration

Select one of the following parameters for the extended filter element selected using Select extended filter :

  • Disable filter element

  • Store in Rx FIFO 0 if filter matches

  • Store in Rx FIFO 1 if filter matches

  • Reject ID if filter matches

  • Set priority if filter matches

  • Set priority and store in FIFO 0 if filter matches

  • Set priority and store in FIFO 1 if filter matches

  • Store into Rx Buffer

Filter # type (filter type will be ignored if filter configuration is stored into Rx buffer)

Extended filter type.

Select one of the standard filter type:

  • Range filter (from ID1 to ID2) - For range filter the ID2 >= ID1

  • Dual filter - Two dedicated message IDs is provided. To filter one specific message ID, the ID2 = ID1

  • Classic ID and mask filter (ID1 = filter, ID2 = mask) - A 0 bit at the filter mask (EFID2) will mask out the corresponding bit position of the configured Message ID filter (EFID1) and the value of the received Message ID at that bit position is not relevant for acceptance filtering. Only those bits of the received Message ID where the corresponding mask bits are 1 are relevant for acceptance filtering.

Filter # ID1

Specify the first ID of extended ID filter element.

Filter # ID2 (provide buffer number if filter configuration is stored into Rx buffer)

Specify the second ID of extended ID filter element. Provide buffer number if filter configuration is stored into Rx buffer.

Display configured extended and standard filters elements in command window

Click on Display configured extended and standard filters elements in command window button to view the configured standard and extended filter elements in MATLAB® command window.

Reset standard filters configurations

Click Reset standard filters configurations to reset the configured standard filter configurations.

Reset extended filters configurations

Click Reset extended filters configurations to reset the configured extended filter configurations.

Configure memory

Select to configure the memory and its parameters. Select this parameter to configure CAN FD memory parameters. This is not applicable for classic CAN as memory parameters is automatically configured.

This parameter is available only for CAN FD protocol mode.

Maximum element size in TX FIFO (in bytes)

Select the maximum data size of CAN FD message in transmit FIFO.

This parameter is available only for CAN FD protocol mode and if Update memory configuration is selected.

Maximum element size in RX FIFO 0 (in bytes)

Select the maximum data size of CAN FD message in receive FIFO 0.

This parameter is available only for CAN FD protocol mode and if Update memory configuration is selected.

Maximum element size in RX FIFO 1 (in bytes)

Select the maximum data size of CAN FD message in receive FIFO 1.

This parameter is available only for CAN FD protocol mode and if Update memory configuration is selected.

Maximum element size in RX buffer (in bytes)

Select the maximum data size of CAN FD message in receive buffer.

This parameter is available only for CAN FD protocol mode and if Update memory configuration is selected.

Number of elements in TX FIFO/Queue

Select the number of elements (data + header CAN FD message) in transmit FIFO/Queue.

This parameter is available only for CAN FD protocol mode and if Update memory configuration is selected.

Number of elements in RX FIFO 0

Select the number of elements (data + header CAN FD message) in receive FIFO 0.

This parameter is available only for CAN FD protocol mode and if Update memory configuration is selected.

Number of elements in RX FIFO 1

Select the number of elements (data + header CAN FD message) in receive FIFO 1.

This parameter is available only for CAN FD protocol mode and if Update memory configuration is selected.

Validate memory

Click Validate memory button to validate all the memory parameters configured.

This parameter is available only for CAN FD protocol mode and if Update memory configuration is selected.

The following table explains the memory allocation.

Memory Allocation

SectionElement size (in bytes)Number of Elements
Standard filter4Number of standard filters configured in Update standard filter elements.
Extended filter8Number of standard filters configured in Update extended filter elements.
Tx FIFOHeader(8) + value specified in Maximum element size in TX FIFO (in bytes)Number of elements in TX FIFO/Queue.
Tx event FIFO832
Rx bufferHeader(8) + value specified in Maximum element size in RX buffer (in bytes)Maximum buffer number configured in Update standard filter elements or Update extended filter elements configuration + 1
Rx FIFO 0Header(8) + value specified in Maximum element size in RX FIFO 0 (in bytes)

Auto Allocate: If parameter Number of elements in RX FIFO 0 is set to Auto allocate then it will verify if Rx FIFO 0 is used for matching or non-matching frames and assign remaining memory if it is available. In this case minimum available memory should be 1 element size of Rx FIFO 0.

Not Auto Allocate: Number of elements in RX FIFO 0

Rx FIFO 1Header(8) + value specified in Maximum element size in RX FIFO 1 (in bytes)

Auto Allocate: If parameter Number of elements in RX FIFO 1 is set to Auto allocate then it will verify if Rx FIFO 1 is used for matching or non-matching frames and assign remaining memory if it is available. In this case minimum available memory should be 1 element size of Rx FIFO 1 .

Not Auto Allocate: Number of elements in RX FIFO 1

Note

  • If parameter Number of elements in RX FIFO 0 or Number of elements in RX FIFO 1 is set to auto allocate it verifies if Rx FIFO 0 or Rx FIFO 1 is used for matching or non-matching frames and assign remaining available memory to their respective FIFO.

  • If only one FIFO is used then entire remaining memory is assigned it or it is distributed equally between both the FIFO's. In this case minimum available memory will be 1 element size of Rx FIFO 0 or Rx FIFO 1.

Configure receive interrupt sources

Select to configure the receive interrupt parameters such as buffer and FIFO messages.

Configure RX buffer interrupt sources

Select to configure the receive buffer interrupt.

To select this parameter, select the Configure receive interrupt sources.

Dedicated RX buffer message

Select the dedicated interrupt line for receive buffer message.

To select this parameter, select the Configure RX buffer interrupt sources .

High priority message

Select the dedicated interrupt line for high priority message.

To configure this parameter, select the Configure receive buffer interrupt sources.

Configure RX FIFO 0 interrupt sources

Enable to configure the receive FIFO 0 interrupt sources.

To select this parameter, select the Configure receive interrupt sources.

RX FIFO 0 new message

Select the interrupt line for receive FIFO 0 new message.

To configure this parameter, select the Configure RX FIFO 0 interrupt.

RX FIFO 0 full

Select the interrupt line for receive FIFO 0 full.

To configure this parameter, select the Configure RX FIFO 0 interrupt.

RX FIFO 0 message lost

Select the interrupt line for receive FIFO 0 message lost.

To configure this parameter, select the Configure RX FIFO 0 interrupt.

RX FIFO 0 watermark

Select the interrupt line for receive FIFO 0 watermark.

To configure this parameter, select the Configure RX FIFO 0 interrupt.

Configure RX FIFO 1 interrupt sources

Enable to configure the receive FIFO 1 interrupt sources.

To configure this parameter, select the Configure RX FIFO 0 interrupt.

RX FIFO 1 new message

Select the interrupt line for receive FIFO 1 new message.

To select this parameter, select the Configure RX FIFO 1 interrupt sources.

RX FIFO 1 full

Select the interrupt line for receive FIFO 1 full.

To select this parameter, select the Configure RX FIFO 1 interrupt sources.

RX FIFO 1 message lost

Select the interrupt line for receive FIFO 1 message lost.

To select this parameter, select the Configure RX FIFO 1 interrupt sources.

RX FIFO 1 watermark

Select the interrupt line for receive FIFO 1 watermark.

To select this parameter, select the Configure RX FIFO 1 interrupt sources.

Configure transmit interrupt sources

Select to configure the transmit interrupt parameters such as event and FIFO.

Configure TX FIFO interrupt sources

Select to configure the transmit FIFO interrupt sources.

To select this parameter, select the Configure transmit interrupt sources.

Transmission complete

Select the transmission interrupt line for transfer complete.

To select this parameter, select the Configure TX FIFO interrupt sources .

Transmission cancellation finish

Select the transmission interrupt line for transfer cancellation finish.

To select this parameter, select the Configure TX FIFO interrupt sources .

TX FIFO empty

Select the transmission interrupt line for TX FIFO empty.

To select this parameter, select the Configure TX FIFO interrupt sources .

Configure TX event FIFO interrupt sources

Select to configure the transmit FIFO interrupt sources.

To select this parameter, select the Configure transmit interrupt sources.

TX event FIFO new entry

Select the transmission interrupt line for TX event FIFO new entry.

To select this parameter, select the Configure TX event FIFO interrupt sources .

TX event FIFO element lost

Select the transmission interrupt line for TX event FIFO element lost.

To select this parameter, select the Configure TX event FIFO interrupt sources .

TX event FIFO full

Select the transmission interrupt line for TX event FIFO full.

To select this parameter, select the Configure TX event FIFO interrupt sources .

TX event FIFO watermark

Select the transmission interrupt line for TX event FIFO watermark.

To select this parameter, select the Configure TX event FIFO interrupt sources .

Configure other interrupt sources

Select to configure other interrupt sources.

Timestamp wraparound

Select the interrupt line for timestamp wraparound interrupt.

To select this parameter, select the Configure other interrupt sources.

Timeout occurred

Select the interrupt line for timeout occurred interrupt.

To select this parameter, select the Configure other interrupt sources.

Error logging overflow

Select the interrupt line for error logging overflow interrupt.

To select this parameter, select the Configure other interrupt sources.

Warning status

Select the interrupt line for warning status interrupt.

To select this parameter, select the Configure other interrupt sources.

Watchdog event

Select the interrupt line for watchdog event interrupt.

To select this parameter, select the Configure other interrupt sources.

Data protocol error

Select the interrupt line for data protocol error interrupt.

To select this parameter, select the Configure other interrupt sources.

Message RAM access failure

Select the interrupt line for message RAM access failure interrupt.

To select this parameter, select the Configure other interrupt sources.

Bit error uncorrected

Select the interrupt line for bit error uncorrected interrupt.

To select this parameter, select the Configure other interrupt sources.

Error passive status

Select the interrupt line for error passive status interrupt.

To select this parameter, select the Configure other interrupt sources.

Bus off status

Select the interrupt line for bus off status interrupt.

To select this parameter, select the Configure other interrupt sources.

Arbitration protocol error

Select the interrupt line for arbitration protocol error interrupt.

To select this parameter, select the Configure other interrupt sources.

Reserved address access

Select the interrupt line for reserved address access interrupt.

To select this parameter, select the Configure other interrupt sources.

Related Topics