 Hello and welcome to this presentation of the flexible data rate controller area network interface. It covers the main features of this interface which is widely used to connect the microcontroller to a CAN network. The flexible data rate controller area network is a standard serial differential bus broadcast interface that enables the microcontroller to communicate with the external devices connected to the same network bus. The FD-CAN interface is highly configurable, enabling nodes to easily connect using just two wires. Applications benefit from a multi-master concept with message priority, object-oriented communication i.e. no-node addressing but content identification, real-time capability with low message transfer latency and system-wide message consistency i.e. error detection and management mechanism. The STM32L5 microcontroller embeds one FD-CAN controller. The FD-CAN controller supports both the basic extended CAN protocols version 2.0a and b with a maximum bitrate of 1 megabit per second as well as the CAN-FD protocol version 1.0 with up to 64 data bytes and a data bitrate of up to 8 megabit per second. The CAN-CORE contains the protocol controller and received transmit shift registers. It handles all ISO 11898-1 2015 protocol functions and supports both 11-bit and 29-bit identifiers. The TX handler controls the message transfer from the message RAM to the CAN-CORE while the RX handler controls the transfer of received messages from the CAN-CORE to the external message RAM. Two clock domains are implemented. The APB bus interface and the CAN-CORE kernel clock and therefore synchronization blocks are required between these two domains. A shared 0.8 kilobyte message RAM memory is available. This RAM is used to contain the filters, buffers and FIFOs. The CAN subsystem IO signals and pins are detailed in this table. Two clocks are provided to the FD-CAN unit. FD-CAN-CK, the kernel clock used to obtain the bitrate, FD-CAN-PCLK, which is the APB clock used to access memory mapped registers and message RAM. Two interrupt outputs enable the FD-CAN unit to report events to the Cortex M33 processor. An external 16-bit timestamp input port can be used by the FD-CAN unit to timestamp the transmission or the reception of a message. This timestamp is provided by a timer contained in the FD-CAN block. FD-CAN-RX and FD-CAN-TX have to be connected to the transceiver. Finally, the APB slave interface is internally split in three parts, each of them having a dedicated chip select, configuration, control and RAM access. The FD-CAN controller conforms with the CAN protocol version 2.0 part A, B and ISO 11898-1 2015 and CAN FD protocol with maximum 64 data bytes supported. Maximum bitrate in FD mode is 8 megabits per second. The controller also supports two independent maskable interrupts, each one having 24 fully configurable interrupt flags. The controller has a power down mode. It supports error logging, autosar, J1939 and separate signalling on reception of high priority messages. Three received messages can be stored in each of the two RX-FIFOs. The acceptance filter selects the FIFO to use. Three messages to transmit can be stored as part of the message RAM configured either as a TX-FIFO or as three separate TX buffers. Each entry of the RX-FIFO and TX-FIFO or TX buffers supports the maximum message size 64 bytes of payload. The TX-Event-FIFO stores TX timestamps together with the corresponding message ID. There are two variants in the FD-CAN protocol. Long frame mode or LFM where the data field of a CAN frame may be longer than 8 bytes up to 64 bytes. Fast frame mode or FFM where control field, data field and CRC field of a CAN frame are transmitted with higher bitrate compared to the beginning and to the end of the frame. This high data rate is typically 8 megabits per second. Fast frame mode can be used in combination with long frame mode. The bit timing logic monitors the serial bus line and performs sampling and adjustment of the sample point by synchronizing on the start bit edge and resynchronizing on the following edges. Regarding FD-CAN, the data bit time and the nominal bit time have two separate definitions depending on the time quantum value. The time quantum is the basic timing unit obtained from the configuration unit and equal to TFD-CAN-TQCK multiplied by a ratio from 1 to 512, programmed in the FD-CAN-NBTP register for nominal bit time and equal to TFD-CAN-TQCK multiplied by a ratio from 1 to 32, programmed in the FD-CAN-DBRP register for data bit time. The bit time is split into three segments. The synchronization segment, the bit segment 1 and the bit segment 2. Each of these segments is an integer multiple of the time quantum. The duration of BS1 and BS2 is independently programmable for nominal bit time and data bit time. The data bit time applies when operating in FD mode and data are transmitted at the high data rate. In order to adjust the on-chip bus clock, the CAN controller may shorten or prolong the length of a bit by an integral number of quanta. The maximum value of these bit time adjustments are termed by the synchronization jump width, SJW, which is programmable from 1 to 4 time quanta. The transmitter delay compensation enables configurations where the data bit time is shorter than the transmitter delay. It's activated by setting the TDC bit in the TBTP register. The received bit is compared against the transmitted bit at the secondary sample point. The SSP position is defined as the sum of the measured delay from the FD-CAN transmit output pin FD-CAN-TX through the transceiver to the receive input pin FD-CAN-RX plus the transmitter delay compensation offset. The transmitter delay compensation offset is used to adjust the position of the SSP inside the received bit, e.g. half of the bit time in the data phase. The FD-CAN has three main operating modes, initialization, normal and sleep. After a hardware reset, the FD-CAN enters initialization mode via software. In this mode, the peripheral must be configured for bit timings and RAM location. In the bit timing configuration, the rate is set when the sampling point is adjusted according to the actual serial bus line. The CAN controller then synchronizes itself with a CAN bus by waiting for 11 consecutive recessive bits. When the CAN is in normal mode, the user can select different specific sub-modes, classic CAN mode compatible with CAN specifications 2.0B, FD-CAN mode, it can be long frame and or fast frame mode named respectively LFM and FFM. Restricted mode, the controller is able to receive data frames and acknowledge them but does not send frames. It can be used in applications that adapt themselves to different CAN bit rates. Bus monitoring mode, the controller is able to receive data frames but cannot acknowledge them. It can be used to analyze the traffic on a CAN bus without affecting it by the transmission of dominant bits. Test modes detailed in next slide. Upon a CPU request, the FD-CAN is put in sleep mode which operates at a lower power when bus idle state is detected. To enable write access to the FD-CAN test register, the test bit in CCCR register must be set to 1 thus enabling the configuration of test modes and functions. In test mode, software can control the state of the FD-CAN TX pin and can read the state of FD-CAN RX. Through the FD-CAN test register, software can control the FD-CAN TX output, force dominant level, force recessive level, monitor the sample point. The actual value at pin FD-CAN RX can be read from the RX bit in the FD-CAN test register. Both functions can be used to check the CAN bus physical layer. These test modes should be used for production tests or self-test only. Furthermore, the FD-CAN controller supports two loopback modes that are entered through control bits in the FD-CAN test and FD-CAN CCCR registers. In external loopback mode, the FD-CAN treats its own transmitted messages as received messages and stores them into RX-5Os if they pass acceptance filtering. This mode is provided for hardware self-tests. To be independent from external stimulation, the FD-CAN ignores a knowledge errors in loopback mode. Internal loopback mode can be used for a hot self-test, meaning the FD-CAN can be tested without affecting a running CAN system connected to the FD-CAN TX and FD-CAN RX pins. In this mode, the FD-CAN RX pin is disconnected from the FD-CAN and the FD-CAN TX pin is held recessive. The FD-CAN controller offers the possibility to configure two sets of acceptance filters, one for standard 11-bit identifiers and another for 29-bit extended identifiers. Each filter element is configurable for acceptance or rejection filtering. Each filter element can be enabled or disabled individually. Filters are checked sequentially, execution stops with the first matching filter element. Software configures the number of active filter instances that maximum is 28. Acceptance filtering is started after the complete identifier has been received. After acceptance filtering has completed and if a matching RX-5O has been found, the message handler starts writing the received message data in 32-bit portions to the matching RX-5O. Each filter element can be configured as range filter from to, filter for one or two dedicated IDs, classic bit mask filter. Regarding extended ID, the extended ID and mask, or XIDAM, is ended with the received identifier before the filter list is executed. To filter for one specific message ID, the filter element has to be configured with SF1ID equals SF2ID and EF1ID equals EF2ID. This algorithm describes the filtering sequence of frames received with a standard ID. A similar algorithm is used to handle frames received with an extended ID, however, the configuration of these two algorithms is done independently. The first step is accepting or rejecting the remote frames. Then, when the receiver list is disabled, the filter elements are bypassed. Otherwise, the first matching element determines whether the frame is accepted or rejected. When the receiver filter is disabled or no filtering elements have marched, the frame is either accepted or rejected. At last, when the frame is accepted and the targeted RX-5O is not full, this frame is appended to the RX-5O. When the RX-5O is full and blocking mode is selected, then the frame is discarded. RX-5O0 and RX-5O1 can hold three elements each. Received messages that past acceptance filtering are transferred to the RX-5O as configured by the matching filter element. The read-only registers fdcanrxf0s and fdcanrxf1s provide the following information. Position of the put index, position of the get index, number of pending messages, FIFO full condition. The RX-5O blocking mode is the default operation mode for the RX-5Os. When an RX-5O full condition is reached, no further messages are written to the corresponding RX-5O until at least one message has been read out and the RX-5O get index has been incremented. If a message is received while the corresponding RX-5O is full, this message is discarded and the message loss condition is signalled. In RX-5O override mode, when an RX-5O full condition is signalled, the oldest message is discarded and the next message is accepted as shown in the sequence on the right. Put and get indexes are both incremented by one. Three TX buffers can be set up for message transmission. Either the TX-5O mode is chosen in which all messages are transmitted in the same order that have been prepared by software, or the TXQ mode is chosen in which the three message buffers are handled independently of each other. Messages stored in the TXQ are transmitted starting with a message with the highest priority. The FD-CAN controller supports transmit consolation. To cancel a requested transmission from a TXQ buffer, software has to write a 1 to the corresponding bit position of registered TX-BCR. Transmit consolation is not intended for TX-5O operation. To support TX event handling, the FD-CAN has implemented a TX-Event-5O. The purpose of the TX-Event-5O is to decouple handling transmit status information from transmit message handling. A TX buffer holds only the message to be transmitted while the transmit status is stored separately in the TX-Event-5O. This has the advantage, especially when operating a dynamically managed transmit queue, that a TX buffer can be used for a new message immediately after successful transmission. There is no need to save transmit status information from a TX-Buffer before overwriting that TX-Buffer. If the TX-Event occurs while the TX-Event-5O is full, this event is discarded and interrupt flag is set. An FD-CAN controller peripheral provides two independent interrupt lines. This slide shows the complete list of possible interrupt events. Here is an overview of the FD-CAN subsystem low power configuration modes. The device is not able to perform any communications in stop or standby modes. It's important to ensure that all CAN traffic is completed before the peripheral enters stop or standby modes. While the CPU core is in debug mode, i.e. stopped at a breakpoint, then FD-CAN remains in its normal functioning mode. In particular, reception continues as normal and this may lead to reception overrun errors when 5Os or buffers are full. Registers of the type reset on read or set on read are disabled. Reading them doesn't affect their value. For additional information, refer to the training for these peripherals which may affect FD-CAN behavior. Reset and clock controller or RCC for more information about the CAN clock control and enable or reset. Interrupts for more information about the mapping of the FD-CAN's interrupts. General purpose IOs or GPIO for more information about the FD-CAN's input and output pins. Debug support or DBG for more information about the FD-CAN's behavior in debug mode. Application notes covering the CAN topic are available on www.sd.com. To learn more about the CAN interface, you can also visit a wide range of web pages discussing the CAN communication protocol and bus monitoring tools. Many digital oscilloscopes support direct reading and analysis of data transmitted over the CAN bus.