background image

AN07-00200-03E 

 

 

 

 

 

F

2

MC-8FX  Family 

8-BIT MICROCONTROLLER 

MB95F136JBS 

 

bits  pot  yellow 

LIN board

 

 

User’s  Manual

 

 

 

Summary of Contents for F2MC-8FX Series

Page 1: ...AN07 00200 03E F2 MC 8FX Family 8 BIT MICROCONTROLLER MB95F136JBS bits pot yellow LIN board User s Manual ...

Page 2: ...Revision October 24 2008 Revision 1 0 Initial release May 13 2009 Revision 1 1 TSUZUKI DENSAN s Logo mark was changed April 23 2010 Revision 1 2 Change in company name of FUJITSU MICROELECTORONICS New FUJITSU SEMICONDUCTOR LIMITED left blank ...

Page 3: ...for general use including without limitation ordinary industrial use general office use personal use and household use but are not designed developed and manufactured as contemplated 1 for use accompanying fatal risks or dangers that unless extremely high safety is secured could have a serious effect to the public and could lead directly to death personal injury severe physical damage or other los...

Page 4: ...the program into the microcontroller 40 2 2 Debugging by using Monitor Debugger 43 2 2 1 Activating SOFTUNE and configuring the debug settings 43 2 2 2 Writing the monitor program into the microcontroller 53 2 2 3 Loading the target file 56 2 2 4 Running the debugger 57 3 Operation of the sample Programs 60 3 1 bits pot yellow single unit operation 61 3 2 LIN communication operation LIN communicat...

Page 5: ...unication between master and slave if an error occurs 87 5 5 LIN communication by using microcontroller 88 5 6 Understanding and overview of the program for LIN communication 92 5 6 1 LIN communication configuration 92 5 6 2 Sample programs sequence 97 6 Appendix 109 6 1 Sample program folder file configuration 109 ...

Page 6: ...log 27 Figure 1 14 PC Writer Setup type 28 Figure 1 15 Finished PC writer Ready to install 28 Figure 1 16 Completing the PC Writer installation 29 Figure 1 17 Installing BGM Adapter MB2146 09 30 Figure 1 18 Selecting the search locations 31 Figure 1 19 Hardware installation 31 Figure 1 20 Completing the BGM Adapter MB2146 09 installation 32 Figure 1 21 MODE selection 33 Figure 1 22 Connection betw...

Page 7: ... Figure 2 29 Opening the file to write 53 Figure 2 30 Selecting the file to write 54 Figure 2 31 Writing the program 55 Figure 2 32 Completing the program writing 55 Figure 2 33 Start debugging 56 Figure 2 34 Setting break points 57 Figure 2 35 Running the program 58 Figure 2 36 Stopping the program 58 Figure 3 1 Single unit operation Controls and mechanicals 61 Figure 3 2 LIN communication operat...

Page 8: ...Example of communication sequence between the master and slaves during normal communication 86 Figure 5 7 LIN circuit 88 Figure 5 8 Entire LIN communication control registers 89 Figure 5 9 LIN communication flowchart main routine 97 Figure 5 10 LIN communication flowchart interrupt routine UART reception interrupts 98 Figure 5 11 LIN communication flowchart interrupt routine input capture interrup...

Page 9: ...ation Descriptions of the controls and mechanicals 62 Table 3 2 LIN communication Descriptions of the controls and mechanicals 64 Table 5 1 Description of the entire LIN communication control registers and setting values 90 Table 5 2 LIN communication conditions of the sample program 92 Table 5 3 LIN message IDs in the sample program 92 Table 6 1 Sample program folder file configuration 109 ...

Page 10: ...twork can easily learn what it is The kit includes flash microcontroller development tools so if you have slight understanding about the C language you can rewrite a program to let the microcontroller perform in various ways Even if you do not know of programming you may be able to enjoy learning a microcontroller with a study aid book about the C language This starter kit can also serve as an int...

Page 11: ... e mail address for the technical question Please confirm HP for the latest information and FAQ of bits pot 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 ...

Page 12: ...rials Capacitors 22pF GCM1552C1H220JZ02 220pF GCM1552C1H221JA01 0 1μF GCM188R11E104KA42 10μF GCM32ER71E106KA42 Ceramic Resonator 4MHz CSTCR4M00G55B 6MHz CSTCR6M00G55B Buzzer PKLCS1212E40A1 NTC Thermistor NTCG164BH103JT1 Ferrite Beads MPZ2012S300AT ...

Page 13: ...kit from our web site bits pot URL http www tsuzuki densan co jp bitspot Table 1 1 Component list No Article Qty Specifications Remarks 1 bits pot yellow LIN board 1 Board mounted with microcontrollers made by Fujitsu Semiconductor F2 MC 8FX series MB95F136JBS and F2 MC 8LX series MB89P585B See Figure 1 1 2 USB cable 1 USB A to miniB Accessory 3 LIN cable 1 2 pin cable Accessory 4 PC 1 On which Wi...

Page 14: ... 7 LED lamps 8 Volume switch 9 Buzzer 2 USB communication microcontroller 10 Power LED lamp 11 USB connector 12 LIN connector 13 Regulator 14 LIN transceiver IC 16 Oscillator for USB communication microcontroller 17 Target device oscillator 19 Jumper pin 20 Extension power 5V 21 Extension GND 15 Reset IC 22 LIN transceiver IC Extension power 12V ...

Page 15: ...A D converter 7 LED lamps LED red x 3 LED lamps connected to the general purpose I O port 8 Volume SW Volume switch Volume switch connected to the A D converter input 9 Buzzer PKLCS1212E40A1 External drive electric sounder made by Murata Manufacturing Connected to the PPG timer output port 10 Power supply LED lamp LED green x 1 LED lamp for the starter kit power supply 11 USB connector mini B USB ...

Page 16: ...LIN transceiver IC 1 2 Power supply from USB bus power 5V 2 3 Power supply from external power source CN5 12V The default is 1 2 20 Extension power 5V Extension 5V power terminal 21 Extension GND Extension GND terminal 22 Extension power supply 12V for LIN transceiver IC Extension power supply pin for the LIN transceiver IC This is used to supply external power 12V When in use it is necessary to s...

Page 17: ...ure 1 2 System connection diagram single unit operation Figure 1 2 System connection diagram single unit operation Connect the PC and starter kit by using the USB cable included in the kit The starter kit power is supplied by the USB USB bus power Note Connect the USB to the PC directly Do not connect the USB via a USB hub or an extension unit such as a docking station Use the USB cable included i...

Page 18: ...ot white using the enclosed USB cables The power for the bits pot white is also supplied by the USB in the same way as for the starter kit USB bus power Note Connect the USB to the PC directly Do not connect the USB via a USB hub or an extension unit such as a docking station Note Prepare the PC by yourself LIN connector accessory ...

Page 19: ...VCC 5V 14 AVSS GND_EARTH 15 P00 INT00 AN00 PPG00 BUZZER 16 P01 INT01 AN01 PPG01 VR Power supply voltage division 0 to 100 17 P02 INT02 AN02 SCK LIN TRANSCEIVER 18 P03 INT03 AN03 SOT LIN TRANSCEIVER 19 NC 20 P04 INT04 AN04 SIN LIN TRANSCEIVER 21 P05 INT05 AN05 TO00 SW2 SW pressed L 22 P06 INT06 AN06 TO01 SW3 SW pressed L 23 P07 INT07 AN07 THERMISTOR 24 P10 UI0 USB UART conversion MB89P585B Use when...

Page 20: ...AN07 00200 03E 20 27 P12 UCK0 EC0 USB UART conversion MB89P585B Use when writing to flash or during monitor debugging 28 P13 TRG0 ADTG PULL DOWN 29 P14 PPG0 LED4 L output On 30 P15 LED5 L output On ...

Page 21: ...he PC use the following procedures Downloading the software Installing the integrated development environment SOFTUNE bits pot dedicated version Installing the PC Writer FUJITSU FLASH USB Programmer bits pot yellow dedicated version Connecting it to the PC and installing the USB driver Configuring the starter kit settings ...

Page 22: ...n install the bits pot yellow dedicated version Install the integrated development environment SOFTUNE Unzip the following file in the folder you decompressed in 1 1 1 Downloading the software softwares SOFTUNE ProPack_Rev300016 BV_8FX zip Double click Setup exe in the decompressed folder The dialog shown in Figure 1 4 SOFTUNE setup confirmation will be displayed Click the OK button Figure 1 4 SOF...

Page 23: ...ion will be displayed Click the Next button Figure 1 6 SOFTUNE setup confirmation The dialog shown in Figure 1 7 SOFTUNE setup License agreement will be displayed Read the license agreement thoroughly and then click the Yes button Figure 1 7 SOFTUNE setup License agreement ...

Page 24: ...igure 1 8 SOFTUNE setup Version information The dialog to select the installation path will be displayed as shown in Figure 1 9 SOFTUNE setup Selecting the destination of installation select the default folder or desired folder and then click the Next button Figure 1 9 SOFTUNE setup Selecting the destination of installation ...

Page 25: ...e default settings as they are click the Next button Figure 1 10 SOFTUNE setup Selecting the components The dialog to check the installation settings is displayed as shown in Figure 1 11 SOFTUNE setup Confirming the installation settings Click the Next button The installation begins Figure 1 11 SOFTUNE setup Confirming the installation settings ...

Page 26: ...AN07 00200 03E 26 When the dialog shown in Figure 1 12 SOFTUNE setup Completion appears to tell the completion of installation Click the Finish button Figure 1 12 SOFTUNE setup Completion ...

