background image

  

  

 
 

MiniDragon-Plus2 Trainer 

For Freescale HCS12 microcontroller family

 

 

User’s Manual 

Revision 1.03 
 

 

 

 

 
 

 
 
 
 
 
 

Содержание MiniDragon-Plus2 Trainer

Страница 1: ...MiniDragon Plus2 Trainer ForFreescaleHCS12microcontrollerfamily User sManual Revision 1 03 ...

Страница 2: ... BUG12 monitor 16 3 1 1 EVB mode 16 3 1 2 Jump to EEPROM mode 17 3 2 3 BDM POD mode 17 3 2 4 Bootloader mode 20 3 2 Making a simple assembly program in RAM 21 3 3 Software development 23 Chapter 4 Hardware Descriptions 25 4 1 Power LED 25 4 2 Jumper switches and pushbuttons 25 4 3 Seven Segment LED display 25 4 4 Trimmer pot 25 4 5 Speaker 26 4 6 Dual RS232 communication ports 26 4 7 External SPI ...

Страница 3: ...ad 28 4 13 All jumper settings 29 Chapter 5 EmbeddedGNU 30 Chapter 6 Code Warrior and serial monitor 32 Chapter 7 PLL code 33 Chapter 8 Appendix 34 8 1 D Bug12 utility routines 34 8 2 Interrupt vector tables 35 8 3 Useful web links 38 8 4 Troubleshooting notes 38 3 ...

Страница 4: ... with the following items 1 MiniDragon Plus2 board 2 CD ROM which contains a AsmIDE with HCS12 assembler b Sample programs with source code c Freescale application notes for the HCS12 d Data sheets for on board hardware e User s manual f Reference documents 3 RS232 cord 4 110V AC adapter for North America customers If you miss any part of the kit please contact sales EVBplus com or call 630 894 14...

Страница 5: ...hese two chips are identical and all datasheets and manuals for the DP256 can be used for the DG256 The MC9S12DG256 microcontroller consists of a powerful 16 bit CPU central processing unit 256K bytes of flash memory 12K bytes of RAM 4K bytes of EEPROM and many on chip peripherals The main features of the MC9S12DG256 are listed below Powerful 16 bit CPU 256K bytes of flash memory 12K bytes of RAM ...

Страница 6: ...Fig 1 1 MC9S12DG256 Memory map 6 ...

Страница 7: ...Fig 1 2 MC9S12DG256 MCU block diagram 7 ...

Страница 8: ... 3 SPI expansion port for interfacing external SPI devices 4 Four robot servo controllers with terminal block for external 5V 5 7 segment LED display 6 Two jumper switches 7 Two push button switches 8 5V regulator with DC jack 9 Speaker to be driver by timer or PWM signal for alarm or music applications 10 Dual H Bridge for controlling two DC motors or one Stepper motor 8 ...

Страница 9: ... 40 The MiniDragon Plus2 board has the following features as options 23 RF transmitter 24 RF receiver 25 4 X 4 keypad 26 16X2 LCD 27 RTC 28 RS485 communication 29 Form C relay output rated at 3A 30V or 1A 125V 1 4 I O Pin Usage Many I O pins of the MC9S12DG256 on the MiniDragon Plus2 board are used by on board peripherals but thanks for the large 112 pin LQFP package there are still many I O pins ...

Страница 10: ... 55 not used PE2 Pin 54 not used PE3 Pin 53 not used PE4 Pin 39 not used PE5 Pin 38 not used PE6 Pin 37 not used PE7 Pin 36 not used PH0 Pin 52 Segment A on display PH1 Pin 51 Segment B on display PH2 Pin 50 Segment C on display PH3 Pin 49 Segment D on display PH4 Pin 35 Segment E on display PH5 Pin 34 Segment F on display PH6 Pin 33 Segment G on display PH7 Pin 32 not used PJ0 Pin 22 not used PJ1...

Страница 11: ... PS6 Pin 95 SCLK for external SPI J10 PS7 Pin 96 I O for external SPI J10 PT0 Pin 9 not used PT1 Pin 10 not used PT2 Pin 11 not used PT3 Pin 12 not used PT4 Pin 15 not used PT5 Pin 16 Speaker output PT6 Pin 17 BDMout reset output used in POD mode only PT7 Pin 18 BDMout data line bi directional used in POD mode only PAD0 Pin 67 D bug12 mode select S7 PAD1 Pin 69 D bug12 mode select S7 PAD2 Pin 71 T...

Страница 12: ...es to be shown with extensions click on the TOOL tab in Explorer menu then click on folder options then click on view tab finally un check the item named Hide extensions for knowing file types The AsmIDE is free to use under GPL license If you would like to use it in the future we encourage you donate 5 00 to Eric Engler at http www ericengler com AsmIDE aspx After the software is successfully ins...

