EasyManua.ls Logo

Microchip Technology dsPIC33 series User Manual

Microchip Technology dsPIC33 series
116 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
Page #1 background imageLoading...
Page #1 background image
2018 Microchip Technology Inc. DS70005340A-page 1
HIGHLIGHTS
This section of the manual contains the following major topics:
1.0 Introduction ....................................................................................................................... 2
2.0 CAN FD Message Frames................................................................................................ 5
3.0 Control Registers .............................................................................................................. 9
4.0 Modes of Operation ........................................................................................................ 51
5.0 Configuration................................................................................................................... 57
6.0 Message Transmission ................................................................................................... 67
7.0 Transmit Event FIFO – TEF............................................................................................ 76
8.0 Message Filtering............................................................................................................81
9.0 Message Reception ........................................................................................................ 86
10.0 FIFO Behavior................................................................................................................. 92
11.0 Timestamping................................................................................................................103
12.0 Interrupts....................................................................................................................... 104
13.0 Error Handling................................................................................................................111
14.0 Related Application Notes............................................................................................. 113
15.0 Revision History ............................................................................................................114
CAN Flexible Data-Rate (FD) Protocol Module
Question and Answer IconNeed help?

Do you have a question about the Microchip Technology dsPIC33 series and is the answer not in the manual?

Microchip Technology dsPIC33 series Specifications

General IconGeneral
BrandMicrochip Technology
ModeldsPIC33 series
CategoryMotherboard
LanguageEnglish

Summary

HIGHLIGHTS

1.0 Introduction

Provides an introduction to the CAN FD protocol module.

2.0 CAN FD Message Frames

Details the different CAN message frames used in CAN FD.

3.0 Control Registers

Lists the Special Function Registers (SFRs) used to control CAN FD operations.

4.0 Modes of Operation

Describes the various operational modes of the CAN FD protocol module.

5.0 Configuration

Explains the configuration settings for the CAN FD module, including clock.

6.0 Message Transmission

Covers the process of transmitting messages using CAN FD, including queues and FIFOs.

7.0 Transmit Event FIFO – TEF

Details the behavior and configuration of the Transmit Event FIFO (TEF).

8.0 Message Filtering

Explains the hardware filtering mechanism for receiving specific CAN FD messages.

9.0 Message Reception

Describes how messages are received and processed by the CAN FD module.

10.0 FIFO Behavior

Explains the behavior of FIFOs and the Transmit Queue (TXQ) in the CAN FD module.

11.0 Timestamping

Details the timestamping capabilities of the CAN FD module using the Time Base Counter (TBC).

12.0 Interrupts

Explains the interrupt handling mechanisms within the CAN FD protocol module.

13.0 Error Handling

Covers the error detection, confinement, and recovery mechanisms of the CAN FD protocol.

14.0 Related Application Notes

Lists application notes related to the CAN FD protocol module.

15.0 Revision History

Provides the revision history of the document, noting the initial version.

1.0 INTRODUCTION

1.1 Features

Outlines the key features of the CAN FD module, including general, FIFO, and transmission aspects.

2.0 CAN FD MESSAGE FRAMES

2.1 ISO vs. NON-ISO CRC

Explains the difference between ISO and non-ISO CRC in CAN FD frames.

3.0 CONTROL REGISTERS

Register 3-1: C1CONH: CAN Control Register High

Details the configuration bits for the CAN Control Register High.

Register 3-2: C1CONL: CAN Control Register Low

Details the configuration bits for the CAN Control Register Low.

Register 3-3: C1NBTCFGH: CAN Nominal Bit Time Configuration Register High

Configuration for nominal bit time settings, including prescaler and time segments.

Register 3-4: C1NBTCFGL: CAN Nominal Bit Time Configuration Register Low

Configuration for nominal bit time settings, including time segments and synchronization jump width.

Register 3-5: C1DBTCFGH: CAN Data Bit Time Configuration Register High

Configuration for data bit time settings, including prescaler and time segments.

Register 3-6: C1DBTCFGL: CAN Data Bit Time Configuration Register Low

Configuration for data bit time settings, including time segments and synchronization jump width.

Register 3-7: C1TDCH: CAN Transmitter Delay Compensation Register High

Configuration for transmitter delay compensation modes and edge filtering.

Register 3-8: C1TDCL: CAN Transmitter Delay Compensation Register Low

Configuration for transmitter delay compensation offset and value bits.

Register 3-9: C1TBCH: CAN Time Base Counter Register High

Control register for the Time Base Counter (TBC) high bits.

Register 3-10: C1TBCL: CAN Time Base Counter Register Low

Control register for the Time Base Counter (TBC) low bits.

Register 3-11: C1TSCONH: CAN Timestamp Control Register High

Controls timestamping behavior, including reset, end-of-frame, and counter enable.

Register 3-12: C1TSCONL: CAN Timestamp Control Register Low

Controls timestamping behavior, including prescaler for the Time Base Counter.

Register 3-13: C1VECH: CAN Interrupt Code Register High

Defines codes for receive and transmit interrupts.

Register 3-14: C1VECL: CAN Interrupt Code Register Low

Defines codes for filter hits and other interrupt events.

Register 3-15: C1INTH: CAN Interrupt Register High

Enables various CAN interrupts, including message, mode, timer, and error interrupts.

Register 3-16: C1INTL: CAN Interrupt Register Low

Enables various CAN interrupts, including message, mode, timer, and error interrupts.

Register 3-17: C1RXIFH: CAN Receive Interrupt Status Register High

Status register for receive FIFO interrupt pending flags (high bits).

Register 3-18: C1RXIFL: CAN Receive Interrupt Status Register Low

Status register for receive FIFO interrupt pending flags (low bits).

Register 3-19: C1RXOVIFH: CAN Receive Overflow Interrupt Status Register High

Status register for receive FIFO overflow interrupt pending flags (high bits).

Register 3-20: C1RXOVIFL: CAN Receive Overflow Interrupt Status Register Low

Status register for receive FIFO overflow interrupt pending flags (low bits).

Register 3-21: C1TXIFH: CAN Transmit Interrupt Status Register High

Status register for transmit FIFO/TXQ interrupt pending flags (high bits).

Register 3-22: C1TXIFL: CAN Transmit Interrupt Status Register Low

Status register for transmit FIFO/TXQ interrupt pending flags (low bits).

Register 3-23: C1TXATIFH: CAN Transmit Attempt Interrupt Status Register High

Status register for transmit attempt interrupt pending flags (high bits).

Register 3-24: C1TXATIFL: CAN Transmit Attempt Interrupt Status Register Low

Status register for transmit attempt interrupt pending flags (low bits).

Register 3-25: C1TXREQH: CAN Transmit Request Register High

Controls message send requests for transmit objects (high bits).

Register 3-26: C1TXREQL: CAN Transmit Request Register Low

Controls message send requests for transmit objects (low bits) and TXQ.

Register 3-27: C1FIFOBAH: CAN Message Memory Base Address Register High

Defines the base address for transmit event FIFO and message objects.

Register 3-28: C1FIFOBAL: CAN Message Memory Base Address Register Low

Defines the base address for transmit event FIFO and message objects.

Register 3-29: C1TXQCONH: CAN Transmit Queue Control Register High

Controls TXQ payload size, FIFO size, retransmission attempts, and priority.

Register 3-30: C1TXQCONL: CAN Transmit Queue Control Register Low

Controls TXQ reset, message send request, increment behavior, TX enable, and interrupts.

Register 3-31: C1TXQSTA: CAN Transmit Queue Status Register

Provides status of the TXQ, including message index, aborted status, and pending interrupts.

Register 3-32: C1FIFOCONxH: CAN FIFO Control Register x High

Controls FIFO payload size, FIFO size, retransmission attempts, and priority for FIFOs 1-31.

Register 3-33: C1FIFOCONxL: CAN FIFO Control Register x Low

Controls FIFO reset, message send request, increment behavior, TX/RX selection, and interrupts for FIFOs 1-31.

Register 3-34: C1FIFOSTAx: CAN FIFO Status Register x

Provides status of FIFOs 1-31, including message index, aborted status, and pending interrupts.

Register 3-35: C1TEFCONH: CAN Transmit Event FIFO Control Register High

Controls the FIFO size for the Transmit Event FIFO (TEF).

Register 3-36: C1TEFCONL: CAN Transmit Event FIFO Control Register Low

Controls TEF reset, timestamping, and interrupt enables for overflow, full, half-full, and not-empty conditions.

Register 3-37: C1TEFSTA: CAN Transmit Event FIFO Status Register

Provides status flags for the TEF, indicating overflow, full, half-full, and not-empty conditions.

Register 3-38: C1FIFOUAxH: CAN FIFO User Address Register x High

Stores the user address for transmit/receive FIFO message objects (high bits).

Register 3-39: C1FIFOUAxL: CAN FIFO User Address Register x Low

Stores the user address for transmit/receive FIFO message objects (low bits).

Register 3-40: C1TEFUAH: CAN Transmit Event FIFO User Address Register High

Stores the user address for the next TEF object to be read (high bits).

Register 3-41: C1TEFUAL: CAN Transmit Event FIFO User Address Register Low

Stores the user address for the next TEF object to be read (low bits).

Register 3-42: C1TXQUAH: CAN Transmit Queue User Address Register High

Stores the user address for the next TXQ message object to be written (high bits).

Register 3-43: C1TXQUAL: CAN Transmit Queue User Address Register Low

Stores the user address for the next TXQ message object to be written (low bits).

Register 3-44: C1TRECH: CAN Transmit/Receive Error Count Register High

Contains error count bits and error state indicators for transmit and receive operations.

Register 3-46: C1BDIAG0H: CAN Bus Diagnostics Register 0 High

Contains data bit rate transmit and receive error counters.

Register 3-47: C1BDIAG0L: CAN Bus Diagnostics Register 0 Low

Contains nominal bit rate transmit and receive error counters.

Register 3-48: C1BDIAG1H: CAN Bus Diagnostics Register 1 High

Contains bits for various error types and an error-free message counter.

Register 3-49: C1BDIAG1L: CAN Bus Diagnostics Register 1 Low

Contains error-free message counters for nominal and data bit rates.

Register 3-50: C1FLTCONxH: CAN Filter Control Register x High

Controls filter enable and points to the object for filters d (high bits).

Register 3-51: C1FLTCONxL: CAN Filter Control Register x Low

Controls filter enable and points to the object for filters a and b (low bits).

Register 3-52: C1FLTOBJxH: CAN Filter Object Register x High

Defines filter object bits, including extended identifier enable and standard identifier bits.

Register 3-53: C1FLTOBJxL: CAN Filter Object Register x Low

Defines filter object bits, including extended identifier bits and standard identifier bits.

Register 3-54: C1MASKxH: CAN Mask Register x High

Defines mask bits for filters, including identifier mode and standard/extended identifier masks.

Register 3-55: C1MASKxL: CAN Mask Register x Low

Defines mask bits for filters, including standard and extended identifier masks.

4.0 MODES OF OPERATION

4.1 Mode Change

Explains how to change the operating mode of the CAN FD module via register settings.

4.1.1 CHANGING BETWEEN NORMAL MODES

Describes the requirement to use Configuration mode for switching between Normal modes.

4.1.2 CHANGING BETWEEN DEBUG MODES

Describes the requirement to use Configuration mode for switching between Debug modes.

4.1.3 EXITING NORMAL MODE

Explains that exiting Normal mode requires message transmission completion.

4.1.4 ENTERING AND EXITING DISABLE MODE

Details the process of entering and exiting Disable mode, including wake-up behavior.

4.1.5 BUS INTEGRATING MODE