Page 27: ...ct the following file in the folder you decompressed in 1 1 1 Downloading the software softwares USB PROGRAMMER BGM_MB95F136JBS_setup exe Double click BGM_MB95F136JBS_setup exe The dialog shown in Figure 1 13 PC writer Installation dialog will be displayed and the installation starts Click the Next button Figure 1 13 PC writer Installation dialog ...

Page 28: ...up type will be displayed Select complete and then click the Next button Figure 1 14 PC Writer Setup type The dialog shown in Figure 1 15 Finished PC writer Ready to install will be displayed Click the Install button Figure 1 15 Finished PC writer Ready to install ...

Page 29: ...ation complete the dialog shown in Figure 1 16 Completing the PC Writer installation appears to tell the completion of installation Click Finish Figure 1 16 Completing the PC Writer installation This completes the PC writer installation ...

Page 30: ...rst connect the USB port on the PC and the USB port on the starter kit using the enclosed USB cable Whereupon the BGM Adapter MB2146 09 installation dialog is displayed as shown in Figure 1 17 Installing BGM Adapter MB2146 09 Select Install from a list or specific location and click the Next button Figure 1 17 Installing BGM Adapter MB2146 09 ...

Page 31: ...ude this location in the search Further click the Browse button and select the Drivers folder in the SOFTUNE which has already been installed and then click the Next button Figure 1 18 Selecting the search locations A warning message will be displayed as shown in Figure 1 19 Hardware installation ignore and click the Continue Anyway button Figure 1 19 Hardware installation ...

Page 32: ...n the driver installation is complete the dialog shown in Figure 1 20 Completing the BGM Adapter MB2146 09 installation will be displayed Click the Finish button Figure 1 20 Completing the BGM Adapter MB2146 09 installation ...

Page 33: ...plied disconnect the USB temporarily to turn the power OFF Next set the starter kit MODE selector to PROG as shown in Figure 1 21 MODE selection Figure 1 21 MODE selection MODE Selector Operation mode PROG Flash memory serial write mode Used to write a program into the microcontroller RUN Single chip mode Used to run the program written into it Make sure that the MODE selector is set to PROG Then ...

Page 34: ...t The power of the starter kit is supplied via USB USB bus power Note When connecting the PC and starter kit if the driver installation dialog is displayed it is possible that the USB driver has not been installed correctly Return to 1 1 4 Connecting it to the PC and installing the USB driver and reinstall the driver Connect to the USB port on the PC For information about port locations and so for...

Page 35: ...AN07 00200 03E 35 2 Running the Program To run a program with the starter kit take either of the following procedures Executing in single chip mode See P 36 Debugging by using Monitor Debugger See P 43 ...

Page 36: ...Decompress the following file in advance within the folder you decompressed in 1 1 1 Downloading the software sample program bitspot_yellow_SampleProgram zip Activate SOFTUINE dedicated bits pot version In Windows click the Start All Programs P Softune V3 FFMC 8L Family Softune Workbench to activate SOFTUNE as shown in Figure 2 1 SOFTUNE Workbench start window Figure 2 1 SOFTUNE Workbench start wi...

Page 37: ...n Figure 2 3 Selecting a workspace the dialog that allows you to select a workspace is displayed Select the folder containing the sample program for single chip select the workspace bitspot_yellow_SampleProgram wsp and then click Open bitspot_yellow_SampleProgram bitspot_yellow_SampleProgram_single chip bitspot_yellow_Sam pleProgram wsp Figure 2 3 Selecting a workspace ...

Page 38: ...ribed check that single_operation is set to the active project as shown in Figure 2 4 Setting the active project Figure 2 4 Setting the active project To set the project for LIN communication as the active project select the project for LIN communication and right click on it as shown in Figure 2 5 Changing the active project The sub menu is displayed so select Set Active Project The project name ...

Page 39: ... 6 Building a project to build the project Figure 2 6 Building a project The message pane at the bottom of the windows shows the message as shown in Figure 2 7 Completing the build to notify you that the build has been completed successfully Figure 2 7 Completing the build ...

Page 40: ...ce Turn OFF the starter kit switch the mode setting to PROG and then turn ON the power supply to the starter kit again From the Windows start menu click All Programs FUJITSU USB PROGRAMMER MB95F136JBS to activate the PC writer To select the file to be written as shown in Figure 2 8 Opening the file to write click the Open button Figure 2 8 Opening the file to write Click ...

Page 41: ...ration Debug ABS single_operation mhx If you built a LIN communication project in Figure 2 6 Building a project select the following file and click Open bitspot_yellow_SampleProgram bitspot_yellow_SampleProgram_single chip LIN_communicatio n Debug ABS LIN_communication mhx Figure 2 9 Selecting the file to write Click the Full Operation button as shown in Figure 2 10 Writing the program to start wr...

Page 42: ...ram writing is displayed to notify you that the program writing has been completed Click the OK button to quit the PC writer Figure 2 11 Completing the program writing Switch the MODE SW on the starter kit to RUN and then press the Reset button the program starts running ...

Page 43: ...debugger 2 2 1 Activating SOFTUNE and configuring the debug settings Preparation Decompress the following file in the folder you decompressed in 1 1 1 Downloading the software in advance sample program bitspot_yellow_SampleProgram zip From Windows start menu click All Programs P Softune V3 FFMC 8L Family Softune Workbench to activate SOFTUNE Click File Open workspace from the SOFTUNE menu as shown...

Page 44: ...m_monitor debugger bitspot_yello w_SampleProgram_monitordebugger wsp Figure 2 13 Selecting a workspace The workspace opens check that the single_operation project is set to the active project To change the active project to the project for the LIN communication select the project for the LIN communication as shown in Figure 2 5 Changing the active project and then right click and select Set as Act...

Page 45: ... 14 Building a project The message pane at the bottom of the screen displays the message as shown in Figure 2 15 Completing the build to notify you that the build has been completed successfully Figure 2 15 Completing the build ...

Page 46: ...shown in Figure 2 16 Load module outputs select Project Setup Project from the menu The project settings dialog opens check that Start load module converter is enabled on Converter By enabling this checkbox the load module will be output Figure 2 16 Load module outputs ...

Page 47: ...in Figure 2 17 Debug settings Figure 2 17 Debug settings Change the category from General to Setup and select mon_dbg from the setup name list In the setup name mon_dbg is entered as shown in Figure 2 18 Changing the debug settings Here click the Change button to change the settings The setup wizard activates Figure 2 18 Changing the debug settings ...

Page 48: ...19 Starting the debug setting wizard Click the Next button Figure 2 19 Starting the debug setting wizard Select the debugger type as shown in Figure 2 20 Selecting the debugger type select Monitor Debugger and then click the Next button Figure 2 20 Selecting the debugger type ...

Page 49: ...er Keep the default settings and then click the Next button Figure 2 21 Entering password when starting debugger Select the device type as shown in Figure 2 22 Selecting the device type Check that USB has been selected in the device name and click the Next button Figure 2 22 Selecting the device type ...

Page 50: ...quency Set to D 4 4MHz frequency setting and click the Next button Figure 2 23 Setting the primary oscillation frequency Specify nothing to the batch file field as shown in Figure 2 24 Specifying a batch file keep the field left blank and click the Next button Figure 2 24 Specifying a batch file ...

Page 51: ...re 2 25 Configuring the target file settings and click the Next button Figure 2 25 Configuring the target file settings Select Specification for setup file selection as shown in Figure 2 26 Setting setup file selection and click the Next button Figure 2 26 Setting setup file selection ...

Page 52: ...izard click the Finish button Figure 2 27 Completing the setup wizard When the debug settings have been completed click the Apply button and then click the OK button as shown in Figure 2 28 Completing the project settings to finish configuring the project settings Figure 2 28 Completing the project settings ...

Page 53: ...ODE SW on the starter kit to PROG in advance Turn OFF the starter kit switch the mode setting to PROG and then turn ON the power supply to the starter kit again To activate the PC writer and select the file to be written as shown in Figure 2 29 Opening the file to write click the Open button Figure 2 29 Opening the file to write Click ...

Page 54: ...tings and click the Open button bitspot_yellow_SampleProgram_monitor debugger single_operation Debug ABS single_operati on mhx If you built a LIN communication project in 2 2 1 Activating SOFTUNE and configuring the debug settings select the following file and click the Open button bitspot_yellow_SampleProgram_monitor debugger LIN_communication Debug ABS LIN_com munication mhx Figure 2 30 Selectin...

Page 55: ...dialog shown in Figure 2 32 Completing the program writing is displayed to notify you of the completion of the program writing press the OK button to quit PC Writer Figure 2 32 Completing the program writing After completing the program writing turn OFF the starter kit power supply and set the Mode SW to RUN before reconnecting the power supply to the starter kit Click this ...

Page 56: ... the debug starts the target file will be loaded automatically Figure 2 33 Start debugging Once the monitor program itself is loaded to flash memory the module can be loaded by the monitor debugger functions subsequently and it is not necessary to use the PC writer Note It may take several minutes for the monitor debugger to load ...

Page 57: ... is located which is shown on the left side of lines in the source file A maximum of only two break points can be set Note that you cannot set break points while the program is running Figure 2 34 Setting break points Click this to set a break point To cancel the break point click this again attempting to set the third point an error occurs ...

Page 58: ... in Figure 2 35 Running the program By this operation the program runs and the starter kit operates Figure 2 35 Running the program To stop the program click Debug Abort from the menu as shown in Figure 2 36 Stopping the program Figure 2 36 Stopping the program ...

Page 59: ...ebugger 2 2 4 2 Debugger prohibitions Do not operate resources that use the monitor debugger IO ports P10 P11 P12 Do not operate the PLLC and SYCC registers by using the debugger Do not set break points in the monitor program Do not single step thorough within API FGM_WDTON process 2 2 4 3 Debugger limits The initial values for the SP register changes The startup time changes after the reset cance...

Page 60: ...s section describes the operation of the sample program The operation of the sample programs is classified into the following two categories bits pot yellow single unit operation LIN communication operation LIN communication operation with the bits pot white ...

Page 61: ... and mechanicals are described in Table 3 1 Single unit operation Descriptions of the controls and mechanicals The LEDs red and buzzer are controlled by SW 2 SW 3 volume switch and temperature sensor on the starter kit Figure 3 1 Single unit operation Controls and mechanicals 2 Reset SW 1 Mode SW 3 SW2 4 SW3 5 Temperature sensor 6 Volume SW 7 Buzzer 8 LEDs red ...

Page 62: ...n they are all ON each time the switch is pressed 4 SW3 Control Turns ON and OFF the buzzer outputs each time the switch is pressed 5 Temperature sensor Control Displays the temperature sensor information on the LED The ON OFF pattern depends on the temperature 6 Volume SW Control Change the buzzer sound when the sound is ON Slide to the left to raise the tone 7 Buzzer Mechanical Press SW 3 to sou...

Page 63: ...m LIN communication with bits pot white The starter kit sends responses to the bits pot white as a LIN slave LED red and 7SEG ON signals and buzzer outputs of the starter kit and the bits pot white are controlled by switch operation and temperature sensor and volume switch operation of each starter kit Further if an error occurs during LIN communication a buzzer output is sent Figure 3 2 LIN commu...

Page 64: ...ented If bits pot white SW4 is set to the right no operation is performed 5 Temperature sensor Control When bits pot white SW4 is set to the right the temperature of the starter kit temperature sensor is sent 6 Volume SW Control When bits pot white SW4 is set to the right the information of the starter kit Volume SW is sent The sound of the bits pot white buzzer output changes when the volume swit...

Page 65: ...OFF the LEDs using SW2 operations Figure 4 1 Single unit operation Switches and LEDs First describes how to control turning ON the LEDs using the microcontroller The LEDs and microcontroller of the bits pot yellow are connected as shown in Figure 4 2 LED lighting circuit This is shown diagrammatically in Figure 4 3 LED ON OFF circuit example schematic diagram When the LED is OFF as shown in Figure...

Page 66: ...nput pin and the general I O ports on the microcontroller This section explains how to detect switch operations i e when the switch is pushed on the microcontroller using the pins as external interrupt input pins INT5 An overview of the SW2 connection circuit in the starter kit is shown in Figure 4 4 Connection configuration between SW2 and microcontroller pins schematic diagram In the starter kit...

Page 67: ...rection used by the port 0 pins If using the pins as input ports write 0 to the bit corresponding to DDR0 Further to use the external interrupt function on the microcontroller it is necessary to set the external interrupt register EIC00 EIC00 is a register that selects the edge polarity and controls interrupts for the external interrupt inputs This section considers when SW 2 being turned ON is de...

Page 68: ...AN07 00200 03E 68 the rising edge is detected 5 Set EIC20 bit 5 to 1 This permits INT5 interrupts ...

Page 69: ... volume switch which is built into the starter kit Analog signals are input to the microcontroller using this knob Analog signals that have been entered are processed by the microcontroller after being converted to digital signals by the A D converter Figure 4 5 Single unit operation Volume SW An A D converter with 8 bit resolution 10 bit resolution can also be used is built into the main microcon...

Page 70: ...ustment knob and adjusting this volume switch changes the value of the voltage applied and applies this voltage to the pins that perform the A D conversion The applied voltage can be digitally converted in 256 steps and handled as internal signals In this sample program the size of the applied voltage is obtained using an A D converter and the buzzer sound changes according to this value Variable ...

Page 71: ...on of polarization the direction of the green arrows and contracting when a voltage is applied in the opposite direction to polarization the opposite direction from the green arrows 膨張 収縮 Figure 4 8 Piezoelectricity Consequently as shown in Figure 4 9 Principle of piezoelectric elements when an AC voltage is applied the crystals repeatedly expand and contract each time the direction of the voltage...

Page 72: ...is built into the microcontroller PPG is an initialize for Programmable Pulse Generator and as the name implies pulse outputs of various widths are obtained from the microcontroller by using programs Basically pulse outputs using the PPG timer are enabled by setting the cycle H width and operations clock In reality in addition to this pulse information the PPG pin output enable settings and PPG op...

Page 73: ...rs and is a temperature sensor in which the resistance value changes according to the temperature The circuit surrounding the temperature sensor on the starter kit is shown in Figure 4 10 peripheral circuit diagram for temperature sensor As explained in the section on the volume switch with this circuit also if the resistance value of the temperature sensor changes the input voltage of the A D con...

Page 74: ...xternal interrupt request flag LED4 LED5 and LED6 ON OFF End external interrupt processing Start external interrupt processing Start external interrupt processing Clear external interrupt request flag PPG start stop PPG output authorized End external interrupt processing Start AD conversion interrupt Clear interrupt request flag Use volume SW Cycle setting false true Duty setting Acquire A D value...

Page 75: ...sor and the enable disable settings can be configured To use the Volume SW for inputs to the A D converter configure the settings as shown in Figure 4 14 and to use the temperature sensor configure the settings as shown in Figure 4 15 In this explanation the temperature sensor is not used but use of the volume switch is enabled Figure 4 12 Operation mode settings when using volume switch Figure 4 ...

Page 76: ...itialization A D converter initialization and external interrupt initialization are contained herein Figure 4 14 Main function program void main sysInitialize adInitialize initial_external_int __set_il 3 __EI while 1 Port initialization AD converter initialization External interrupt initialization Infinite loop ...

Page 77: ...nterrupt void Ext_int2_6 in ext_int c is called as shown in Figure 4 16 SW3 interrupts buzzer output processing This is where the PPG timer output settings are made and timer start stop process is performed Figure 4 16 SW3 interrupts buzzer output processing _interrupt void Ext_int1_5 void IO_EIC20 bit EIR1 0 if TEMP_MEASURE_OFF IO_DDR1 bit P14 1 IO_DDR1 bit P15 1 IO_DDR1 bit P16 1 SW_count if SW_...

Page 78: ...on values that have been acquired to change the sound of the buzzer If using the temperature sensor the temperature is displayed according to the A D conversion values acquired Figure 4 17 A D converter interrupts __interrupt void ad_int void IO_ADC1 bit ADI 0 ad IO_ADD byte ADDL if TEMP_MEASURE_OFF if ad 51 IO_PPS00 0xFA IO_PDS00 0x7D else if ad 102 Omitted else if TEMP_MEASURE_ON if ad 66 IO_PDR...

Page 79: ...m vehicle mounted LAN Thereafter after several version upgrades LIN2 0 which has added diagnostic and other functions was launched in 2003 Further in 2006 the version was upgraded to LIN2 1 This section explains LIN applications Concomitant with multi function vehicles the existence of a network in vehicles also became indispensable Currently vehicle mounted LANs are broadly divided into two class...

Page 80: ... heater Rear wiper Rear blinkers Seats Power seat and motor control Passenger detection Heater Switch control Accessories Wipers Back mirror Switch control AC Motor control Rear panel Doors Switch control Power windows Mirror control Doors Switch control Power windows Mirror control ...

Page 81: ...e connected using bus wiring The LIN network configuration topology is a bus With single master LINs the slaves communicate only when they receive commands from the master so there is no conflict of signals in the bus A maximum of 15 slave nodes can be connected to one master Figure 5 2 Main LIN network configuration 3 Wiring is completed using a single wire The on board ECUs are connected to the ...

Page 82: ...d based on information as to whether transmitting and receiving has been performed successfully Processing after an error has been detected however is not specified Here LIN error processing can be customized according to the application CAN and FlexRay management of the communications status depends on the counter value which is called the error counter is featured by the specifications but in LI...

Page 83: ...igured using three fields Break Sync byte and ID field Identifier and responses are configured using two fields Data field and Checksum field Checksum Field Data Field ID Field Sync Byte Break ID DATA1 DATAN Check Sum Header Response Start bit L Stop bit H Interval Response space Break delimiter Inter frame space Figure 5 4 LIN frame configuration ...

Page 84: ...e has been sent and if it was intended for them according to the ID field sent by the master and send responses to the master accordingly Further the ID field has a 2 bit parity bit following the 0 to 63 6 bits This is bracketed by a 1 bit starter bit and 1 bit stop bit in the same way as the synchronous byte so overall the field is 10 bits in length 4 Data field The data which is in the response ...

Page 85: ... information by communicating with slave 3 2 in Figure 5 5 Main LIN network configuration and Figure 5 6 Example of communication sequence between the master and slaves during normal communication Thereafter the motor is turned by communications with slave 2 3 in Figure 5 5 Main LIN network configuration and Figure 5 6 Communications sequence between master and slave during normal communications T...

Page 86: ... normal communication Master Slave 1 Slave 2 Slave 3 Slave 15 Transceiver IC electronic component for sending and receiving data Motor Motor Sensor Motor operation Acquiring sensor information Acquiring sensor information Lamp ON Slave 3 Slave 15 Slave 2 Slave 1 Master All communications start from the master Motor operation Motor operation ...

Page 87: ...own status to the master This mechanism is described below The basic master operation is merely to send the header to the next slave when communications with the current slave have ended On the other hand the slave operation is to perform error checking when a header is received and when a response is sent Checksums and other checks are implemented during reception When sending checks are performe...

Page 88: ...In the microcontroller SOT sends SIN receives and SCK is the port that controls the transceiver IC Sending and receiving signals flow on the bus via the LIN transceiver IC 1 2 3 VCC5 CN5 EXT PWR GND U1 MB95F136JBS INH TXD D RXD NSLP NWAKE BAT LIN U4 TJA1020T SIN SOT SCK GND GND GND C8 0 1uF 4 1 2 8 7 3 6 5 C9 220pF R10 5 1kΩ CN4 18 20 17 VCC5 R8 1kΩ LED1 SML 210MT GND TR1 DTA144E VCC5 R9 1kΩ LED2 ...

Page 89: ...RXE TXE LIN UART serial mode register bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 SMR MD1 MD0 OTO EXT REST UPCL SCKE SOE LIN UART serial status register bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 SSR PE ORE FRE RDRF TDRE BDS RIE TIE LIN UART data receiving register data send register bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 RDR TDR LIN UART expanded status control register bit7 bit6 bit5 bit4 bit3 bit2 bi...

Page 90: ... counter restart bit SMR_UPCL 1 LIN UART reset Programmable clear bit LIN UART software reset SMR_SCKE 0 general I O port or LIN UART clock input pin Serial clock output enable bit SMR_SOE 1 LIN UART serial data output pin Serial data output enable bit SSR_BDS 0 LSB first transfer from least significant bit Transfer direction selection bit SSR_RIE 1 Receive interrupt enable Receive interrupt reque...

Page 91: ...h break creation bit ECCR_MS 0 Serial clock send receive selection bit ECCR_SCDE 0 Serial clock delay enable bit ECCR_SSM 0 Start stop bit mode enable bit BGR_BGR1 0x16 when set to 9600bps Baud rate generator 1 BGR_BGR0 0x66 when set to 9600bps Baud rate generator 0 ...

Page 92: ...ue 19200bps Peripheral clock frequency 16MHz Synch break length 13 bits Receive is fixed to detect 11 bits Data length 8 bits Data bit format LSB first Data byte count 8 bytes Next this section explains message IDs using LIN communication as described in Table 5 3 LIN message IDs in the sample program Table 5 3 LIN message IDs in the sample program ID Description Communication direction 0x00 Tempe...

Page 93: ...t white SW4 is set to the right temperature information is acquired from the temperature sensor on the starter kit by receiving 0x55 If bits pot white SW4 is set to the left no operation is performed A D value temperature sensor information 0 to 255 This is temperature sensor information from the bits pot white The temperature is displayed on the starter kit using this A D value 2 ID 0x01 byte 0 R...

Page 94: ...ion byte 2 Reserved byte 3 Reserved byte 4 Reserved byte 5 Reserved byte 6 Reserved byte 7 Reserved Field name Set value Remarks Volume value acquire command 0x55 Start 0x0F Stop If bits pot white SW4 is set to the right volume information is acquired from the starter kit by receiving 0x55 and the buzzer sound is output If bits pot white SW4 is set to the left the buzzer sound is not output A D va...

Page 95: ...byte 0 LED on off change command byte 1 Reserved byte 2 Reserved byte 3 LED value byte 4 Reserved byte 5 Reserved byte 6 Reserved byte 7 Reserved Field name Setting value Remarks LED on off change command 0x55 Start 0x0F Stop This is the LED on off change command from bits pot white If bits pot white SW4 is set to the left 0x55 is received and if the LED value is not 0xFF the received LED value is...

Page 96: ...yte 0 Reserved byte 1 Reserved byte 2 Reserved byte 3 LED value byte 4 Reserved byte 5 Reserved byte 6 Reserved byte 7 Reserved Field name Set value Remarks LED value 0 to 7 This is the value of the LED displayed on the starter kit ...

Page 97: ...r whether the data being sent and received can be completed in a fixed cycle and when the data has finished being received implement processing according to the ID Synch break detection ID reception and data sending and receiving to operate as a LIN slave is processed using LIN UART reception interrupts Further the baud rate is adjusted within the input capture interrupts as described in Figure 5 ...

Page 98: ... Data reception processing Yes No Check sum send processing Create UART reception interrupt Figure 5 10 LIN communication flowchart interrupt routine UART reception interrupts Start ICU interrupt processing End ICU interrupt processing Processing to obtain ICU timer value 1 Processing to obtain ICU timer value 2 Baud rate adjustment processing Create input capture ICU interrupt Figure 5 11 LIN com...

Page 99: ...k at the processing of the sample software in the LIN frame fields Checksum Field Data Field ID Field Sync Byte Sync Break ID DT DT Check Sum HEADER Data reception interrupt RESPONSE Data reception interrupt Sync break interrupt Input capture interrupt Data reception interrupt Data reception interrupt Figure 5 12 Operations points of interrupt processes Sync break In sync breaks the sync break sig...

Page 100: ...d the count operations continue as is When the input capture interrupts are set to enabled and both edge detection when an edge is detected an input capture interrupt is created The timer value at both edges and the number of overflows are measured and the baud rate calculated and adjusted using interrupts at 8 __interrupt void _LinUartRx void if ssr 0xE0 0 Omitted else if ESCR_LBD SET ESCR_LBD CL...

Page 101: ... 101 0 1 2 3 4 5 6 7 Synch field START BIT STOP BIT DATA 0x55 1回目 5回目 8Tbit 2Tbit 2Tbit 2Tbit 2Tbit FFH uiICUTime1 uiICUTime2 TII0入力 LSYN Figure 5 14 Input capture operation in the synch field 1st 5th TII0 input LSYN ...

Page 102: ...N_WAIT_SYNCH_FIELD_END Omitted uiICUTime2 T00DR adjust Baud Rate Omitted vEnableLinUartReception ucLinStatus LIN_ID_RECEPTION Omitted else if T00CR1_IF SET Omitted Check edge detection interrupt Synch field start wait Acquire timer value State transition synch field end wait Acquire timer value Baud rate adjustment processing LIN UART interrupt authorized State transition ID received Acquire numbe...

Page 103: ...etermination processing In normal sequences to migrate the status during the second input capture interrupt process to ID FIELD reception waiting ID reception processing is performed In ID reception processing the ID that has been acquired is judged to be either a send ID or reception ID and parity check performed and if it is a send ID the status is migrated to send preparation status and the dat...

Page 104: ...N Omitted vSetLinFreerunTimersCompare ucRxCount else if LinTxDataPtr ucCurrentId fields id 0 ucLinStatus LIN_PRETRANSMIT Omitted vLinWordCopy ucUartTxBuffer LinTxDataPtr ucCurrentId fields id ucTxCount vSetLinFreerunTimersCompare hTINFRAME_SPACE_IND Omitted case LIN_WAKEUP_TRANSMIT Omitted DATA FIELD send status DATA FIELD receive status ID FIELD reception wait status Store received ID Parity chec...

Page 105: ...e sending response space In the vTimeoutCheckTask function processing is separated into pre sending and initialization processing etc according to the status information and if the status is pre sending the first data byte is sent Figure 5 18 Timeout detection processing void vTimeoutCheckTask void Omitted if uiIntDemandCounter 0 switch ucLinStatus case LIN_PRETRANSMIT ucLinStatus LIN_TRANSMIT ucS...

Page 106: ...n the number of data bytes is set to 8 so when the eighth data byte has finished being sent finally a checksum is sent and the send processing ends Figure 5 19 Data send processing void l_ifc_rx l_ifc_handle rx_data switch ucLinStatus case LIN_TRANSMIT if ucTxCurrentIndex ucTxCount Omitted l_ifc_tx ucUartTxBuffer ucTxCurrentIndex Omitted else if ucTxCurrentIndex ucTxCount Omitted l_ifc_tx unsigned...

Page 107: ...t bytes of data have been received if there is no checksum error the reception successful flag is set and reception processing ends Figure 5 20 Data reception processing void l_ifc_rx l_ifc_handle rx_data switch ucLinStatus case LIN_TRANSMIT Omitted case LIN_DATA_RECEPTION if ucRxCurrentIndex ucRxCount if uiRxCheckSum rx_data 0xFF Omitted flagsLinTxRx bit SucceedReception SET memcpy ucUartRxFixedB...

Page 108: ...ing and sent data storage are performed Figure 5 21 Submain processing void submain void switch ucCurrentId fields id case 0x00 if ucDATA00 0 0x55 IO_ADC2 byte 0xCB IO_ADC1 byte 0x71 if ad_master 42 IO_PDR1 byte LED_pat2 1 Omitted case 0x02 IO_ADC2 byte 0xCB IO_ADC1 byte 0x11 IO_PC00 byte 0x0E Omitted case 0x04 if ucDATA04 0 0x55 ucDATA04 3 0xFF Omitted else if LED_count_Flag 1 Omitted ucDATA05 3 ...

Page 109: ... _f2mc8fx h Yes Yes Microcontroller header definition file define h Yes Yes Header definition file extern h Yes Yes External function reference file fgm h Yes Yes Header file for incorporated monitor programs mb95130 h Yes Yes Microcontroller header file source fgm_cfg asm Yes Yes Monitor operation definition file startup asm Yes Yes Microcontroller startup assembler file ADC c Yes Yes A D convert...

Page 110: ...w level header file linnode h Yes Yes Header file for definitions by LIN communication node mb95130 h Yes Yes Microcontroller header file source fgm_cfg asm Yes Yes Monitor operations definition file fgm_main asm Yes Yes Monitor debugger assembler file startup asm Yes Yes Microcontroller startup assembler file ADC c Yes Yes A D converter file autoboot c Yes Yes Autoboot determination processing fi...

Reviews: