EVBplus MiniDragon-Plus2 Trainer User Manual

For freescale hcs12 microcontroller family

Advertisement

Quick Links

MiniDragon-Plus2 Trainer
For Freescale HCS12 microcontroller family
User's Manual
Revision 1.03

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the MiniDragon-Plus2 Trainer and is the answer not in the manual?

Questions and answers

Summary of Contents for EVBplus MiniDragon-Plus2 Trainer

  • Page 1 MiniDragon-Plus2 Trainer For Freescale HCS12 microcontroller family User’s Manual Revision 1.03...
  • Page 2: Table Of Contents

    Table OF Contents Chapter 1. Introduction...........................4 1.1 Welcome............................4 1.2 MC9S12DG256 features and memory map................5 1.3 On-board hardware features ....................8 1.4 I/O pin usage ..........................9 Chapter 2. Quick Start ..........................12 2.1 Install software from CD ...................... 12 2.2 Getting Started ........................13 2.3 Test hardware ........................
  • Page 3 4.10 Temperature sensor ......................27 4.11 LCD display module ......................27 4.12 Keypad ..........................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 D-Bug12 utility routines ..................... 34 Interrupt vector tables ......................
  • Page 4: Chapter 1. Introduction

    Chapter 1. Introduction 1.1 Welcome Thank you very much for purchasing the MiniDragon-Plus2 trainer. The MiniDragon-Plus2 trainer is a low-cost, feature-packed training board for the Freescale HCS12 microcontroller family. It is compatible with the Freescale 9S12DP256EVB board and other similar development boards on the market today, but it also incorporates many on-board peripherals that make this board one of the best trainers in universities around the world.
  • Page 5: Mc9S12Dg256 Features And Memory Map

    MC9S12DG256 features and memory map: MiniDragon-Plus2 board come with theMC9S12DP256CCPV MC9S12DG256CVPE installed. The MC9S12DG256 is the best replacement for the MC9S12DP256 since the latter has been discontinued by Freescale. The only difference between DG256 and DP256 is the number of CAN ports. The DG256 has 2 CAN ports, but the DP256 has 5 CAN ports.
  • Page 6 Fig 1-1: MC9S12DG256 Memory map...
  • Page 7 Fig 1-2: MC9S12DG256 MCU block diagram...
  • Page 8: On-Board Hardware Features

    Fig 1-3: MC9S12DG256 MCU pin assignments On-board hardware features: The MiniDragon-Plus2 board includes the following features: 1. Dual RS232 communication ports 2. CAN port 3. SPI expansion port for interfacing external SPI devices 4. Four robot servo controllers with terminal block for external 5V 5.
  • Page 9: I/O Pin Usage

    11. Power-On LED indicator 12. BDM-in connector to be connected with a BDM from multiple vendors for debugging 13. BDM POD mode for programming other HCS12 boards. No extra hardware needed 14. Abort switch for stopping program when program is hung in a dead loop 15.
  • Page 10 Pin Name Pin # I/O Usage Pin 57 Col_0 of keypad (output) Pin 58 Col_1 of keypad (output) Pin 59 Col_2 of keypad (output) Pin 60 Col_3 of keypad (output) Pin 61 Row_0 of keypad (input) Pin 62 Row_1 of keypad (input) Pin 63 Row_2 of keypad (input) Pin 64...
  • Page 11 Pin Name Pin # I/O Usage Pin 105 CAN0 Pin 104 CAN0 Pin 103 not used Pin 102 not used Pin 101 not used Pin 100 not used Pin 88 not used Pin 87 I/O for external SPI (J10) Pin 4 EN12 of H-bridge (output) Pin 3 EN34 of H-bridge (output)
  • Page 12: Chapter 2. Quick Start

    Chapter 2. Quick Start By default the MiniDragon-Plus2 board is pre-installed with the bootloader (Freescale AN2153.pdf) and the D-Bug12 monitor (Freescale DB12RG4.pdf). In chapters 2 and 3 the AsmIDE is used as the main software tool to develop and debug assembly programs. If you prefer to use Code Warrior IDE for C program development and your board is pre-installed, per your request, with the serial monitor (Freescale AN2548.pdf), skip the chapters 2 and 3 except clicking on the setup.bat in the CD to install software .
  • Page 13: Getting Started

    Getting Started To operate the MiniDragon-Plus2 board, follow steps1 through 5 below: 1. Make sure that the two DIP switches of S7 must be set in the “low” positions for EVB mode, then plug the AC adapter into a wall outlet, and plug the female plug of the AC adapter into the DC jack on the left side of the MiniDragon Plus2 board.
  • Page 14 6. If your PC does not have a COM port output, you have to use a USB to RS232 adapter, the COM port number that the AsmIDE uses must match the USB-to-Serial COM port number that is assigned by Windows O/S. Windows O/S assigns the USB-to-Serial COM port number randomly and it does not know which COM port number that AsmIDE is going to use.
  • Page 15: Test Hardware

    Test Hardware: To help users get up and running, the MiniDragon-Plus2 board comes with many fully debugged, some fairly advanced ready-to-run sample programs including source code, not just "Hello World" type demo programs. The hardware test program, test.asm, simultaneously scans the keypad, plays a song, changes 7-segment display brightness by adjusting the trimmer pot and vary music playing tempo according to temperature change.
  • Page 16: Chapter 3. Software Desriptions

    Chapter 3. Software descriptions Bootloader and D-Bug12 Monitor The MC9S12DG256 on the MiniDragon-Plus2 board is pre-loaded with bootloader and D-Bug12 monitor firmware and it will operate in 4 different modes depending on the setting of the 2- position DIP switch, S7. After power up or reset, the MC9S12DG256 will read the PAD0 and PAD1 to decide which mode to boot up.
  • Page 17: Jump To Eeprom Mode

    3.1.2 Jump-to-EEPROM mode: PAD1=0, PAD0=1 This mode enables the MC9S12DG256 to jump directly to the internal EEPROM at location $0400 upon reset. This mode makes the MC9S12DG256 a replacement for the old 68HC811E2 microcontroller, but it also gives you 3K EEPROM instead of 2K EEPROM with the 68HC811E2.
  • Page 18 ou first must set the target speed with the choice 1). After entering the first choice, you will be prompted to enter the target speed. It’s the crystal frequency, not the bus speed that is boosted up by the on-chip PLL. After a reset, before the PLL is enabled, the target MC9S12DG256 is running from the crystal frequency, not the PLL frequency.
  • Page 19 An s1-record uses a 16-bit starting address field while an s2-record uses a 24-bit starting address field. An s1-record file looks like this: S123FFA0F64CF650F654F658F65CF660F664F668F66CF670F674F678F67CF680F684F6883D S123FFC0F68CF690F694F698F69CF6A0F6A4F6A8F6ACF6B0F6B4F6B8F6BCF6C0F6C4F6C81D S123FFE0F6CCF6D0F6D4F6D8F6DCF6E0F6E4F6E8F6ECF6F0F6F4F6F8F6FCF700F704F00009 S9030000FC An s2-record file looks like this: S2240FEFA0DB70DB66DB5CDB52DB48DB3EDB34DB2ADB20DB16DB0CDB02DAF8DAEEDAE4DADA41 S2240FEFC0DAD0DAC6DABCDAB2DAA8DA9EDA94DA8ADA80DA76DA6CDDD0DA62DA58DA4EDA4494 S2240FEFE0DA02DA0ADA12DA1ADA22DA2ADA32DA3AD9FAD9F2D9AFD98AD9D5EF00EF00EF0039 S9030000FC We are not going to explain the s-record format here. If you would like to know more on the subject, you can review the D-Bug12 reference guide on the CDROM (BD12RG4.PDF).
  • Page 20: Bootloader Mode

    With the bootloader and the D-Bug12 programmed in the flash memory, the target board now becomes a true development board. That’s how we program the board before we ship it. Your MiniDragon-Plus2 board actually becomes a programmer. You can then repeat above steps as many times as you want.
  • Page 21: Making A Simple Assembly Program In Ram

    The option c) will set a new baud rate. The option d) will erase all on-chip EEPROM. Note: Quite a few users would accidentally erase the D-Bug12 monitor when entering this mode, so it’s important to know how to re-program the D-Bug12 monitor. To program flash memory with the D-Bug12 monitor: 1.
  • Page 22 For a good programming practice, you should always place the lds instruction in the first line of your code. #include reg9s12.h REGBLK: $0000 STACK: $2000 $1000 counter: $2000 ; program code start: #STACK #REGBLK ldaa #$ff staa ddrh,x ; make port H an output port staa pth,x ;...
  • Page 23: Software Development

    D-Bug12 v4.0.0b32 Copyright 1996 - 2005 Freescale Semiconductor For Commands type "Help" > 6. Type “LOAD” <Enter> 7. Click Build button, select Download option and locate the file named ‘Flash_7seg.s19”’ for downloading. After download is done, type “G 2000” and hit <Enter> key to run the program.
  • Page 24 3.3.3 Use on-chip flash for testing your code in BOOTLOADER mode. In this mode, you download your program directly into on-chip flash memory. You first erase the D-Bug12 monitor portion of flash memory, and then program that portion of the flash memory by downloading your application program code in an s29 file.
  • Page 25: Chapter 4. Hardware Descriptions

    Chapter 4: Hardware Descriptions The crystal frequency is 16 MHz and usually it will result in a 8 MHz bus speed, but on this board the MC9S12DG256’s internal PLL boosts the bus speed up to 24 MHz. The circuits are designed in such way that the value of all resistors and capacitors are not critical and they can be off -50% or +100%.
  • Page 26: Trimmer Pot

    The segment A, B, C, D, E, F and G are driven by PH0, PH1, PH2, PH3, PH4, PH5 and PH6, respectively. The hex value of the segment code for common cathode LED display is shown in the following table: Number Hex Value To flash the number 1234 on the 7-segment display, the following steps should be taken:...
  • Page 27: External Spi Interface

    the receiver of the SCI1, (PS2, pin 91 of the MCU) cannot be used for any other device. If you need to use PS2 for your circuits on breadboard, the solder bridge on J15 must be removed. External SPI interface SPI port (J10) pinouts are as follows: Pin 1 VCC (5V)
  • Page 28: Keypad

    4.12 Keypad (optional) Port A is an 8-bit bi-directional port. Its primary usage is for a 4X4 keypad. If the port is not used for the keypad, it can be used as a general-purpose I/O. The schematic for the keypad connections is shown below: Col_0 Col_1 Col_2...
  • Page 29: All Jumper Settings

    Keypad scan routine sets PA0 low and PA1, PA2, PA3 high, then tests PA4-PA7. If no key is down, PA4-PA7 remain high. If PA7 = low, the key 3 is down. If PA6 = low, the key 2 is down. If PA5 = low, the key 1 is down.
  • Page 30: Chapter 5. Embeddedgnu

    Chapter 5: EmbeddedGNU Eric Engler has published the EmbeddedGNU IDE that supports GNU C compiler and assembler for any 68HC11/HC12/HCS12 boards including our FOX11, EVBplus2, Dragon12 and MiniDragon+ boards. It's free software under Open Source, GNU GPL License. It's not freeware nor shareware (be aware that some freeware are not free).
  • Page 31 To change the linker search directory (search path) for GNU C compiler toolset you click on options->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...
  • Page 32: Chapter 6. Code Warrior And Serial Monitor

    The instructions to program the on-chip flash memory is shown on page 17. The latest D-Bug12 monitor and serial monitor can be downloaded from: www.EVBplus.com\download_hcs12\download_hcs12.html Some universities use Code Warrior IDE only. In this case, we pre-load the on-chip flash memory with serial monitor.
  • Page 33: Chapter 7. Pll Code

    We will add setup procedures for Code Warrior in the future. For the time being you can visit some university web sites for more information. Instructions of how to download Code Warrior from Freescale’s web site: http://web.njit.edu/~paterno/ECET310/CodeWarrior.pdf CodeWarrior Familiarization & Project Setup: A Guide to Beginning Embedded Assembly and C Programming on the S12 http://www.aet.cup.edu/~jsumey/cet360/cwintro/cwintro.html The most resourceful “Code Warrior for the Dragon12 trainer”...
  • Page 34: Chapter 8. Appendix

    Chapter 8: Appendix D-Bug12 utility routines The AN1280 was written for OLD 68HC12 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...
  • Page 35: Interrupt Vector Tables

    Interrupt vector table Fig 8-2: MC9S12DG256 Interrupt vector table 1...
  • Page 36 Fig 8-3: MC9S12DG256 Interrupt vector table 2...
  • Page 37 Fig 8-4: MC9S12DG256 secondary interrupt vector table...
  • Page 38: Useful Web Links

    HC12 users. You also can visit our web site at: http://www.evbplus.com/hc11_68hc11_hc12_68hc12_9s12_hcs12_sites.html to get links to many university web sites that offer course materials and lab assignments for the Dragon12 and MiniDragon-Plus2 boards.
  • Page 39 17. The newest firmware can be downloaded at: www.evbplus.com/download_hcs12.html 2. Always reset the board before downloading a new program. If the previous application program that you ran was aborted, then you may need to reset the board before downloading a new application program.

Table of Contents