An5416 Spc58ec Can Bus Configuration Stmicroelectronics
An5416 Spc58ec Can Bus Configuration Stmicroelectronics
Introduction
This application note is intended for software developers wishing to develop an application with CAN communication.
The aim of this application example is to transmit messages through a CAN controller from Node 1, implemented with
STMicroelectronics SPC58ECx, to another Node 2 exposing a CAN controller. The assumption is that Node 2 implementation is
unknown so it will be treated as a black box.
It is assumed that the reader has knowledge of embedded MCU architecture and basic principles of embedded software
development with C language.
1 Hardware overview
To implement the example application, the following components have been used:
• SPC58EC-DISP discovery board hosting a 4MB Flash memory 32-bit SPC58 automotive microcontroller.
SPC58EC-DISP represents the NODE 1 of our example.
• One 1 A / 12 V power supply for SPC58EC-DISP.
• One mini-B USB to USB Type-A cable to connect the MCU programmer.
For information on the software package, see dedicated Section 3 Create a new project with SPC5-Studio, using
the application wizard.
Figure 2. SPC58EC-DISP
Each controller needs to be configured choosing parameters values base on the network where the controller is
connected. As shown in Table 1. Subsystems below, the first four CAN controllers belong to Subsystem0 and the
remaining controllers belong to Subsystem1.
Table 1. Subsystems
Subsystem0
CAN1 MCAN0
CAN2 MCAN1
CAN3 MCAN2
CAN4 MCAN3
Subsystem1
CAN7 MCAN1
CAN8 MCAN2
CAN9 MCAN3
CAN10 MCAN4
In the application example described in this document, the transmission and reception of a message via CAN2
(CAN2 supports CANFD) will be demonstrated. If you want to use other controllers, please refer to the
SPC58ECx documentation.
At this point, it is also important to give the user an overview of the Message RAM.
The message storage is intended to be a single-ported Message RAM outside of the module. Depending on the
selected device, multiple M_CAN controllers can share the same Message RAM.
All functions concerning the handling of messages are implemented by the RX Handler and the TX Handler.
The RX Handler manages message acceptance filtering, the transfer of received messages from the CAN core to
the Message RAM and it also provides receive message status information.
The TX Handler is responsible for the transfer of transmit messages from the Message RAM to the CAN core and
it also provides transmit status information.
Since the Message RAM is equipped with the ECC functionality, it is recommended to initialize the Message RAM
after hardware reset by writing 0x0.
This avoids that reading from uninitialized Message RAM sections will activate interrupt IR.BEC (Bit Error
Corrected) or IR.BEU (Bit Error Uncorrected).
The previous chapters have briefly described the CAN protocol, the CAN controllers and the purpose of the
present application example.
This chapter describes the methods and steps to follow to create a new project with SPC5-Studio. SPC5-Studio is
based on Eclipse Engine. SPC5-Studio allows the user to create an entirely new project or rely on the pre-
developed demo related to the specific MCU supported and the reference driver.
The creation of a new project with SPC5-Studio can be summarized in the following figure:
This example relies on the CAN driver demo available for the SPC58EC microntroller. The demo is used as a
starting point for this application. Then, the demo will be fine tuned by changing the fields and source code to
adapt it to this application example.
The import through the wizard procedure in SPC5-Studio can be summarized in three steps:
Step1. Import a sample application
To import a sample application, click on "Import samples from application library" as highlighted below and then
go to step 2.
The selection of the demo application is now completed and the code in this project can be imported.
4 PIN configuration
This chapter explains how to select and configure the microcontroller pins needed for our application example.
Some I/O pins of SPC58ECx can be identified as ports. The pins are the physical connections, only one specific
function may be associated to a specific pin.
The port is a logical abstraction of the pin in the sense that it is possible to associate one at the time a list of
functions to the PIN through the internal configuration of the MCU registers.
A specific plug-in called the PinMap Editor is available in the SPC5-Studio: this is an intuitive graphical interface
dedicated to the microcontroller's pin configuration.
The PinMap Editor monitors the configuration procedure step by step. In particular, it supports the user by
disabling the options not compatible with the selected driver.
Here is a brief summary of the pin configuration procedure:
1. Select the driver, e.g. CAN1;
2. Select the signal by clicking on the driver. A list of signals to be configured will appear, e.g. in our example
RX and TX for the CAN;
3. For each signal select the pin to configure. Once selected, the pin is highlighted in the PinMap GUI;
4. Right-click on the highlighted pin to select the signal direction: input, output or I/O;
5. If the above configuration is properly set, it will be possible to select the pre-loaded configuration related to
the specific signal.
One of the main advantages of using SPC5-Studio is the automatic code generation based on the pin
configuration settings.
Pins are grouped by function or by driver, so two pin selection modes can be distinguished:
1. Pin selection from schematic;
2. Pin selection from function.
Select the pin and click on the right option to select the signal direction: input, output or I/O.
After selecting the signal direction, select the pre-loaded configuration on SPC5-Studio related to the signal that
you need for your application. If you commit an error in choosing the pin direction, then you will not find the pre-
loaded configuration related to the signal of the chosen driver.
After selecting the driver, you can use the list of signals to choose the signal required to configure the pin:
For each signal related to the specific driver all the eligible pins are shown with reference to the microcontroller
ports:
Select the pin and click the right button, then select the signal direction: Input in this specific case.
For CAN2 (refer to Table 1. Subsystems), there are two signals to set, RX and TX. RX is an input signal and TX is
an output signal.
A possible pin configuration for our application is showed in the below Figure 19:
Note: By default each SPC5-Studio application provides a pin configuration suitable to run fine on the target. In any
case, as detailed in this document, you can modify and tune the setup according to your needs using the
PinMap wizard.
The controller area network (CAN bus) is a robust vehicle bus standard designed to allow microcontrollers and
devices to communicate with each other in applications without a host computer.
It is a message-based protocol, designed originally for multiplexing electrical wires within automobiles to save on
copper, but it is also used in many other contexts.
CAN is a multi-master serial bus standard for connecting electronic control units also known as nodes.
Two or more nodes are required on the CAN network to communicate. The complexity of the node can range from
a simple I/O device up to an embedded computer with a CAN interface and sophisticated software.
All nodes are connected to each other through a two-wire bus. A network consists of a twisted pair terminated on
both sides with a 120 Ω resistor (see Figure 1).
Each node is able to send and receive messages, but not simultaneously. A message (or frame) consists mainly
of three parts: arbitration, control and data fields. The arbitration field contains the message identifier that
represents the message priority (the lowest identifiers values have the highest priority).
The standard CAN message has a maximum of 8-byte data length. The CAN-FD extends the data frame length to
64 bytes per frame. The following figure shows the CAN standard and the extended frames:
The nodes will always listen and receive all of the messages, therefore in the CAN protocol it is not possible to
send messages to a specific node.
The CAN transmits data according to a model based on "dominant" and "recessive" bits. A zero bit is called
dominant while an 1 bit is called recessive. Dominant bits prevail on recessive bits during the arbitration phase,
where two or more nodes start to send frames at the same time.
In the case of contention of a bus the priority of each message needs to be defined.
The data frame is the most common message type, and comprises:
• Arbitration field;
• Control field;
• Data field;
• CRC field;
• Acknowledgment field.
The Arbitration field is the part of the CAN frame that defines the priority of the message.
The priority assignment to messages in the identifier is a CAN feature that makes it particularly attractive for use
in a real-time control environment.
Thus, the lower is the message identifier, the higher is its priority.
An identifier consisting entirely of zeros is the message with the highest priority on a network, therefore it is the
message on the bus with the longest dominant portion compared to the portion in all other messages.
The CRC field and the ACK field have the task of detecting any errors in the transmission of messages.
The robustness of CAN protocol depends on a different error detection mechanism.
If a sent message is not acknowledged by any other node, it will be transmitted again until it is received correctly.
The error reporting process consists of the following phases:
• A CAN controller detects an error (while sending or receiving);
• An error frame is immediately transmitted;
• The message is ignored by all nodes;
• The status of the CAN controller is updated;
• The message is retransmitted.
An error can be detected in 5 ways, 3 of which at message level and 2 at single bit level:
1. Bit Stuffing Error: a node during the transmission inserts a bit of opposite polarity after 5 consecutive bits of
the same polarity; this is called bit stuffing. Therefore a node that receives more than 5 consecutive bits of
equal sign will detect an error of this type.
This concept is shown in the following Figure 21:
2. Bit Error: a transmitting node always listens to the bus to check the correspondence with what it is
transmitting. If a different bit than the one sent is received, a bit error will be signaled.
3. Checksum Error: The checksum is a sequence of bits associated with the transmitted packet, it is used to
verify the integrity of a message that can be altered during transmission on the communication channel.
The simplest type of checksum consists in summing all the bits of the message in transmission and storing
the resulting value in the sent frame.
To verify the integrity of the message, it will be sufficient to do the same summing operation and compare it
with the checksum stored in the frame.
If the two values coincide, the data can be considered complete, otherwise an error message will be
signaled.
Cyclic Redundancy Check (CRC) is a checksum method. The name derives from the output data obtained
by processing the input data which are cyclically run through a logical network.
4. Frame Error: An error frame is generated by any node that detects a bus error.
These error frames "destroy" the current data or the remote frame on the bus.
The transmitting node will know that the message has not been correctly received by all the nodes and will
try to send the message again.
5. Acknowledgment Error: The ACK field is used to confirm receipt of a valid CAN frame.
Each node that receives the frame without an error transmits a dominant level in the ACK field and then
overwrites the recessive level of the transmitter.
If a transmitter detects a recessive level in the ACK field, it knows that no receiver has found a valid frame.
So, if a transmitter does not read back a dominant ACK bit, it will send an acknowledgment error message.
Low-level drivers component in SPC5-Studio contains a collection of low-level drivers for Register Level Access
(RLA) components. RLA is a feature available in SPC5-Studio to allow easy and direct access to MCU and
peripheral registers. The RLA component can be added and configured via the Application wizard.
The low-level driver is related of the configuration and choice of the components to add. In this application the
chosen component is the CAN controller. The configuration of each component will be explained in detail in the
following sections.
Click here
Double-click on MCAN setting and choose the CAN controllers for at least one subsystem, the CAN2 will be
selected in this case.
2. MCAN configuration:
Clicking on CAN configuration opens a window which allows the user to add and setup a MCAN
configuration of that particular subsystem.
To configure the parameters of the structures that will be necessary for a MCAN configuration, a graphical
interface is available.
These configurations will be converted into codes only after generation. When the code generation
command is clicked, all the structures and definitions will be generated automatically.
For each subsystem there could be a different configuration, which the user can create with SPC5-Studio by
clicking on the icon highlighted in the following Figure 24. A new configuration will be created with the
following symbolic name: mcanconf.
In detail by clicking the green icon “ ” a window will open in which you can create a new configuration.
To remove the configuration created you have to select it and then click the red icon “ ”.
The next sections will describe how you can rename the created configuration.
Clicking on the configuration will open the window that contains all the fields that
AN5416 - Rev 1 the user needs to configure his MCAN. page 18/42
AN5416
Loopback
Clicking on the configuration will open the window that contains all the fields needed to configure the MCAN.
This section will analyze only the "CAN Configuration Setting [0]" field, which is useful for modifying the Symbolic
Name.
The following fields will require certain theoretical concepts that will be investigated and explained in the following
paragraphs, also inherent with the MCAN configuration.
This application uses only the MCAN1 of Subsystem0.
6.3 Loopback
A fundamental debugging mode of CAN controllers is the Loopback mode. Immediately after "CAN Configuration
Setting [0]" the user is asked to configure the type of General Configuration to be used.
The Loopback is a feature that allows the CAN controller to talk to itself without sending anything on the Bus.
Loopback refers to the routing of electronic signals, to their origin without intentional processing or modification.
This is mainly a means of testing the transmission infrastructure.
Loopback is used only for troubleshooting and as a preliminary simulation.
There are three different types of configuration:
1. External Loopback
In this mode, the CAN module treats its messages as received messages and stores them in FIFO RX, i.e. a
set of buffers where the received messages are saved. Figure 28 shows the connection of the TX and RX
signals to the MCAN in External Loopback mode. This mode is provided for the hardware self-test.
To be independent from external stimulation, the M_CAN ignores acknowledge errors in Loopback mode.
In this mode the actual value of the CAN RX input pin is ignored by the M_CAN. The message is copied in
RX and also the transmitted messages can be monitored on the CAN TX output pin.
2. Internal Loopback
In this mode the MCAN can be tested without affecting a running CAN system connected to the CAN TX
output and RX input pins.
In this mode MCAN TX pin is disconnected from the MCAN, and MCAN TX pin is held recessive. Figure 29
shows the connection of MCAN TX pin and RX to the M_CAN in case of Internal Loopback mode.
3. No Loopback:
The real transmission mode is used. Figure 30 shows two different ways to perform a real CAN
transmission, via CAN-H and CAN-L pins or via DB9 Connector (also connected to CAN-H and CAN-L).
CAN_High Pin
The next step for the configuration of the low-level drivers is the setting of the clock and timing parameters.
This set of parameters allows the baudrate and bit sampling point configuration.
The bit time corresponds to the time that a transmitting node must keep the bus at a constant logical level so that
it is recognized by any receiving node.
The CAN protocol divides each bit time into four segments, each of which consists of an integer multiple of the
Time Quantum. The Time Quantum is a fixed time reference derived from the period of oscillation of the protocol
clock.
The Clock Prescaler is a frequency regulator. The user can tune the bit rate by using a proper divisor value
(stored in the Clock Prescaler register).
The three segments that make up the bit rate are shown below:
Note: Sync=1 time quanta and NTSEG1 is the sum of Prop_Seg and Phase_Seg1.
Prop_Seg compensates the delay in the propagation of the signal among two nodes.
Phase_Seg1 is the segment employee to compensate the error introduced in the bus on the sample point (refer
to Table 5. RM0407 Reference manual).
SPC5-Studio will ask you to configure the following fields:
NSJW: As a result of Resynchronization, the NTSEG1 may be lengthened or the NTSEG2 may be shortened.
The amount of lengthening or shortening of these segments has an upper bound given by the NSJW.
NTSEG1-2: Both segments, NTSEG1 and NTSEG2, are used to define the sampling point of a bit. The length of
NTSEG1 and NTSEG2, within certain limits set by the value of Resynchronization Jumper Width (NSJW), can
respectively be lengthened or shortened to recover the lost synchronization. NTSEG1 and NTSEG2 can assume
values between 1 and 8 time quanta (tq).
All concepts introduced in this paragraph are useful to understand how the timing parameters were set to
calculate the bit rate. In our case bit rate = 125000, as shown in the Figure 33.
Protocol clock is provided by programming the CGM module as shown in the above Figure 33.
Another clock is the host clock that is the PFBridge_Clock. This is for the host controller.
The following formula must be respected for having a proper MCAN setup:
HOSTCLK ≥ Protocol clock
Clock Jitter Enable is a software-accessible one-time writable register. This register stores the jitter enable status
for the Pseudo Random Clock Divider Module (PRCD).
The clock jitter is activated in case of tampering. It represents in all respects a "counter-piracy” filter. If it is
triggered, it will no longer be possible to unlock the microcontroller.
CAN-FD (CAN with Flexible Data Rate) is an extension to the original CAN bus protocol specified.
CAN-FD was created to accommodate increases in bandwidth requirements within automotive networks.
CAN-FD also allows for more storage capacity in the CAN Frame. While classic CAN has the capacity to hold 8
bytes of data within the CAN frame, CAN-FD can hold up to 64.
The user can disable or enable the interrupt to which a specific callback function will be associated; the number of
RX buffers can be defined between 0 and 64.
The callback function allows the developer to add a specific entry point for a specialized routine that will be called
inside the ISR.
Interrupts are requests to MCU triggered by different configurable events. IRQs typically come from peripherals
and ask the microcontroller to interrupt their work to respond to peripheral needs. In some cases the MCU can
reject the request and refuse to stop working. If instead it accepts, it will take care of the needs of the device, then
it will resume the execution of the program.
In the CAN protocol the messages will be received by all the nodes, but they are stored in memory only if they
pass the CAN controller acceptance filters.
How to add and configure a filter element for a dedicated RX buffer is described below:
Click the green icon “ ” to add a filter, which will have to be set:
To configure the filter, double click on the generated filter and choose the type of filter (Standard or Extended), the
value and the RX buffer number. The latter must be less than or equal to the chosen number of dedicated RX
buffers:
The filter value is set by the user and is used to filter the values that the RX buffer, relative to a given CAN
instance, must receive.
Figure 39. SPC5-Studio: CAN FIFO and FIFO filters configuration tab
6.8 TX configuration
There are several modes to manage TX buffers, such as::
• Dedicated;
• FIFO;
• QUEUE;
• MIXED FIFO or QUEUE.
The Dedicated TX Buffers are intended for message transmission. Each Dedicated TX Buffer is configured with a
specific Message ID.
Behind the concept of FIFO Buffer: the data are managed and organized through the logic that the first one that
comes in is the first one that comes out.
QUEUE is intended as a data structure in which messages are assigned with a priority or a different weight.
The Arbiter is able to select the message to be sent according to its priority, starting from the higher priority
message to the lower one.
Consequently, the transmission does not rely on the message arrival order but on the priority assigned.
The MIXED mode is a combination of two modes. There are two types of MIXED modes:
• DEDICATED and FIFO;
• DEDICATED and QUEUE.
The two logics cannot coexist. The MIXED Mode is suitable for complex applications where the user needs to
regulate the transmission of some messages via FIFO or QUEUE and others through DEDICATED buffer.
Note: For the DEDICATED Mode SPC5-Studio gives the possibility to set only the TX buffer number.
For QUEUE and FIFO Mode you can set the number of FIFO or QUEUE Buffers and instead for the MIXED
Mode you can set both.
The next three phases are: save the project, generate the code and compile it.
Through code generation, all settings done by the user are generated in specific libraries. These libraries are
related to the component drivers employed in the application, i.e. the CAN component in our case.
The image below shows how to execute the above three phases:
Compile
Save Generate
8 Code overview
This chapter describes the code used in our application and illustrates some meaningful parts of the code.
The three key functions used in this application are:
• can_lld_start: Initialize the drivers of the subsystems;
• can_lld_transmit: Transmit a message;
• can_lld_receive: receive a message.
typedef struct {
uint8_t OPERATION; /**< NORMAL or CANFD */
uint8_t TYPE; /**< Id type. STD or XTD, Standard or Extender */
uint32_t ID; /**< Standard identifier, message’s priority.*/
uint8_t DLC; /**< Data Length Code. */
uint32_t data32[SPC5_CAN_MAX_DATA_LENGHT/4U]; /**<Frame data.*/
TX_Mode Name_SPC5-Studio
RX_Buffer Name_SPC5-Studio
• &message_receive (rxf): represents the location where to store the received message.
Now the structure of the message received, CANRxFrame, will be described:
• TIME: indicates the timestamp. This is a number that expresses a temporal magnitude; more precisely, it
corresponds to the number of bit time that has elapsed since the moment the message was sent;
• OPERATION: indicates if you are using CAN Normal (CAN_OP_NORMAL) or CANFD (CAN_OP_CANFD);
• TYPE: indicates the type of message. There are two types: CAN_ID_STD or CAN_ID_XTD;
• ID: is the priority of message;
• DLC: indicates the Data Length Code;
• Data32: is the data Frame.
/* Inclusion of the main header files of all the imported components in the
order specified in the application wizard. The file is generated
automatically.*/
#include "components.h"
#include "can_lld_cfg.h"
This header files, "components.h" and "can_lld_cfg.h", include the code generated automatically. These libraries
contain all the files resulting from the configuration in PinMap Editor and in low-level drivers.
Here the code recalls the callback configuration. Its structure is within the library "can_lld_cfg.h":
/*
* Application entry point.
*/
int main(void) {
CANTxFrame txf;
uint32_t returnvalue;
/* Initialization of all the imported components in the order specified in
the application wizard. The function is generated automatically.*/
componentsInit();
/* Enable Interrupts */
irqIsrEnable();
can_lld_start(&CAND2, &can_config_mcanconf);/*MCAN SUB 0 CAN 1*/
In this portion of code the frame will be prepared to be transmitted and initialize the variable counter used as
message body. The structure of CANTxFrame contained in header file "can_lld_cfg.h".
Here the message is sent and this part of code contains the second key function: can_lld_transmit.
If the transmission of message fails, the code enters an endless loop, this it is a feature of used test. The structure
of CANRxFrame is contained in header file "can_lld_cfg.h".
CANRxFrame rxf;
returnvalue = can_lld_receive(&CAND2, CAN_ANY_RXBUFFER, &rxf);
if (returnvalue == CAN_MSG_OK) {
if (rxf.ID == 0x7f0U) {
if (rxf.data32[1] == counter) {
pal_lld_togglepad(PORT_F, PF_LED2);
}
}
}
Here the message is received and this part of code contains the last key function: can_lld_receive.
If the transmission of message doesn’t fail, the ID frame is correct one and there is not loss of packets then the
LED 2, in the MCU discovery board, will blink.
This chapter will show how to check the correct transmission and reception of messages. This test will be
performed in No Loopback mode.
The first step is to verify the correct transmission of the message through the use of UDE STK 4.8.
UDE STK 4.8 is a Debugging Software for Windows developed by PLS Development Tools.
Figure 42 shows the results obtained in the respective break points:
The CAN bus sniffer GUI allows the visualization of received messages.
The message received in this example is shown below:
The last step is to verify that what has been transmitted has been received.
Attention: Without any ID filters applied no message will be received.
Terms Meaning
SPC58x MCU CAN Subsystem CAN instance in a subsystem I/O pin table
SPC58x MCU CAN Subsystem CAN instance in a subsystem I/O pin table
The user could also meet, while porting or debugging software code, some other different names, for example:
CANSUB_<x>_MCAN_<y>. The above table can help on matching the instance inside the related subsystem.
In SPC5-Studio please refer to Table 1. Subsystems that describes the MCAN software instances inside each
subsystem.
Revision history
Contents
1 Hardware overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2
2 CAN subsystem overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
3 Create a new project with SPC5-Studio, using the application wizard . . . . . . . . . . . . . . . 5
4 PIN configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7
4.1 Case 1. Pin selection from schematic. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
4.2 Case 2. Pin selection from function. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
List of tables
Table 1. Subsystems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Table 2. Values TX_Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Table 3. Values RX_Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Table 4. Acronyms and abbreviations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Table 5. Reference documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Table 6. MCAN naming conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Table 7. Document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
List of figures
Figure 1. Basic application principle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Figure 2. SPC58EC-DISP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Figure 3. CAN subsystem generic block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Figure 4. Message RAM configuration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Figure 5. SPC5-Studio: new application wizard tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Figure 6. SPC5-Studio: new application import from library tab. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Figure 7. SPC5-Studio: device selection menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Figure 8. SPC5-Studio: application drivers selection tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Figure 9. SPC5-Studio: open PinMap editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Figure 10. SPC5-Studio: pin map wizard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Figure 11. SPC5-Studio: graphical pin configuration menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Figure 12. SPC5-Studio: graphical pin functionality selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Figure 13. SPC5-Studio: open pin map editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Figure 14. SPC5-Studio: driver pin selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Figure 15. SPC5-Studio: driver pin list. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Figure 16. SPC5-Studio: driver pin ports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Figure 17. SPC5-Studio: pin direction menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Figure 18. SPC5-Studio: pin configuration selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Figure 19. SPC5-Studio: driver pin ports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Figure 20. CAN frame standard vs extended data frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Figure 21. Bit stuffing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Figure 22. SPC5-Studio: project driver selection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Figure 23. SPC5-Studio: controller driver enable tab. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Figure 24. SPC5-Studio: low-level driver configuration tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Figure 25. SPC5-Studio: configurations list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Figure 26. SPC5-Studio: rename configuration tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Figure 27. SPC5-Studio: CAN driver Loopback mode selection menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Figure 28. External Loopback on SPC584Cx/SPC58ECx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Figure 29. Internal Loopback on SPC584Cx/SPC58ECx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Figure 30. How to perform a real CAN transmission . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Figure 31. Bit timing configuration fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Figure 32. SPC5-Studio: bit timing configuration tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Figure 33. CAN protocol source clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Figure 34. SPC5-Studio: CAN-FD bit timing configuration tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Figure 35. SPC5-Studio: CAN RX buffers and filters configuration tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Figure 36. SPC5-Studio: adding CAN filters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Figure 37. SPC5-Studio: CAN filter example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Figure 38. SPC5-Studio: CAN dedicated RX buffer filter configuration tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Figure 39. SPC5-Studio: CAN FIFO and FIFO filters configuration tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Figure 40. SPC5-Studio: CAN dedicated TX buffer configuration tab. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Figure 41. SPC5-Studio: generation and compilation buttons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Figure 42. SPC5-Studio: variable view during debug. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Figure 43. CAN connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Figure 44. CAN bus sniffer GUI: RX message view. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33