Covers the conditions for entering the bus integrating state according to ISO11898-1:2015.

4.2 Configuration Mode

4.3 Normal Modes

Details the different Normal modes of operation for the CAN FD module.

4.3.1 NORMAL CAN FD MODE

Describes the Normal CAN FD mode, allowing mixed CAN FD/2.0 messages and bit rate switching.

4.3.2 NORMAL CAN 2.0 MODE

Describes the Normal CAN 2.0 mode, which only accepts Classic CAN 2.0 frames.

4.4 Disable Mode

4.5 Debug Modes

Explains the various debug modes for the CAN FD module.

4.5.1 LISTEN ONLY MODE

Describes Listen Only mode for passive bus monitoring and baud rate detection.

4.5.2 RESTRICTED OPERATION MODE

Details Restricted Operation mode, which allows reception but limits transmission types.

4.5.3 LOOPBACK MODE

Explains Loopback mode for internal message transmission testing without bus interaction.

4.6 Low-Power Modes

4.6.1 SLEEP MODE

Details the requirements and steps for entering Sleep mode, including prior Disable mode transition.

4.6.2 IDLE MODE

Explains Idle mode, its behavior based on the SIDL bit, and wake-up procedures.

4.6.3 WAKE-UP FROM SLEEP

Describes how the CAN module wakes up from Sleep mode, triggered by bus activity.

5.0 CONFIGURATION

5.1 Clock Configuration

Explains clock source selection and configuration for the CAN FD module.

5.2 CAN Configuration

5.2.1 ISO CRC ENABLE

Explains how to enable ISO CRC for CAN FD frames.

5.2.2 PROTOCOL EXCEPTION DISABLE

Describes disabling protocol exception events and their impact on synchronization.

5.2.3 WAKE-UP FILTER – WFT<1:0>

Explains the wake-up filter configuration for the CAN receive pin.

5.2.4 RESTRICTION OF TRANSMISSION ATTEMPTS

Details limiting retransmission attempts based on RTXAT and TXAT bits.

5.2.5 ERROR STATE INDICATOR (ESI) IN GATEWAY MODE

Explains how ESI bit behavior is configured for gateway applications.

5.2.6 MODE SELECTION IN CASE OF SYSTEM ERROR

Describes mode transition options (Restricted or Listen Only) upon system error.

5.2.7 RESERVING MESSAGE MEMORY FOR TXQ AND TEF

Explains how to reserve RAM for TXQ and TEF by setting specific bits.

5.3 CAN FD Bit Time Configuration

5.3.5 SYNCHRONIZATION JUMP WIDTH

Defines the Synchronization Jump Width (SJW) and its role in resynchronization.

5.3.6 OSCILLATOR TOLERANCE

Discusses oscillator tolerance and provides conditions for maximum oscillator tolerance.

5.3.7 BIT TIME CONFIGURATION EXAMPLE

Provides an example of configuring bit time parameters for a CAN FD network.

5.4 Message Memory Configuration

5.4.1 TRANSMIT EVENT FIFO CONFIGURATION

Explains how to configure the TEF for RAM space, message count, and timestamping.

5.4.2 TRANSMIT QUEUE CONFIGURATION

Details reserving RAM for TXQ, configuring message count, and payload size.

5.4.3 TRANSMIT FIFO CONFIGURATION

Explains configuring FIFOs as transmit buffers, setting message count, and payload size.

5.4.4 RECEIVE FIFO CONFIGURATION

Explains configuring FIFOs as receive buffers, setting message count, payload size, and timestamping.

5.4.5 CALCULATION OF REQUIRED MESSAGE MEMORY

Provides formulas and examples for calculating the total RAM required for CAN FD message memory.

6.0 MESSAGE TRANSMISSION

6.1 Transmit Message Object

Specifies the fields within a transmit message object used by TXQ and transmit FIFOs.

6.2 Loading Messages into Transmit FIFO

Describes the process of loading messages into a transmit FIFO and updating pointers.

6.3 Loading Messages Into Transmit Queue

Explains loading messages into the TXQ, checking for space, and updating pointers.

6.4 Requesting Transmission of Message in Transmit FIFO

Details how to initiate message transmission from a FIFO by setting TXREQ bits.

6.5 Requesting Transmission of Message in Transmit Queue

Explains how to initiate message transmission from the TXQ by setting the TXREQ bit.

6.6 C1TXREQ Register

Describes the C1TXREQ registers used for requesting transmissions from TXQ and TX FIFOs.

6.7 Transmit Priority

Explains how to configure transmit priority for FIFOs and the TXQ using TXPRIx bits.

6.7.2 TRANSMIT PRIORITY OF MESSAGES IN TXQ

Details how messages in the TXQ are prioritized based on their message ID.

6.7.3 TRANSMIT PRIORITY BASED ON ID

Explains the goal of transmitting messages based on ID to avoid priority inversion.

6.8 Transmit Bandwidth Sharing

Describes the bandwidth sharing feature and its configuration using TXBWS bits.

6.9 Retransmission Attempts

Covers configuring retransmission attempts, including disabling, three attempts, or unlimited.

6.10 Aborting Transmission

Explains how to abort pending transmissions in FIFOs and the TXQ before SOF.

6.11 Remote Transmit Request – RTR

Describes the RTR mechanism for requesting data and its configuration for transmit FIFOs.

6.12 Mismatch of DLC and Payload Size During Transmission

Details how the module handles mismatches between DLC and payload size during transmission.

6.13 Transmit State Diagram

Illustrates the state transitions for message queuing and transmission, including error handling.

6.14 Resetting Transmit FIFO

Explains how to reset a transmit FIFO using FRESET or Configuration mode.

6.15 Resetting Transmit Queue

Explains how to reset the Transmit Queue using FRESET or Configuration mode.

7.0 TRANSMIT EVENT FIFO – TEF

7.1 Reading a TEF Object

Describes how to read TEF objects, check for emptiness, and calculate addresses.

7.1.1 RESETTING THE TEF

Details methods for resetting the TEF, including FRESET and Configuration mode.

8.0 MESSAGE FILTERING

8.1 Filter Configuration

Describes configuring filters using C1FLTCON registers and enabling them with FLTEN bits.

8.2 Filtering a Received Message

Details the message filtering process after arbitration and control fields are received.

8.2.1 FILTERING STANDARD OR EXTENDED FRAMES

Explains how to configure filters to accept standard, extended, or both frame types.

8.2.2 MASK BITS

Describes the use of mask objects to ignore selected bits of the received identifier.

Figure 8-2: Filter Match

Illustrates the detailed logic flow for matching a filter object to a received message.

8.2.3 FILTERING ON DATA BYTES

Explains how DNCNT bits are used to compare data bytes with filter EID bits for standard frames.

8.2.4 12-BIT STANDARD ID

Describes the 12-bit standard ID mode and its impact on filtering.

9.0 MESSAGE RECEPTION

9.1 Receive Message Object

Specifies the contents of a receive message object, including ID, control bits, payload, and timestamp.

9.1.1 READING A RECEIVE MESSAGE OBJECT

Describes how to read received messages from RX FIFOs and update pointers.

9.3 Resetting RX FIFO

Explains how to reset an RX FIFO using FRESET or Configuration mode.

9.4 Mismatch of DLC and Payload Size During Reception

Details how the module handles mismatches between DLC and payload size during reception.

9.5 Message Reception Code Example

Provides a code example for receiving CAN FD extended frames and saving messages.

10.0 FIFO BEHAVIOR

10.1 FIFO Status Flags

Details the transmit and receive FIFO status flags and their meanings.

10.1.1 TX FIFO STATUS FLAGS

Describes the status flags for transmit FIFOs (empty, half-empty, not full).

10.1.2 RX FIFO STATUS FLAGS

Describes the status flags for receive FIFOs (full, half-full, not empty).

10.1.3 TXQ STATUS FLAGS

Describes the status flags for the TXQ (empty, not full).

10.1.4 TEF STATUS FLAGS

Describes the status flags for the TEF (full, half-full, not empty, overrun).

10.2 Transmit FIFO Behavior

Explains the behavior of transmit FIFOs, including status flags and user address updates.

10.3 Receive FIFO Behavior

Explains the behavior of receive FIFOs, including status flags and user address updates.

10.4 Transmit Queue Behavior

Explains the behavior of the TXQ, including status flags and user address updates.

11.0 TIMESTAMPING

Table 11-1: Reference Point

Specifies the reference points for CAN and CAN FD frame timestamping.

12.0 INTERRUPTS

Figure 12-1: Interrupt Multiplexing

Illustrates the interrupt multiplexing structure from individual FIFO interrupts to main interrupts.

12.1 FIFO Individual Interrupts

Details individual interrupts for FIFOs and the TXQ, including their sources and clearing mechanisms.

12.1.1 TRANSMIT QUEUE INTERRUPTS

Explains TXQ interrupts (Not Full, Empty) and their sources.

12.1.2 RECEIVE FIFO INTERRUPTS – RFIF

Describes receive FIFO interrupts (Full, Half Full, Not Empty) and their sources.

12.1.3 TRANSMIT FIFO INTERRUPTS – TFIF

Describes transmit FIFO interrupts (Not Full, Half Empty, Empty) and their sources.

12.1.4 RECEIVE FIFO OVERRUN INTERRUPT – RXOVIF

Explains the RXOVIF interrupt when a FIFO is full and a message is received.

12.1.5 TRANSMIT FIFO ATTEMPT INTERRUPT – TXATIF

Explains the TXATIF interrupt when retransmission attempts fail.

12.1.6 TRANSMIT EVENT FIFO INTERRUPTS – TEFIF

Describes TEF interrupts (Full, Half Full, Not Empty, Overrun) and their sources.

12.2 FIFO Combined Interrupts

Explains how individual FIFO interrupts are combined into status registers.

12.3 Main Interrupts

Details the main interrupts (RXIF, TXIF, RXOVIF, TXATIF, TEFIF) from combined FIFO interrupts.

12.3.1 INVALID MESSAGE INTERRUPT – IVMIF

Describes the IVMIF interrupt triggered by CAN bus errors or DLC mismatches.

12.3.2 WAKE-UP INTERRUPT – WAKIF

Describes the WAKIF interrupt triggered by bus activity during Sleep mode.

12.3.3 CAN BUS ERROR INTERRUPT – CERRIF

Explains the CERRIF interrupt for CAN bus errors, including transitions to error passive and bus off states.

12.3.4 CAN MODE CHANGE INTERRUPT – MODIF

Describes the MODIF interrupt triggered by changes in the CAN module's operating mode.

12.3.5 CAN TIMER INTERRUPT – TBCIF

Explains the TBCIF interrupt triggered by the Time Base Counter rollover.

12.3.6 SYSTEM ERROR INTERRUPT – SERRIF

Describes SERRIF interrupts for bus bandwidth errors and RX MAB overflows.

12.4 Interrupt Handling

Explains efficient interrupt handling using lookup tables and status registers.

12.4.1 INTERRUPT LOOKUP TABLE

Details using C1VECL registers for implementing an interrupt lookup table.

12.4.2 INTERRUPT STATUS REGISTERS

Explains using combined interrupt status registers for efficient interrupt servicing.

12.5 Interrupt Flags

Summarizes all interrupt flags, their registers, categories, and clearing methods.

13.0 ERROR HANDLING

Figure 13-1: Error States

Illustrates the different error states of the CAN FD Protocol Module.

13.1 Recovery from Bus Off State

Explains the process of recovering from the Bus Off state, including automatic recovery sequences.

14.0 RELATED APPLICATION NOTES

15.0 REVISION HISTORY

Related product manuals