CAN-100 Fujitsu Semiconductor America Inc, CAN-100 Datasheet

BOARD EVAL RS232 100QFP

CAN-100

Manufacturer Part Number
CAN-100
Description
BOARD EVAL RS232 100QFP
Manufacturer
Fujitsu Semiconductor America Inc
Series
FRr
Type
MCUr
Datasheets

Specifications of CAN-100

Contents
Board, BLDC Motor, Cables, Power Supply
For Use With/related Products
MB91F267N
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
Other names
865-1102

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
CAN-100
Manufacturer:
Fujitsu Semiconductor America
Quantity:
135
AN07-00180-3E
FR Family FR60 Lite
32-BIT MICROCONTROLLER
MB91F267N
bits pot red
CAN-Motor board
User’s Manual

Related parts for CAN-100

CAN-100 Summary of contents

Page 1

... AN07-00180-3E FR Family FR60 Lite 32-BIT MICROCONTROLLER MB91F267N bits pot red CAN-Motor board User’s Manual ...

Page 2

Revision History Date August 01, 2008 Revision 1.0: Initial release September 17, 2008 Revision 1.1 On p.12, type corrected. Correct: NL565050T-103J, Incorrect: L565050T-103J October 22, 2008 Revision 1.2 On p.13, a download web page is changed. On p.20, "1.1.1 Downloading ...

Page 3

Note - The contents of this document are subject to change without notice. Customers are advised to consult with FUJITSU sales representatives before ordering. - The information, such as descriptions of function and application circuit examples, in this document are ...

Page 4

... Notes on Monitor Debugger...................................................................................... 59 3 Operation of the sample program .......................................................................................... 60 3.1 bits pot red single-unit operation ............................................................................... 61 3.2 CAN communication operation (CAN communication operation with the bits pot white) 4 Try to rotate the BLDC motor .............................................................................................. 65 4.1 What is the BLDC motor? ......................................................................................... 65 4.2 How does the BLDC motor rotate? ........................................................................... 66 4 ...

Page 5

... CAN specifications ................................................................................................... 84 5.2.1 CAN frame configurations ................................................................................. 84 Arbitration ............................................................................................................. 88 5.2.2 Error management ................................................................................................... 90 5.2.3 5.3 CAN communication by using the microcontroller ..................................................... 92 5.4 Understanding and running the program for CAN communication ............................. 95 CAN communication configuration ........................................................................... 95 5.4.1 Sample program sequence ........................................................................................ 99 5.4.2 Appendix ........................................................................................................................ 104 6 6.1 Sample program folder/file configuration ................................................................. 104 - 5 - ...

Page 6

List of Figures Figure 1-1 External board view ......................................................................................... 14 Figure 1-2 System connection diagram ............................................................................ 16 Figure 1-3 Downloading the USB driver ................................................................................ 20 Figure 1-4 Installing FT232R USB UART ............................................................................. 21 Figure 1-5 Selecting the search locations................................................................................ 22 ...

Page 7

... Figure 2-35 Running the program ......................................................................................... 58 Figure 2-36 Stopping the program ......................................................................................... 59 Figure 3-1 Single-unit operation/Controls and mechanicals ...................................................... 61 Figure 3-2 CAN communication operation/Controls and mechanicals ........................................ 63 Figure 4-1 DC motor/BLDC motor configuration examples ...................................................... 65 Figure 4-2 Names of the respective elements .......................................................................... 66 Figure 4-3 120° conduction method time chart .................................................................. 67 Figure 4-4 Motor driver circuit ...

Page 8

... Figure 4-14 Motor controls flowchart................................................................................. 78 Figure 4-15 Rotation speed control........................................................................................ 79 Figure 4-16 Brake control .................................................................................................... 80 Figure 4-17 Rotation direction control ................................................................................... 81 Figure 5-1 Example of on-board CAN application ................................................................... 82 Figure 5-2 CAN bus signal levels.......................................................................................... 83 Figure 5-3 CAN frame configurations ................................................................................... 85 Figure 5-4 Operation of the arbitration ................................................................................... 88 Figure 5-5 Example of arbitration among nodes ...

Page 9

... Table 4-5 Correspondence between the output compare values and the switchings .......... 73 Table 5-1 Description of the error types ................................................................................. 90 Table 5-2 Description of the entire CAN communication control registers and setting values......... 94 Table 5-3 CAN communication conditions of the sample program ............................................. 95 Table 5-4 CAN message IDs in the sample program ................................................................ 96 Table 6-1 Sample program folder/file configuration ...

Page 10

... The kit is designed so that the beginners who ask “What is a microcontroller?”, “How does it work?” and “How does it control a network?” can easily learn what it is. The kit includes flash microcontroller development tools you have slight understanding about the C language, you can rewrite a program to let the microcontroller perform in various ways ...

Page 11

Contact For inquiries about this starter kit, contact the following address. Zip code: 105-8420 2-5-3 Nishi-Shinbashi, Minatoku, Tokyo E-mail: pd-bitspot@tsuzuki-densan.co.jp bits pot URL: http://www.tsuzuki-densan.co.jp/bitspot AN07-00180-3E ...

Page 12

Suppliers of the parts/materials Capacitors 22 pF 0.1 μF 1 μF 10 μF Ceramic oscillator NTC Thermistors Ferrite Beads Common Mode Filters Inductors : GCM1552C1H220JZ02 : GCM188R11E104KA42 : GCM21BR11E105KA42 : GCM32ER71E106KA42 : CSTCR4M00G15C : NTCG164BH103JT1 : MPZ2012S300AT : ZJYS81R5-2P24T-G01 : ...

Page 13

... Before using this starter kit, be sure to check the components listed in Table 1-1 are fully supplied. Before connecting the bits pot red CAN-Motor board (referred to as the board hereafter), you need to install software in your PC. You can download the software required for the starter kit from the following web site. ...

Page 14

... CAN connector (3) CAN transceiver (18) Extension power (5V) (19) Extension GND (16) Extension pins (1) Target device (2) Target device oscillator (10) Mode SW (5) USB to UART converter (6) USB connector (17) Jumper pin (12) Test SW (13) LED lamps (11) Reset SW Figure 1-1 External board view - 14 - AN07-00180-3E (9) DC jack (15) Fuse (7) Motor driver circuit ...

Page 15

... Oscillator for the main microcontroller. MAX3058ASA+ Transceiver IC for CAN communication. Connector for CAN communication. 3-pin connector Connect this connector to the CAN connector on the bits pot white. FT232RL IC for conversion between UART and USB. USB connector for connection with the PC to miniB write/debug a program ...

Page 16

Extension power (5V) - (19) Extension GND - “Figure 1-2 System connection diagram” shows the connection of the system. * Prepare the PC by yourself. Use the USB cable included in the kit for the connection. (The power is ...

Page 17

MB91F267N pin assignment” shows the pin assignment of the main microcontroller MB91F267N. Table 1-3 MB91F267N pin assignment Pin No. Description 1 AVss 2 ACC 3 AN0/P50 4 AN1/P51 5 AN2/P52 6 AN3/P53 7 AN4/P54 8 AN5/P55 9 AN6/P56 ...

Page 18

... RTO4/P34 54 RTO3/P33 55 RTO2/P32 56 RTO1/P31 57 RTO0/P30 58 INT0/P40 59 INT1/P41 60 INT2/P42 61 INT3/P43 62 AVRH1 63 AVRH2 64 AVcc CAN TRANSCEIVER CAN TRANSCEIVER Motor driver circuit Hall W-phase - - - - Motor driver circuit Hall U-phase Motor driver circuit Hall V-phase SW5 - SW4 GND GND Q1 4-MHz oscillator Q1 4-MHz oscillator GND - - RESET(SW1) ...

Page 19

Setting up the PC 1.1 Install the software required to operate this starter kit into the PC. To set up the PC, take the following procedures. (1) Downloading the software (2) Installing a USB driver (3) Installing the integrated development ...

Page 20

Downloading the software Download the file from the following web site, and extract the file. bits pot URL: http://www.tsuzuki-densan.co.jp/bitspot/ 1.1.2 Installing a USB driver Install a USB driver. From the FTDI web page shown below, download the Windows driver ...

Page 21

After downloading the driver, decompress it, and then connect the board to the PC by using the USB cable included in the kit. As shown in “Figure 1-4 Installing FT232R USB UART”, the dialog for “FT232R USB UART” installation is ...

Page 22

As shown in “Figure 1-5 Selecting the search locations”, to search for the installation file, check “Search for the best driver in these locations” and “Include this location in the search” only, select the location at which the driver was ...

Page 23

After that, as shown in “Figure 1-7 Installing USB Serial Port”, installation of “USB Serial Port” is indicated; select “Install from a list or specific location” and then click the “Next” button. Figure 1-7 Installing USB Serial Port As shown ...

Page 24

When the driver installation ends, the dialog shown in “Figure 1-9 Completing the USB Serial Port installation” is displayed; Click the “Finish” button. Figure 1-9 Completing the USB Serial Port installation - 24 - AN07-00180-3E ...

Page 25

Installing the integrated development environment SOFTUNE (bits pot dedicated version) Note If SOFTUNE V6 of the product version has been installed, first uninstall it, and then install the bits pot dedicated version. Start installing the integrated development environment SOFTUNE. ...

Page 26

The dialog shown in “Figure 1-12 Caution on SOFTUNE setup” is displayed; click the “Next” button. Figure 1-12 Caution on SOFTUNE setup The dialog shown in “Figure 1-13 SOFTUNE setup/License agreement” appears; read through the agreements and then click “Yes” ...

Page 27

The version information is displayed as shown in “Figure 1-14 SOFTUNE setup/Version ”; click the “Next” button. Figure 1-14 SOFTUNE setup/Version information The dialog about the destination of installation shown in “Figure 1-15 SOFTUNE setup/Selecting the destination of installation” appears; ...

Page 28

The dialog for component selection is displayed as shown in “Figure 1-16 SOFTUNE setup/Selecting the components”; keep the default settings and then click the “Next” button. Figure 1-16 SOFTUNE setup/Selecting the components As shown in “Figure 1-17 SOFTUNE setup/Confirming the ...

Page 29

The dialog shown in “Figure 1-18 SOFTUNE setup/Completion” appears to tell the completion of installation; click the “Finish” button. Figure 1-18 SOFTUNE setup/Completion - 29 - AN07-00180-3E ...

Page 30

Installing PC Writer (bits pot red dedicated version) Start installing PC Writer. Confirm the following file from the inside of the folder extracted by “1.1.1 Downloading the software”. ¥softwares¥pc writer¥MB91F267NA_setup.exe Double-click “MB91F267NA_setup.exe”; the dialog shown in “Figure 1-19 PC ...

Page 31

The dialog shown in “Figure 1-20 PC Writer/Setup type” appears; select “All”, and then click the “Next” button. Figure 1-20 PC Writer/Setup type The dialog shown in “Figure 1-21 PC Writer/Ready to install” appears to tell that the setup is ...

Page 32

After the installation ends, the dialog shown in “Figure 1-22 Completing the PC Writer ” appears to tell the completion of installation; click “Finish”. Figure 1-22 Completing the PC Writer installation - 32 - AN07-00180-3E ...

Page 33

Configuring the evaluation board and connecting it to the PC After SOFTUNE installation, configure a switch on the board and then connect it to the PC. Set the “MODE” selector on the board to “PRG”. MODE selector Operation PRG ...

Page 34

Connect the USB cable included in the kit to a USB port on the PC and the USB port on the board. Be sure to directly connect between them without using a USB hub. Connect a USB port on the ...

Page 35

Running the program To run a program with the starter kit, take either of the following procedures. (1) Executing in single chip mode (2) Debugging by using Monitor Debugger AN07-00180-3E ...

Page 36

Executing in single chip mode 2.1 In single chip mode, take the following procedures. (1) Building a project (2) Writing the program into the microcontroller 2.1.1 Building a project Preparation Extract the following file from the inside of the folder ...

Page 37

As shown in “Figure 2-2 Selecting a workspace”, the dialog that allows you to select a workspace is displayed. Select the folder “bitpot_red_SampleProgram.wsp”, and then click “Open”. ¥bitpot_red_SampleProgram¥bitpot_red_SampleProgram.wsp The workspace opens; from the “project” menu, click “Build” to build it. ...

Page 38

The message pane at the bottom of the window shows a message that tells no error was found as shown in “Figure 2-4 Completing the build” to inform you of successful build. 2.1.2 Writing the program into the microcontroller Preparation ...

Page 39

The dialog that allows you to select the file is displayed as shown in “Figure 2-6 Selecting the file to write”; select the file built in “2.1.1 Building a project” and then click “Open”. ¥bitpot_red_SampleProgram¥Debug¥ABS¥bitpot_red_SampleProgram.mhx Figure 2-6 Selecting the file ...

Page 40

Then, select the COM port to be used for the writing. Click the “Set Environment” button; the COM port selection dialog appears. Select the COM port with which the board is connected, and then click the “OK” button. Figure 2-7 ...

Page 41

To check the COM port in use, right-click “My Computer” and then select “Properties”; the system properties are displayed. Select the “Hardware” tab and then click the “Device Manager” button. After Device Manager activates, check the COM port number in ...

Page 42

As shown in “Figure 2-9 Writing the program”, press the “Full Operation” button to start writing the program; the dialog that asks you to press the Reset switch is displayed. Press the Reset SW on the board, and then click ...

Page 43

Debugging by using Monitor Debugger 2.2 To debug by using Monitor Debugger, take the following procedures. (1) Writing Monitor Debugger into the microcontroller (2) Activating SOFTUNE and configuring the debug settings (3) Writing the program into the microcontroller (4) Loading ...

Page 44

As shown in “Figure 2-12 Selecting the file to write”, the dialog that allows you to select the file to write appears; select the file as shown below, and then click “Open”. ¥FR60¥Debug¥ABS¥FR60.mhx Figure 2-12 Selecting the file to write ...

Page 45

Then, select the COM port to be used for the writing. Click the “Set Environment” button; the COM port selection dialog appears. Select the COM port with which the board is connected, and then click the “OK” button. Figure 2-13 ...

Page 46

To check the COM port in use, right-click “My Computer” and then select “Properties”; the system properties are displayed. Select the “Hardware” tab and then click the “Device Manager” button. After Device Manager activates, check the COM port number in ...

Page 47

As shown in “Figure 2-15 Writing the program”, press the “Full Operation” button to start writing the program; the dialog that asks you to press the Reset switch is displayed. Press the Reset SW on the board, and then click ...

Page 48

Activating SOFTUNE and configuring the debug settings Preparation Set MODE on the board to “RUN” in advance, and then press the Reset button. Select “Start” → “All Programs” → “Softune V6” → “FR Family Softune Workbench” to activate SOFTUNE. ...

Page 49

As shown in “Figure 2-18 Selecting a workspace”, the dialog that allows you to select a workspace is displayed. Select the folder “bitpot_red_SampleProgram_md.wsp”, and then click “Open”. ¥bitpot_red_SampleProgram_md¥bitpot_red_SampleProgram_md.wsp Figure 2-18 Selecting a workspace The workspace opens; from the “project” menu, ...

Page 50

The message pane at the bottom of the window shows a message as shown in “Figure 2-20 Completing the build”. A warning is displayed but the build has been successfully ended. (The warning indicates no problem.) Then, configure the debug ...

Page 51

As shown in “Figure 2-22 Starting the debug setting ”, the debug setup wizard is displayed; click the “Next” button. Figure 2-22 Starting the debug setting wizard Select the debugger type as shown in “Figure 2-23 Selecting the debugger type”; ...

Page 52

Select the device type as shown in “Figure 2-24 Selecting the device type”. Set “RS” to the device name, set the COM port number to which the board is connected to the port name, set “38400” to the baud rate, ...

Page 53

Just ignore the target file settings as shown in “Figure 2-26 Configuring the target file settings”; click the “Next” button. Figure 2-26 Configuring the target file settings As shown in “Figure 2-27 Setting setup file selection”, select “Specify” for setup ...

Page 54

On the dialog shown in “Figure 2-28 Completing the setup wizard”, click the “Finish” button to finish configuring the settings. Figure 2-28 Completing the setup wizard Start debugging as shown in “Figure 2-29 Start debugging”. Figure 2-29 Start debugging - ...

Page 55

Writing the program into the microcontroller As shown in “Figure 2-30 Showing the commands window”, from the “View” menu, select “Commands” to show the program window. Figure 2-30 Showing the commands window - 55 - AN07-00180-3E ...

Page 56

Input the following command into the field as shown in “Figure 2-31 Inputting commands”, and then click the “Enter” button. The program is started to be written. bat FshLdWrt.prc As shown in “Figure 2-32 Completing the program writing”, the command ...

Page 57

... Loading the target file As shown in “Figure 2-33 Loading the target file”, from the “Debug” menu, select “Load Target File”. The target file is loaded; you can set break points at desired points. Figure 2-33 Loading the target file - 57 - AN07-00180-3E ...

Page 58

... Running the debugger As shown in “Figure 2-34 Setting break points”, you can set break points to lines with a green round mark on the left side in the source file. Note that you cannot set break points while the program is running. As shown in “Figure 2-35 Running the program”, click the “Run Continuously” icon to run the program. ...

Page 59

... Notes on Monitor Debugger Note that Monitor Debugger has the following restrictions. ・ Only break points can be set. No more break point can be set set other break points, cancel some of those already set and set new break point. ・ While Monitor Debugger is running (after Monitor Debugger is activated in 2.2.2 Activating SOFTUNE and configuring the debug settings prohibited to press the Reset SW on the board ...

Page 60

... Operation of the sample program This section describes the operation of the sample program. The operation of the sample is classified into the following two categories. (1) bits pot red single-unit operation (2) CAN communication operation (CAN communication operation with the bits pot white AN07-00180-3E ...

Page 61

Single-unit operation/Controls and mechanicals” shows the controls and mechanicals, and “Table 3-1 Single-unit operation/Descriptions of the controls and mechanicals” provides descriptions about them. SW2, SW3, SW5, and temperature sensor on the board ...

Page 62

Table 3-1 Single-unit operation/Descriptions of the controls and mechanicals No. Name Function (1) Mode SW Control (2) Reset SW Control (3) SW2 Control (4) SW3 Control (5) SW5 Control (6) Temperature sensor Control (7) LEDs (green) Mechanical (8) LEDs (red) ...

Page 63

... CAN communication operation/Descriptions of the controls and mechanicals” provides descriptions about them. The bits pot white performs CAN communication, and on execution of a motor operation command, the green and red LEDs and BLDC motor work. On execution of a temperature measurement command, the temperature is returned from the temperature sensor. ④ ...

Page 64

... Table 3-2 CAN communication operation/Descriptions of the controls and mechanicals No. Name Function (1) Mode SW Control (2) Reset SW Control (3) Temperature sensor Control (4) CAN transmit LED Mechanical (5) CAN receive LED Mechanical (6) LEDs (green) Mechanical (7) LEDs (red) Mechanical (8) BLDC motor Mechanical Description Switches between RPG mode and RUN mode. ...

Page 65

... For detection of the rotor position, hall elements are used. (a) DC motor configuration example Figure 4-1 DC motor/BLDC motor configuration examples This board has a driver circuit, so you can starts rotating the BLDC motor immediately. Driver circuit Microcontroller (b) BLDC motor configuration example ...

Page 66

How does the BLDC motor rotate? 4.2 The BLDC motor has three phases different by 120°. As shown in “Figure 4-2 Names of the respective elements”, the phases are called the U-phase, V-phase, and W-phase respectively. The switches on the ...

Page 67

Hall-U Hall-V Hall-W U-High U-Low V-High V-Low W-High W-Low Figure 4-3 120° conduction method time chart 240° 360° AN07-00180-3E 480° ...

Page 68

... How does the BLDC motor rotate?” shown in “Table 4-1 Microcontroller pin/Motor driver circuit connections”. By turning RTO0 to 5 on/off according to the positions of the hall elements as shown in “Figure 4-3 120° conduction method time chart”, the motor can be rotated. Anode ...

Page 69

Table 4-1 Microcontroller pin/Motor driver circuit connections Microcontroller pin number Pin57 Pin56 Pin55 Pin54 Pin53 Pin52 RTO0 to 5 ON/OFF control is practically taken by the macro in the microprocessor mounted on the board. So necessary to configure ...

Page 70

Table 4-3 Description of the timer control registers and setting values Register name Setting value [function] TCCSH0_ECKE 0 [internal clock] TCCSH0_IRQZF 0 [bit clear] TCCSH0_IRQZE 0 [interrupt request disable] TCCSH0_MSI2 - TCCSH0_MSI1 - TCCSH0_MSI0 - TCCSH0_ICLR 0 [bit clear] TCCSH0_ICRE ...

Page 71

The registers used for the 16-bit output compare function are as shown in “Figure 4-6 Output compare registers”. A description of the registers and their setting values in the sample program are as described in “Table 4-4 Description of the ...

Page 72

Table 4-4 Description of the output compare registers and setting values Register name Setting value [function] CPCLRB0 1599 OCCPB0 1598 OCCPB1 1000 OCCPB2 1598 OCCPB3 1000 OCCPB4 1598 OCCPB5 1000 OCMOD 0xFF [1 output on a match] OCSH1,3,5_BTS1 1 [transfer ...

Page 73

Initialize the 16-bit free-run timer and 16-bit output compare functions as shown in “Table 4-3 Description of the timer control registers and setting values”, “Table 4-4 Description of the output compare registers and setting values”. After the initialization, running the ...

Page 74

CPCLRB0 value OCCPB0 value 0 U-High Figure 4-8 U-High output to output comparisons - 74 - AN07-00180-3E Time→ ...

Page 75

... Understanding and running the program for the BLDC motor operation 4.4 This section provides descriptions of the sample program that can really serve to operate the BLDC motor. “Figure 4-9 Motor operation flowchart” shows the sequence of the sample program flow. First, the microcontroller is initialized, and then the motor macro is initialized ...

Page 76

... Look at around Line 40 that looks “Figure 4-10 Operation mode settings” for operation mode selection. There are #define settings that enable (1) or disable (0) CAN and temperature sensor. In this program, CAN is not to be used and the temperature sensor used. /* CAN communication use (1), or unused (0) */ ...

Page 77

When SW2 is pressed, an interrupt takes place. Around Line 763 in MAIN.C, the interrupt function IRQ_ext_0 is invoked as shown in “Figure 4-12 SW2 interrupt”. In it, the register value of TCCSL0_STOP, which is used to start/top the free-run ...

Page 78

Handling controls of the BLDC motor 4.5 You were able to rotate the BLDC motor by using the microcontroller macro. Then, try to control the rotation speed, brake, and rotation direction now. In the sample program, the controls are handled ...

Page 79

... Set motor turn speed */ if (gTempEnableFlag get an A/D channel */ ad = adGetValue(); > TEMP_AD_VALUE_00 ? TEMP_AD_VALUE_00 : ad < TEMP_AD_VALUE_09 ? TEMP_AD_VALUE_09 : ad; /* calc motor turn speed */ gMtSpeedMax = TEMP_AD_VALUE_00 - TEMP_AD_VALUE_09 ...

Page 80

... Brake control”. While SW3 is pressed, the outputs to all the semiconductor elements are set to off and the brake is applied to the motor. void main(void) { (omitted) /* main loop */ while ( (!gCanEnableFlag) { (omitted) /* Set motor break */ if(gMtStatus == MTST_MOVE Set the Motor Start Flag */ if (PDR4_P41) { OCSH1_OTE0 = 1 ...

Page 81

... When SW5 is set to the right side, the motor rotates to the right, and when it is set to the left side, the motor rotates to the left. void main(void) { (omitted) /* main loop */ while ( (!gCanEnableFlag) { (omitted) /* Motor Rev Direction */ gMtRevDir = PDR2_P27; /* Set Value */ gDirection = gMtRevDir; (omitted) ...

Page 82

... CAN is a global standard of the ISO (International Organization for Standardization). What is CAN? 5.1 CAN stands for Controller Area Network, which is an on-board LAN specification proposed by Bosch in Germany the most popular on-board control LAN and used in various parts of a vehicle as shown in “Figure 5-1 Example of on-board CAN application”. ...

Page 83

... The differential is used to determine logical “0”/”1”. As shown in “Figure 5-2 CAN bus signal levels”, the bus status of logical “0” is called dominant and the bus status of logical “1” is called recessive. The communicable distance depends on the communication speed ...

Page 84

... CAN frame configurations This section describes frames that are the fundamental communication unit of CAN. CAN provides four types of frames, which are respectively named the data frame, remote frame, error frame, and overload frame as shown in “Figure 5-3 CAN frame configurations” ...

Page 85

... Arbitration field Data frame Arbitration field Remote frame Error flag field Error frame Overload Overload flag delimiter field Overload frame Figure 5-3 CAN frame configurations Control Data field CRC field field Control ACK CRC field field field Error delimiter field field ...

Page 86

... ACK field End of frame (EOF) 2. Remote frame Usually, in CAN, a form of transmit of communication information to a node is generally used, but it is also allowed to request a specific node to transmit specific data. For this purpose, the remote frame is available. The remote frame has almost the same configuration with the data frame; it consists of six fields except the data field ...

Page 87

Overload frame Transfer format sent to indicate that the node is in unreceivable status Field name Overload flag Overload delimiter Description 6-bit to 12-bit field that indicates the type of overload. 8-bit field containing “1” that indicates the end ...

Page 88

... Each node is cyclically checking whether the bus is the status of transmission. When there is no transmission on the bus, communication is started, but if more than one node starts transmission, they conflict. Against this, CAN performs arbitration to give priority to one with a lower ID for transmission. This section describes the arbitration. The arbitration is carried out by comparison between the ID and the bus level by bit as shown in “ ...

Page 89

... Node 3 ends its transmission. On this occasion, arbitration between Node 1 retransmission and Node 4 transmission is performed. This results in transmission in order of Node 4 to Node 1. That is, setting a lower ID to those of preference allows priorities to be settled for communication. The ID is assigned by the command, information, and type of transmit data. The ID settings can be configured as desired. Start of ...

Page 90

... Error management CAN error management is defined in its protocol. Five types of error detection and three types of status are used. 1. Error detection As shown in “Table 5-1 Description of the error types”, errors that can be detected depends on whether the node is transmitting or receiving. Table 5-1 Description of the error types ...

Page 91

... If the TEC counter increases after the node comes to error passive and the count comes to 255 or higher, the status of the node changes to bus off. If the status of the node becomes bus off, the node cannot be restored to error active unless the restoration condition that successive 11-bit recessive is received 128 times is satisfied. ...

Page 92

... This section describes how to perform practical CAN communication with the microcontroller. On the board, as shown in “Figure 5-7 CAN circuit”, the microcontroller is connected with the CAN transceiver (MAX3058). TX0 on the microcontroller is used for transmission and RX0 is used for reception. Signals transmitted/received are transferred to CAN-High and CAN-Low as the differential signals on the bus through the CAN transceiver ...

Page 93

... The registers used for entire CAN communication control on the microcontroller are as shown in “Figure 5-8 Entire CAN communication control register”. The register bits whose name is “res” are reserved and not used. A description of the registers and their setting values in the sample program are as described in “Table 5-2 Description of the entire CAN communication control registers and setting values” ...

Page 94

... BRPER0_BRPE 0 [value added to BTR0] The registers used for CAN communication message handling on the microcontroller are APIs of the CAN driver in the sample software, so descriptions of the following registers are omitted. For more information of the registers, refer to the microcontroller hardware manual. ■Message interface registers ...

Page 95

... Understanding and running the program for CAN communication 5.4 This section provides descriptions of the sample program that can serve for practical CAN communication. 5.4.1 CAN communication configuration “Table 5-3 CAN communication conditions of the sample program” shows the CAN communication conditions of the sample program. ...

Page 96

... CAN message IDs in the sample program” provides a description of the message IDs used for CAN communication. Table 5-4 CAN message IDs in the sample program ID Description 0x101 Motor operation start/stop command 0x102 Motor operation rotation speed/Rotation direction/Brake command 0x103 Temperature sensor measurement command ...

Page 97

Field name Motor rotation 0: Clockwise 1: direction Counterclockwise Brake application 0: Brake released 1: Brake applied Motor rotation speed 0 to 65535 A/D maximum value 0 to 65535 3. ID: 0x103 Temperature measurement command byte 0 byte 1 Reserved ...

Page 98

Temperature information byte 0 byte 1 Reserved byte 2 Reserved byte 3 Reserved Reserved byte 4 Reserved byte 5 byte 6 Reserved Reserved byte 7 Field name Setting value Temperature information Remarks - - 98 - AN07-00180-3E ...

Page 99

... First, the microcontroller is initialized. On the microcontroller initialization, the CAN operation timer starts operating. After that, the CAN driver is initialized. Then, the motor driving macro is initialized and then the program goes into a loop. Subsequently, motor rotation information transmit, temperature sensor information transmit, receive processing are handled in the timer routine ...

Page 100

... Look at around Line 40 that looks “Figure 5-10 Operation mode settings” for operation mode selection. There are #define settings that enable (1) or disable (0) CAN and temperature sensor. In this program, both CAN and temperature sensor are to be used. /* CAN communication use (1), or unused (0) */ ...

Page 101

... As shown in “Figure 5-12 CAN timer interrupt control”, around Line 817 in MAIN.C, there is the timer interrupt function IRQ_reload1. In it, motor rotation information transmit, temperature sensor information transmit, and receive processing are handled. __interrupt void IRQ_reload1(void) { (omitted) for ( < 3; i++) { (omitted) /* Cycle check */ if (counter[i] > ...

Page 102

... First, concerning motor rotation information transmit, as shown in “Figure 5-13 Motor rotation information transmit”, there is the canSendTask01 function around Line 577 in MAIN.C. Only when the motor is rotating, a message sent with CAN is created and the transmit function canSendData, which is a CAN driver API, is invoked. ...

Page 103

... Concerning receive processing, as shown in “Figure 5-15 CAN receive processing”, there is the canRecvTask function around Line 625 in MAIN.C. First, the receive function canRecvData, which is a CAN driver API, is invoked by received ID, and then only those with receiveData are processed. void canRecvTask(void) { (omitted) /* CAN Receive Data */ ret = canRecvData(1, & ...

Page 104

... Sample program hex file ○ ○ Sample program hex file ○ ○ CAN driver source file ○ ○ CAN driver header file ○ ○ Main source file ○ ○ Microcontroller header file ○ ○ Motor driver source file ○ ...

Related keywords