Страница 13: ...r side It should be shorted by a solder bridge Also check the output of the AC adapter It should be about 10V DC without a load the output DC voltage of the AC adapter is rated for 7 5V at 300mA but usually the voltage is much higher without a load 2 Plug the RS232 cable into the RJ11 jack P1 at the left side of the MiniDragon Plus2 board and plug the DB9 female end of the cable into COM1 or COM2 ...

Страница 14: ...baud and press it again to get 57600 baud To stay at the 57600 baud all the time you need to press the Hyperbaud button twice after every reset The Hyperbaud function is disabled by default and it should only be used by an experienced user not a beginner 9 You can program text values for function keys to be sent from the terminal window Some function keys are pre programmed but you can change it a...

Страница 15: ...uild button to assemble code and generate the test s19 file This is how you normally generate an s19 file You can omit this step because the test s19 is already on your hard disk 3 Press the reset button on the board you will see D Bug12 v4 0 0b32 Copyright 1996 2005 Freescale Semiconductor For Commands type Help 4 Type LOAD Enter 5 Click the Build button Select Download option and locate the file...

Страница 16: ... ppage 30 31 and 32 See details on page 20 of the app note AN2153 or page 71 of the D Bug12 v4 reference guide on the CD 3 1 1 EVB mode PAD1 0 PAD0 0 This is the standard debug environment running on the MC9S12DG256 for on chip RAM or EEPROM based code development Using an IDE program to view and modify registers and memory locations you may set breakpoints single step through programs and assembl...

Страница 17: ... the BDM port in a non intrusive manner It becomes a BDM that will have all the features that a standard BDM has in debugging the target MCU Also it gains all the features a programmer has for programming the flash memory of the MCU on the target board another MiniDragon Plus2 board To use the master board as a programmer you need a 6 pin ribbon cable to connect from the BDM OUT of the master boar...

Страница 18: ...he EVB mode The S tells that this is the POD mode and the MC9S12DG256 on target slave board is stopped Sometimes the prompt could be a R that means the target MCU is running If you see the R just type reset then Enter to reset the target and it will come back to the S prompt R Reset Enter S Note The initial communication in POD mode does not always work smoothly and sometimes the PC screen would o...

Страница 19: ...s2 record file before using the FLOAD command The FLOAD command in the D Bug12 is for downloading an s2 record file Our MiniDragon Plus2 bootloader is modified from the Motorola s BootDP256 asm We added our modification to the original source code and the s record file is generated by the AsmIDE It s an s1 record file and we converted it into an s2 record file by using the following commands Srecc...

Страница 20: ... named flash_programming 3 1 4 BOOTLOADER mode PAD1 1 PAD0 1 This bootloader allows you to erase program flash memory and erase EEPROM It is mainly used to program the D Bug12 monitor into flash memory or download a user s fully debugged code into the D Bug12 portion of flash memory The latter allows the board to be operated in EVB mode and start your code every time the board is turned on or rese...

Страница 21: ... a terminal program and the following instructions to create your first assembly program If you are using a different terminal program the instructions may vary The steps to create your first program are as follows 1 Click the File button to open a new file In assembly language you specify the starting address of your CODE by an ORG statement You can start the data RAM at address 1000 with the sta...

Страница 22: ... 000 cycles 1ms delay dex this instruction takes 1 cycle bne delay this instruction takes 3 cycles dec counter bne delay1 not 250ms yet delay again pula pulx rts end 2 Click File button select Save option to save your assembly source file Save your file frequently while editing If you are creating a new file and giving the file a name to save enter the file name including file extension such as Fl...

Страница 23: ...ur program you must initialize the interrupt vectors at 3E00 3E7F In all sample programs the user program code locations are at 2000 3FFF The user data RAM locations are at 1000 1FFF The 64 RAM interrupt vector addresses are at 3E00 3E7F The 64 RAM interrupt vector addresses 128 bytes of RAM are assigned by the D Bug12 monitor to different interrupt sources The listing of interrupt sources is show...

Страница 24: ...ts to EF80 EFFF The D BUG12 is not present and the interrupt vectors of your program are at EF80 EFFF The addresses EFFE and EFFF contains the starting address of your program In order to program the MC9S12DG256 flash memory you must program an even number of bytes and begin on an even address boundary for each s record If any one s record in the file contains an odd number of bytes or begins with...

Страница 25: ...nt LED The type of the 7 segment LED on the MiniDragon Plus2 board is called common anode All cathodes are driven individually by an output port and all anodes are internally connected together The MiniDragon Plus2 board uses port H to drive 7 segment cathodes We will explain how to flash the number 1234 on the display Before sending a number to a 7 segment LED the number must be converted to its ...

Страница 26: ...J19 can be cut if AN07 must be used by target circuits 4 5 Speaker The speaker is a 5V audio transducer and it can be driven by PT5 Output Comparator 5 or PP5 PWM 5 The jumper on J10 is preset for the PT5 at factory and all sample programs on the CD will drive the speaker via PT5 After reset the bootloader or the serial monitor will generate a chirp via the speaker If the jumper is not placed for ...

Страница 27: ...emperature and light sensors coming soon 4 11 LCD display optinal Port K is an 8 bit bi directional port It s used for the LCD display module If the port is not used for the LCD display it can be used as a general purpose I O port The pinouts of J1 are as follows Pin 1 GND Pin 2 VCC 5V Pin 3 Via a 220 Ohm resistor to GND Pin 4 PK0 RS pin for LCD module Pin 5 PK7 R W pin for LCD module Pin 6 PK1 EN...

Страница 28: ...OW2 of the keypad PA7 connects ROW3 of the keypad Keypad scan routine sets PA3 low and PA0 PA1 PA2 high then tests PA4 PA7 If no key is down PA4 PA7 remain high If PA7 low the key 15 is down If PA6 low the key 14 is down If PA5 low the key 13 is down If PA4 low the key 12 is down Keypad scan routine sets PA2 low and PA0 PA1 PA3 high then tests PA4 PA7 If no key is down PA4 PA7 remain high If PA7 l...

Страница 29: ...bridge on J11 must be removed if user provides an external 5V to the MiniDragon Plus2 board via T6 J15 Connects the receiver of SCI1 to the P2 2nd RJ11 for user applications Place a solder bridge on J15 only if you use SCI1 via P2 J16 Connects terminating resistor for CAN0 Place a solder bridge on J16 of the last node on the network only if you use CAN0 Remove the solder bridge if CAN0 is not used...

Страница 30: ...er com EmbeddedGNU aspx Extract all files into a new directory that you need to create on any hard drive The name of the new directory can be like c egnu094 or d egnu094 The EmbeddedGNU exe and example programs will be located at egnu094 but your application programs can be located in any other directories 4 Filename Association When you first start EmbeddedGNU exe it will ask if you want to assoc...

Страница 31: ...s project options edit profile As it can be seen from above Linker Search Directory the GCC 3 3 6 is installed on C drive Some university web sites offer educational resource for the EmbeddedGNU The following web site provides A C sample program for the Dragon12 board using EmbeddedGNU and GCC 31 ...

Страница 32: ...ooms Without spending money on a BDM a student will be able to spend his savings on purchasing a more advanced trainer like the MiniDragon Plus2 board with many on board peripherals Purchasing an EVB board that comes with a BDM at a reasonable price most likely leaves the student with an EVB of only limited functionality Some universities use D Bug12 monitor first then replace the D Bug12 monitor ...

Страница 33: ... jsp nodeId 01272600612247 Chapter 7 PLL code The crystal frequency on the MiniDragon Plus2 board is 16 MHz so the default bus speed is 8 MHz In order to set the bus speed high than 8 MHz the PLL must be initialized You can cut and paste the following code to the beginning of your program The math used to set the PLL frequency is PLLCLK CrystalFreq 2 initSYNR 1 initREFDV 1 CrystalFreq 16 MHz on Mi...

Страница 34: ...family If you happen to use printf routine with your old 68HC12 board you should be aware that I O utility routines are moved to different addresses in D Bug12 V4 x The address for the printf is EE88 and addresses of other I O routines are listed below Fig 8 1 D Bug12 utility routines 34 ...

Страница 35: ...8 2 Interrupt vector table Fig 8 2 MC9S12DG256 Interrupt vector table 1 35 ...

Страница 36: ...Fig 8 3 MC9S12DG256 Interrupt vector table 2 36 ...

Страница 37: ...Fig 8 4 MC9S12DG256 secondary interrupt vector table 37 ...

Страница 38: ...n cause a big problem especially for beginners Before troubleshooting the board you must apply power to the board When the board is powered the PWR LED indicator must be on If it s off the board does not have 5V DC Sometimes it may be caused by a bad AC adapter or the AC adapter may not even be plugged in To determine if the board malfunctions you can restore the following jumper settings to the o...

Страница 39: ...rrupt that was enabled by the previous application If the interrupt was caused by a timer and is not disabled the timer interrupt will continue even it s not called for in your new application program The result will be unpredictable 3 In EVB mode reset clears your pseudo RAM interrupt vectors When you develop code with interrupts in RAM you must initialize pseudo RAM interrupt vectors in the very...

Отзывы: