Download  Print this page

Fujitsu FR Family FR60 Lite User Manual

32-bit microcontroller bits pot red can motor board.
Hide thumbs

Advertisement

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

Advertisement

   Also See for Fujitsu FR Family FR60 Lite

   Related Manuals for Fujitsu FR Family FR60 Lite

   Summary of Contents for Fujitsu FR Family FR60 Lite

  • 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

    AN07-00180-3E Revision History Date Revision 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 the software" is added. On p.25, p.30, p.36 and p.43, Description is corrected about the extracting file.

  • Page 3: Note

    (2) for use requiring extremely high reliability (i.e., submersible repeater and artificial satellite). Please note that Fujitsu will not be liable against you and/or any third party for any claims or damages arising in connection with above-mentioned uses of the products.

  • Page 4: Table Of Contents

    AN07-00180-3E Table of Contents Revision History ......................... 2 Note ............................3 Introduction ..........................10 Contact ............................ 11 Suppliers of the parts/materials ....................12 Setting up the starter kit ...................... 13 Setting up the PC ..................... 19 1.1.1 Downloading the software ..................20 1.1.2 Installing a USB driver ....................

  • Page 5

    AN07-00180-3E CAN specifications ....................84 5.2.1 CAN frame configurations ................. 84 Arbitration ......................88 5.2.2 Error management ....................90 5.2.3 CAN communication by using the microcontroller ............. 92 Understanding and running the program for CAN communication ......95 CAN communication configuration ................95 5.4.1 Sample program sequence ..................

  • Page 6

    AN07-00180-3E 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 Figure 1-6 Completing the USB Serial Converter installation............

  • Page 7

    AN07-00180-3E Figure 2-11 Opening the file to write ..................43 Figure 2-12 Selecting the file to write ..................44 Figure 2-13 Select the COM port to be used for the writing ............45 Figure 2-14 Checking the COM port ..................46 Figure 2-15 Writing the program ...................

  • Page 8

    AN07-00180-3E Figure 4-9 Motor operation flowchart ..................75 Figure 4-10 Operation mode settings ..................76 Figure 4-11 Main function ....................76 Figure 4-12 SW2 interrupt ....................77 Figure 4-13 Free-run timer interrupt ..................77 Figure 4-14 Motor controls flowchart................. 78 Figure 4-15 Rotation speed control..................

  • Page 9

    AN07-00180-3E List of Tables Table 1-1 Component list....................13 Table 1-2 Description of the respective board parts ..............15 Table 1-3 MB91F267N pin assignment .................. 17 Table 3-1 Single-unit operation/Descriptions of the controls and mechanicals ......62 Table 3-2 CAN communication operation/Descriptions of the controls and mechanicals ....64 Table 4-1 Microcontroller pin/Motor driver circuit connections ..........

  • Page 10: Introduction

    AN07-00180-3E Introduction Thank you very much for purchasing the bits pot red (referred to as this starter kit or the starter kit hereafter). This starter kit is a beginner’s kit intended for those who wish to start learning microcontrollers and on-board network processors.

  • Page 11: Contact

    AN07-00180-3E 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/ - 11 -...

  • Page 12: Suppliers Of The Parts/materials

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

  • Page 13: Setting Up The Starter Kit

    URL: http://www.tsuzuki-densan.co.jp/bitspot/ Table 1-1 Component list Article Qty. Specifications Remarks bits pot red Microcontroller made by Fujitsu See Figure 1-1 CAN motor board FR Family FR60 Lite, MB91F267N mounted USB cable USB (A to miniB) Accessory BLDC Motor...

  • Page 14: Figure 1-1 External Board View

    AN07-00180-3E (5) USB to UART converter (4) CAN connector (6) USB connector (3) CAN transceiver (9) DC jack (17) Jumper pin (15) Fuse (7) Motor driver circuit (18) Extension power (5V) (19) Extension GND (16) Extension pins (1) Target device (2) Target device oscillator (8) Motor connector (10) Mode SW...

  • Page 15: Table 1-2 Description Of The Respective Board Parts

    AN07-00180-3E “Table 1-2 Description of the respective board parts” provides descriptions of the respective board parts. Table 1-2 Description of the respective board parts Name Function Description Target device MB91F267N Main microcontroller (MB91F267N). Ceralock made by Murata Manufacturing Target device oscillator CSTCR4M00G15C Oscillator for the main microcontroller.

  • Page 16: Figure 1-2 System Connection Diagram

    AN07-00180-3E (18) Extension power (5V) Extension 5-V power terminal. (19) Extension GND Extension GND terminal. “Figure 1-2 System connection diagram” shows the connection of the system. * Prepare the PC by yourself. AC adapter (accessory) Use the AC adapter included in the kit for the connection.

  • Page 17: Table 1-3 Mb91f267n Pin Assignment

    AN07-00180-3E “Table 1-3 MB91F267N pin assignment” shows the pin assignment of the main microcontroller MB91F267N. Table 1-3 MB91F267N pin assignment Pin No. Description Connected to: Remarks AVss AN0/P50 Motor driver circuit AN1/P51 Motor driver circuit AN2/P52 Motor driver circuit AN3/P53 L output = On AN4/P54 LED6...

  • Page 18

    AN07-00180-3E INT6/PPG5/RX0/P16 CAN TRANSCEIVER PPG6/TX0/P17 CAN TRANSCEIVER ADTG1/IC2/P20 Motor driver circuit Hall W-phase ADTG2/IC3/P21 PWI0/P22 DTTI/P23 CKI/P24 IC0/P25 Motor driver circuit Hall U-phase IC1/P26 Motor driver circuit Hall V-phase PPG0/PG1 4-MHz oscillator 4-MHz oscillator PPG4/P37 INT7/PPG7/P36 INIT RESET(SW1) RTO5/P35 Motor driver circuit W-phase Low RTO4/P34 Motor driver circuit...

  • Page 19: Setting Up The Pc

    (2) Installing a USB driver (3) Installing the integrated development environment SOFTUNE (function-limited version) (4) Installing PC Writer FUJITSU FLASH MCU Programmer (bits pot red dedicated version) (5) Configuring the evaluation board and connecting it to the PC - 19 -...

  • Page 20: Downloading The Software

    AN07-00180-3E 1.1.1 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 as directed in “Figure 1-3 Downloading the USB driver”.

  • Page 21: Figure 1-4 Installing Ft232r Usb Uart

    AN07-00180-3E 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 displayed; select “Install from a list or specific location”, and then click the “Next”...

  • Page 22: Figure 1-5 Selecting The Search Locations

    AN07-00180-3E 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 decompressed, and then click the “Next” button; installation of the driver starts.

  • Page 23: Figure 1-7 Installing Usb Serial Port

    AN07-00180-3E 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 in “Figure 1-8 Selecting the search locations”, to search for the installation file, check “Search for the best driver in these locations”...

  • Page 24: Figure 1-9 Completing The Usb Serial Port Installation

    AN07-00180-3E 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 -...

  • Page 25: Installing The Integrated Development Environment Softune (bits Pot Dedicated Version)

    AN07-00180-3E 1.1.3 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. Extract the following file from the inside of the folder extracted by “1.1.1 Downloading the software”.

  • Page 26: Figure 1-12 Caution On Softune Setup

    AN07-00180-3E 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” button. Figure 1-13 SOFTUNE setup/License agreement - 26 -...

  • Page 27: Figure 1-14 Softune Setup/version Information

    AN07-00180-3E 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; select the default folder or desired folder and then click the “Next” button.

  • Page 28: Figure 1-16 Softune Setup/selecting The Components

    AN07-00180-3E 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 installation settings”, the dialog for confirmation of the installation settings is displayed.

  • Page 29: Figure 1-18 Softune Setup/completion

    AN07-00180-3E 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 -...

  • Page 30: Installing Pc Writer (bits Pot Red Dedicated Version)

    AN07-00180-3E 1.1.4 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 Writer/Installation dialog”...

  • Page 31: Figure 1-20 Pc Writer/setup Type

    AN07-00180-3E 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 ready to install PC Writer;...

  • Page 32: Figure 1-22 Completing The Pc Writer Installation

    AN07-00180-3E 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 -...

  • Page 33: Configuring The Evaluation Board And Connecting It To The Pc

    AN07-00180-3E 1.1.5 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”. Set the MODE selector to “PRG”.

  • Page 34: Figure 1-24 Connection Between The Pc And The Board

    AN07-00180-3E 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 PC. For information about port locations and so forth, refer to the manual of the PC.

  • Page 35: Running The Program

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

  • Page 36: Executing In Single Chip Mode

    AN07-00180-3E Executing in single chip mode 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 extracted by “1.1.1 Downloading the software”. ¥sample programs¥bitpot_red_SampleProgram.zip Select “Start”...

  • Page 37: Figure 2-2 Selecting A Workspace

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

  • Page 38: Writing The Program Into The Microcontroller

    Preparation Set MODE on the board to “PRG” in advance. Select “Start” → “All Programs” → “FUJITSU FLASH MCU Programmer” → “MB91F267NA” to activate PC Writer. To select a file to be written as shown in “Figure 2-5 Opening the file to write”, click the “Open” button.

  • Page 39: Figure 2-6 Selecting The File To Write

    AN07-00180-3E 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 to write - 39 -...

  • Page 40: Figure 2-7 Select The Com Port To Be Used For The Writing

    AN07-00180-3E 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. Click this. Figure 2-7 Select the COM port to be used for the writing - 40 -...

  • Page 41: Figure 2-8 Checking The Com Port

    AN07-00180-3E 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 the parentheses of “USB Serial Port (COM n)”...

  • Page 42: Figure 2-9 Writing The Program

    AN07-00180-3E 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 the “OK” button on the dialog; the program write sequence starts. For the location of the Reset SW, see “Figure 1-1 External board view”.

  • Page 43: Debugging By Using Monitor Debugger

    Extract the following file from the inside of the folder extracted by “1.1.1 Downloading the software”. ¥sample programs¥bitpot_red_SampleProgram_md_set.zip Select “Start” → “All Programs” → “FUJITSU FLASH MCU Programmer” → “MB91F267NA” to activate PC Writer. As shown in “Figure 2-11 Opening the file to write”, to select a file to be written, click the “Open”...

  • Page 44: Figure 2-12 Selecting The File To Write

    AN07-00180-3E 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 - 44 -...

  • Page 45: Figure 2-13 Select The Com Port To Be Used For The Writing

    AN07-00180-3E 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. Click this. Figure 2-13 Select the COM port to be used for the writing - 45 -...

  • Page 46: Figure 2-14 Checking The Com Port

    AN07-00180-3E 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 the parentheses of “USB Serial Port (COM n)”...

  • Page 47: Figure 2-15 Writing The Program

    AN07-00180-3E 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 the “OK” button on the dialog; the program write sequence starts. For the location of the Reset SW, see “Figure 1-1 External board view”.

  • Page 48: Activating Softune And Configuring The Debug Settings

    AN07-00180-3E 2.2.2 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: Figure 2-18 Selecting A Workspace

    AN07-00180-3E As shown in “Figure 2-18 Selecting a workspace”, the dialog that allows you to select a workspace is displayed. Select folder containing sample program, select workspace “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, click “Build” to build it. Figure 2-19 Building a project - 49 -...

  • Page 50: Figure 2-20 Completing The Build

    AN07-00180-3E 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.) Figure 2-20 Completing the build Then, configure the debug settings.

  • Page 51: Figure 2-22 Starting The Debug Setting Wizard

    AN07-00180-3E 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”; select “Monitor Debugger”, and then click the “Next”...

  • Page 52: Figure 2-24 Selecting The Device Type

    AN07-00180-3E 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, and then click the “Next”...

  • Page 53: Figure 2-26 Configuring The Target File Settings

    AN07-00180-3E 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 file selection, and then click the “Next”...

  • Page 54: Figure 2-28 Completing The Setup Wizard

    AN07-00180-3E 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 - 54 -...

  • Page 55: Writing The Program Into The Microcontroller

    AN07-00180-3E 2.2.3 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 -...

  • Page 56: Figure 2-31 Inputting Commands

    AN07-00180-3E 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 Figure 2-31 Inputting commands As shown in “Figure 2-32 Completing the program writing”, the command window shows “Write Flash Memory Success”...

  • Page 57: Loading The Target File

    AN07-00180-3E 2.2.4 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 -...

  • Page 58: Running The Debugger

    AN07-00180-3E 2.2.5 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. Click this to set a break point.

  • Page 59: Notes On Monitor Debugger

    AN07-00180-3E As shown in “Figure 2-36 Stopping the program”, click the × button for closing the application on the upper right side of the window to stop running the program. Although a warning dialog for the stop is displayed, click the “Abort” button in any case. Figure 2-36 Stopping the program 2.2.6 Notes on Monitor Debugger...

  • Page 60: Operation Of The Sample Program

    AN07-00180-3E 3 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) - 60 -...

  • Page 61: Bits Pot Red Single-unit Operation

    AN07-00180-3E bits pot red single-unit operation “Figure 3-1 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 control the operations of the green and red LEDs and BLDC motor.

  • Page 62

    AN07-00180-3E Table 3-1 Single-unit operation/Descriptions of the controls and mechanicals Name Function Description Switches between RPG mode and RUN mode. Mode SW Control PRG: Write a program RUN: Run the program Reset SW Control Rests the MCU when pressed. Rotates/stops the motor in turn when pressed. The Control motor rotates if it is stopped and stops if it is rotating when this switch is pressed.

  • Page 63: Can Communication Operation (can Communication Operation With The Bits Pot White)

    AN07-00180-3E CAN communication operation (CAN communication operation with the bits pot white) “Figure 3-2 CAN communication operation/Controls and mechanicals” shows the controls and mechanicals, and “Table 3-2 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.

  • Page 64: Table 3-2 Can Communication Operation/descriptions Of The Controls And Mechanicals

    AN07-00180-3E Table 3-2 CAN communication operation/Descriptions of the controls and mechanicals Name Function Description Switches between RPG mode and RUN mode. Mode SW Control PRG: Write a program RUN: Run the program Reset SW Control Rests the MCU when pressed. Returns the temperature measured by this temperature Temperature sensor Control...

  • Page 65: Try To Rotate The Bldc Motor

    AN07-00180-3E 4 Try to rotate the BLDC motor In these days, motors are indispensable in our daily life. Motors are now used in various places, for example, air conditioners, compressors of refrigerators, turn tables of CD and DVD drives, and wipers and door mirrors of vehicles.

  • Page 66: How Does The Bldc Motor Rotate

    AN07-00180-3E How does the BLDC motor rotate? 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 driver circuit are respectively called U-High, U-Low, V-High, V-Low, W-High, and W-Low and connected as outputs from the microcontroller.

  • Page 67: Figure 4-3 120° Conduction Method Time Chart

    AN07-00180-3E 0° 120° 240° 360° 480° 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 - 67 -...

  • Page 68: Bldc Motor Rotation Control By The Microcontroller

    AN07-00180-3E BLDC motor rotation control by the microcontroller This section describes how the BLDC motor is practically controlled with the 120° conduction method by the microcontroller. On the board, as shown in “Figure 4-4 Motor driver circuit”, the microcontroller is connected with the motor driver circuit.

  • Page 69: Figure 4-5 Timer Control Registers

    AN07-00180-3E Table 4-1 Microcontroller pin/Motor driver circuit connections Microcontroller Pin name Name of the semiconductor pin number element connected Pin57 RTO0 U-High Pin56 RTO1 U-Low Pin55 RTO2 V-High Pin54 RTO3 V-Low Pin53 RTO4 W-High Pin52 RTO5 W-Low RTO0 to 5 ON/OFF control is practically taken by the macro in the microprocessor mounted on the board. So, it is necessary to configure registers for functions employed by the macro.

  • Page 70: Table 4-3 Description Of The Timer Control Registers And Setting Values

    AN07-00180-3E Table 4-3 Description of the timer control registers and setting values Register name Setting value [function] Description TCCSH0_ECKE 0 [internal clock] Clock select bit TCCSH0_IRQZF 0 [bit clear] 0 detection interrupt flag bit TCCSH0_IRQZE 0 [interrupt request disable] 0 detection interrupt request enable bit TCCSH0_MSI2 Interrupt mask select bits Not used...

  • Page 71: Figure 4-6 Output Compare Registers

    AN07-00180-3E 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 output compare registers and setting values”. For more information of the registers, refer to the microcontroller hardware manual.

  • Page 72: Table 4-4 Description Of The Output Compare Registers And Setting Values

    AN07-00180-3E Table 4-4 Description of the output compare registers and setting values Register name Setting value [function] Description CPCLRB0 1599 Compare value setting OCCPB0 1598 Output compare value settings OCCPB1 1000 OCCPB2 1598 OCCPB3 1000 OCCPB4 1598 OCCPB5 1000 OCMOD 0xFF [1 output on a match] Designation of the operation on a compare match...

  • Page 73: Figure 4-7 Operation Of The Free-run Timer

    AN07-00180-3E 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 16-bit free-run timer starts a count up using the value configured to CPCLRB0 as the carrier peak as shown in “Figure 4-7 Operation of the free-run timer”.

  • Page 74: Figure 4-8 U-high Output To Output Comparisons

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

  • Page 75: Understanding And Running The Program For The Bldc Motor Operation

    AN07-00180-3E Understanding and running the program for the BLDC motor operation 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: Figure 4-10 Operation Mode Settings

    AN07-00180-3E Now, take a look at the details of the program. Look into the following folder of the sample program. There are some files stored in it. At first, open MAIN.C first. ¥bitpot_red_SampleProgram¥Debug¥SRC 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.

  • Page 77: Figure 4-12 Sw2 Interrupt

    AN07-00180-3E 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 timer, is changed. __interrupt void IRQ_ext_0(void) (omitted) if(gMtStatus == MTST_STOP){...

  • Page 78: Handling Controls Of The Bldc Motor

    AN07-00180-3E Handling controls of the BLDC motor 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 in the infinite loop inside the main function shown in “Figure 4-11 Main function”.

  • Page 79: Figure 4-15 Rotation Speed Control

    AN07-00180-3E The rotation speed routine is written around Line 166 in the MAIN.C main function as shown in “Figure 4-15 Rotation speed control”. When the temperature sensor is used, the rotation speed is determined in the range of 0 to 100% by a conversion according to the A/D value obtained from the temperature sensor and the upper limit.

  • Page 80: Figure 4-16 Brake Control

    AN07-00180-3E The brake control routine is written around Line 192 in the MAIN.C main function as shown in “Figure 4-16 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.

  • Page 81: Figure 4-17 Rotation Direction Control

    AN07-00180-3E The rotation direction routine is written around Line 221 in the MAIN.C main function as shown in “Figure 4-17 Rotation direction control”. 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.

  • Page 82: Try To Use Can Communication

    AN07-00180-3E 5 Try to use CAN communication Communication is to send/receive information. There are various types of communication such as utterance/hearing of spoken words, writing/reading of written letters, and electrical transmission of information. Among them, there are various standards for communication based on electrical transmission. This chapter describes a communication standard called CAN.

  • Page 83: Figure 5-2 Can Bus Signal Levels

    AN07-00180-3E The features of CAN can be classified into the following five points. 1. Multi-master communication CAN employs the multi-master system in which each node is allowed to start communication as desired. The timing of a start of communication is occurrence of an event. The word “event” mentioned here indicates an occasion at which a node needs to start communication.

  • Page 84: Can Specifications

    AN07-00180-3E 4. High-speed version and low-speed version There are two CAN specifications with different communication speeds. One of them is High-speed-CAN. High-speed-CAN is standardized as ISO11898 and its maximum and minimum communication speeds are 1 Mbits/sec and 125 kbits/sec. The other is Low-speed-CAN.

  • Page 85: Figure 5-3 Can Frame Configurations

    AN07-00180-3E Arbitration Control Data field CRC field field field field Data frame Arbitration Control CRC field field field field Remote frame Error delimiter Error flag field field Error frame Overload Overload flag delimiter field field Overload frame Figure 5-3 CAN frame configurations - 85 -...

  • Page 86

    AN07-00180-3E 1. Data frame Transfer format for data transmit. It consists of seven fields. Field name Description 1-bit field containing “0” that indicates the start of a data Start of frame (SOF) frame Arbitration field Field that determines the priority of the data. This field is also called the ID field and there are two types of format;...

  • Page 87

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

  • Page 88: Arbitration

    AN07-00180-3E 5.2.2 Arbitration CAN employs the multi-master communication system, so any node can start communication. But, the number of communication sessions actually allowed on one bus is only one. 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.

  • Page 89: Figure 5-5 Example Of Arbitration Among Nodes

    AN07-00180-3E giving priority to the Node 1 transmission with a lower ID. After Node 1 ends its transmission, Node 2 resumes transmission. After that, Node 1 and Node 3 starts transmission simultaneously. The arbitration is also performed and results in giving priority to the Node 3 transmission. After that, Node 4 starts transmission as soon as Node 3 ends its transmission.

  • Page 90: Error Management

    AN07-00180-3E 5.2.3 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.

  • Page 91: Figure 5-6 Can Status Transition

    AN07-00180-3E Transition between the statuses is described below along the example shown in “Figure 5-6 CAN status transition”. The initial status of a node is error active. In this status, occurrence of errors increases the TEC/REC counters. If either of the TEC/REC counters comes to 127 or higher, the status of the node changes to error passive.

  • Page 92: Can Communication By Using The Microcontroller

    AN07-00180-3E CAN communication by using the microcontroller 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.

  • Page 93: Figure 5-8 Entire Can Communication Control Register

    AN07-00180-3E 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: Table 5-2 Description Of The Entire Can Communication Control Registers And Setting Values

    AN07-00180-3E Table 5-2 Description of the entire CAN communication control registers and setting values Register name Setting value [function] Description CTRLR0_Test 0 [normal operation] Test mode enable bit CTRLR0_CCE 1 [write enable] Bit timing register write enable bit CTRLR0_DAR 0 [automatic retransmit enable] Automatic retransmit prohibit bit CTRLR0_EIE 0 [code setting disable]...

  • Page 95: Understanding And Running The Program For Can Communication

    AN07-00180-3E Understanding and running the program for CAN communication 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: Table 5-4 Can Message Ids In The Sample Program

    AN07-00180-3E “Table 5-4 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 Description Communication direction 0x101 Motor operation start/stop command receive 0x102 Motor operation rotation speed/Rotation receive direction/Brake command...

  • Page 97

    AN07-00180-3E Field name Setting value Remarks Motor rotation 0: Clockwise 1: direction Counterclockwise Brake application 0: Brake released 1: Brake applied Motor rotation speed 0 to 65535 The motor rotation speed and A/D maximum value are used for conversion of the speed to a A/D maximum value 0 to 65535 percentage of 0% to 100%.

  • Page 98

    AN07-00180-3E 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 Remarks Temperature 0 to 50 information - 98 -...

  • Page 99: Sample Program Sequence

    AN07-00180-3E 5.4.2 Sample program sequence “Figure 5-9 CAN communication flowchart” shows the CAN communication sequence of the sample program flow. 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.

  • Page 100: Figure 5-10 Operation Mode Settings

    AN07-00180-3E Now, take a look at the details of the program. Look into the following folder of the sample program. There are some files stored in it. At first, open MAIN.C. ¥bitpot_red_SampleProgram¥Debug¥SRC 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.

  • Page 101: Figure 5-12 Can Timer Interrupt Control

    AN07-00180-3E 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 (i = 0;...

  • Page 102: Figure 5-13 Motor Rotation Information Transmit

    AN07-00180-3E Details of motor rotation information transmit, temperature sensor information transmit, and receive processing are as described below. 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: Figure 5-15 Can Receive Processing

    AN07-00180-3E 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 */...

  • Page 104: Appendix

    AN07-00180-3E 6 Appendix Sample program folder/file configuration “Table 6-1 Sample program folder/file configuration” shows the folder/file configuration of the sample program. Table 6-1 Sample program folder/file configuration Provision of the file File/folder name Description Single Monitor bitpot_red_SampleProgram/bitpot_red_SampleProgram_md ○ bitpot_red_SampleProgram.prj Softune project file ○...

This manual also for:

Mb91f267n

Comments to this Manuals

Symbols: 0
Latest comments: