Motorola MC9S12DP256, CML12S-DP256 User Manual

CML12S-DP256
Development Board for Motorola MC9S12DP256
xiom
anufacturing
2000 2813 Industrial Ln. • Garland, TX 75041 (972) 926-9303 FAX (972) 926-6063
email: Sales@axman.com web: http://www.axman.com
CML12SDP256 07/17/02
GETTING STARTED.......................................................................................................3
Installing the Software........................................................................................4
Board Startup.....................................................................................................4
Support Software................................................................................................4
Software Development.......................................................................................5
TUTORIAL ......................................................................................................................5
Creating source code..........................................................................................5
Assembling source code..................................................................................... 6
Running your application....................................................................................7
Programming HCS12 Flash EEPROM................................................................8
MON12 OPERATION......................................................................................................9
Mon12 Monitor Commands .............................................................................. 10
MON12 Interrupt Support .................................................................................10
NOICE OPERATION.....................................................................................................11
MON12 and NOICE Memory Map ....................................................................11
BDM OPERATION........................................................................................................12
AUTOSTART ................................................................................................................12
OPTIONS AND JUMPERS............................................................................................13
MEM_EN.......................................................................................................... 13
ECS .................................................................................................................13
MODC..............................................................................................................14
AUTO OFF / spare...........................................................................................14
MODE..............................................................................................................14
OSC_SEL ........................................................................................................ 14
ROM_OFF .......................................................................................................14
JP1 and JP2 .....................................................................................................15
CUT-AWAY OPTIONS 1 - 6.............................................................................15
PORTS AND CONNECTORS.......................................................................................15
MCU_PORT..................................................................................................... 15
ANALOG PORT............................................................................................... 16
BUS_PORT......................................................................................................17
TB1 and J1 Power............................................................................................ 15
KEYPAD / PORT H..........................................................................................17
P_COM1 and P_COM2....................................................................................17
CAN PORT ...................................................................................................... 18
P1 - P4 HCS12 Header Ring............................................................................ 19
LCD_PORT...................................................................................................... 19
BDM PORT......................................................................................................20
TEST POINTS ................................................................................................. 20
TROUBLESHOOTING..................................................................................................21
TABLE 1. LCD Command and Character Codes..............................................23
TABLE 2. MON12 Interrupt Table .....................................................................24
2
CML12SDP256 07/17/02
GETTING STARTED
The Axiom CML12S-DP256 single board computer is a fully assembled, fully functional development system for the Motorola MC9S12DP256 microcontroller. Provided with wall plug power supply and serial cable. Support software for this development board is provided for Windows 95/98/NT/2000/XP operating systems.
This development board applies option selection jumpers. Terminology for application of the option jumpers is as follows:
Jumper on, in, or installed = jumper is a plastic shunt that fits across 2 pins and the shunt is installed so that the 2 pins are connected with the shunt.
Jumper off, out, or idle = jumper or shunt is installed so that only 1 pin holds the shunt, no 2 pins are connected, or jumper is removed. It is recommended that the jumpers be idled by installing on 1 pin so they will not be lost.
Development board users should also be familiar with the hardware and software operation of the target HCS12 device, refer to the Motorola User Guide for the device and the CPU12 Reference Manual for details. The development board purpose is to assist the user in quickly developing an application with a known working environment or to provide an evaluation platform for the target HCS12. Users should be familiar with memory mapping, memory types, and embedded software design for the fastest successful application development.
Application development maybe performed by applying the embedded MON12 (default) or NOICE firmware monitors, or by applying a BDM cable with supporting host software. The MON12 monitor provides an effective debug method for assembly level software, but has limitations in C code developments. For C/C++ code development it is recommended that source code or symbolic debug capability be provided in the debugging environment. The NOICE monitor or BDM interface with supporting software tools should be applied for C/C++ code development so the host PC can provide the symbolic support needed. User should verify the NOICE or BDM development environment supports the C compiler to be applied, not all development environments support all compilers.
The MON12 and NOICE monitors are provided in the development board HCS12 internal flash memory and apply some HCS12 resources for operation. See the respective chapter for each monitor for details on operation and resources applied. User should note both monitors apply operation of the HCS12 expanded wide mode data and address bus on HCS12 I/O ports A, B, E, and K for access to the external Ram. The external ram provides a development memory where code to be debugged can be loaded or modified quickly and software breakpoints applied. After the application is tested, the code can be relocated to the internal flash memory space of the HCS12 and programmed into the flash memory for dedicated operation.
User applications developed by applying MON12 or NOICE monitors can be modified and relocated for operation as a stand-alone application. By applying the MON12 Autostart feature, the user application will operate from Reset or Power on conditions to provide a dedicated operation of the application. See the Autostart section in this manual for more information.
3
CML12SDP256 07/17/02
Follow the steps in this section to get started quickly and verify everything is working correctly.
Installing the Software
1. Insert the Axiom 68HC12 support CD in your PC. If the setup program does not start, run the file called "SETUP.EXE" on the disk.
2. Follow the instructions on screen to install the support software onto your PC. You should at minimum install the AxIDE for Windows software.
3. The programming utility “AxIDE” requires you to specify your board. You should select "CML12SDP256" version of your development board.
Board Startup
Follow these steps to connect and power on the board for the default Monitor operation. This assumes you're using the provided AxIDE utility (installed in the previous section) or a similar communications terminal program on your PC. If you're using a different terminal program than the one provided, set it's parameters to 9600 baud, N,8,1.
1. Set the CML12Sxxx board Option jumpers to default positions:
MEM-EN = IN, ECS = IN, JP1 = IN, NOAUTO (SPARE) = IN
MODC = Out, JP2 = do not care, see COM Ports.
2. Connect one end of the supplied 9-pin serial cable to an available serial COM port on your PC. Connect the other end of the cable to the P-COM port on the CML12Sxxx board.
3. Apply power to the board by plugging in the power adapter that came with the system.
4. If everything is working properly, you should see a message to “PRESS KEY TO START MONITOR…” in your terminal window. Press the ENTER key and you should see:
Axiom MON12 - HC12 Monitor / Debugger V256.x Type "Help" for commands…
> _
5. Your board is now ready to use! If you do not see this message prompt, or if the text is garbage, see the TROUBLESHOOTING section at the end of this manual.
Support Software
There are many programs and documents on the included HC12 support CD you can use with the CML12Sxxx board. You should install what you want from the main menu then browse the disk and copy what you like to your hard drive.
4
CML12SDP256 07/17/02
At minimum, you should install the AxIDE program. This provides the flash programming utility and communication with the board via the COM port and the supplied serial cable. This program includes a simple terminal for interfacing with other programs running on the CML12Sxxx and information from your own programs that send output to the serial port.
Also on the disk are free assemblers AS12 and MCU-EZ, the open source GNU C/C++ compiler tools for HC11/12, example source code, and other useful software. The introductory tutorial in this manual uses the free AS12 assembler integrated into the AxIDE program. This is a simple assembler with limited capability. For a more powerful assembly tool, install the Motorola MCUez program from the CD. This will allow you to use PAGED program memory in your application.
Software Development
Software development on the CML12Sxxx can be performed using either the MON12 monitor installed in internal FLASH of the MCU, a third party debugger (Debug12, NoICE, CodeWarrior, etc.) or a Background Debug Module (BDM) connected to the BDM PORT connector. Any of these tools can be used to assist in creating and debugging your program stored in RAM (see Memory Map).
After satisfactory operation running under a debugger, your program can be written to Internal Flash Memory using the included programming utilities. The Mon12 firmware in the MCU flash provides the interrupt vectors in Ram memory and an Autostart feature to launch your application. Your program may then run automatically whenever the board is powered on or RESET is applied.
TUTORIAL
This section was written to help you get started developing software with the CML12SXXX board. Be sure to read the rest of this manual as well as the documentation on the disk if you need further information.
The following sections take you through the complete development cycle of a simple "hello world" program, which sends the string "Hello World" to the serial port.
Creating Source Code
You can write source code for the CML12SXXX board using any language that compiles to Motorola 68HC12 instructions. Included on the software disk is a free Assembler, AS12.
You can write your source code using any ASCII text editor. You can use the free EDIT, WordPad, or Notepad programs that come with your computer. Note that the source file must be simple ASCII text without any document formatting added. Once your source code is written and saved to a file, you can assemble or compile it to a Motorola S-Record (hex) format. This type of output file usually has a .MOT, .HEX or .S19 file extension and is in a format that can be read by the programming utilities and programmed into the CML12SXXX board.
5
CML12SDP256 07/17/02
It is important to understand the development board's use of Memory and Addressing when writing source code so you can locate your code at valid addresses. For example, when in debug mode, you should put your program CODE in External RAM. In assembly language, you locate the code with ORG statements in your source code. Any lines following an ORG statement will begin at that ORG location, which is the first number following the word ORG, for example: ORG $4000. You must start your DATA (or variables) in a RAM location unused by your program, for example: ORG $1000.
In “debug mode” you’ll be using a debugger utility (Mon12, NoICE, etc) which will handle initialization, interrupts vectors (reset, timers, etc), and the STACK. When finished debugging, you must add code to your application to handle the initialization of the CPU, STACK and possibly the Interrupt vectors. Some initialization is required to set the bus frequency, bus mode, internal EEprom and Flash memory programming clock rates, and others, see the CML-INIT.ASM file for a sample. Set the stack at the top of your available internal RAM below the Ram interrupt vector table, for example $3F80, in assembly this would be LDS #$3F80. Also install the RESET vector address in the Auto Start area, see the chapter in this manual.
If you are applying a software development tool that also provides a BDM cable interface to the board, the monitor installed in the flash is not required. The BDM software tools may have the capability to erase and program the flash memory. If this is the case, you may develop code in the external ram memory or internal flash without applying the monitor resources. The MON12 S record is provided on the support CD to program into the flash if desired. The BDM will allow locating programs in memory and applying resources reserved for the monitors.
A look at the example programs on the disk can make all of this clearer. If you're using a compiler instead of an assembler, consult the compiler documentation for methods used to locate (MAP) your code, data and stack.
Assembling source code
An example program called “HELLO.ASM” is provided under the \EXAMPLES\CML12 directory of the CD and if you installed AxIDE, under that programs \EXAMPLE directory. You must use the example for the MCU type installed on the CML12Sxxx board. For example use the CML12S-DP256 example on the DP256 version board.
You can assemble source code by using the AxIDE "BUILD" button or command line tools under a DOS prompt by typing:
AS12 HELLO.ASM –L HELLO
Most compilers and assemblers allow many command line options so using a MAKE utility or batch file is recommended if you use this method. Run AS12 without any arguments to see all the options, or see the AS12.TXT file on the disk.
The utility software, AxIDE, provided with this board contains a simple interface to this assembler. Use it by selecting "Build" from its menu. This will prompt you for the file to be assembled. NOTE: You must select your board from the pull down menu first, or it may not build correctly.
6
CML12SDP256 07/17/02
DO NOT use long path or file names (> 8 characters). The free assembler is an older DOS based tool that does not recognize them.
If there are no fatal errors in your source code, 2 output files will be created:
HELLO.S19 a Motorola S-Record file that can be loaded or programmed into
memory
HELLO.LST a common listing file which provides physical address information
with resulting opcode and operand information. Warnings and error messages are provided with a summary at the end of the file.
The listing file is especially helpful to look at when debugging your program. If your program has errors, they will be displayed in the listing or fatal errors will prevent output from being generated. The end of the listing file generally provides a count of errors or warnings in the file.
If you prefer a windows integrated programming environment, try the Motorola MCU-EZ tools. Refer to the MCU-EZ documentation on the disk for more information.
Also, a port for the free GNU C compiler and tools for the HC12 is available on the CD under \Shareware and also online at www.gnu-m68hc11.org. Note that this version does not support HC12 Paging operation, check the web site for updates.
Running your application
After creating a Motorola S-Record file you can "upload" it to the development board for a test run. The provided example “HELLO.ASM” was created to run from external RAM so you can use the MON12 Monitor to test it without programming it into Flash.
If you haven’t done so already, verify that the CML12Sxxx board is connected and operating properly by following the steps under “GETTING STARTED” until you see the Mon12 prompt, then follow these steps to run your program:
1. Press and release the RESET button on the CML12Sxxx board. You should see the
PRESS ANY KEY message. Hit the return key to get the monitor prompt.
2. Type LOAD ↵↵
This will prepare Mon12 to receive a program.
3. Select Upload and when prompted for a file name select your assembled program file in s-
record format that was created in the previous section called: HELLO.S19 Your program will be sent to the board through the serial port.
4. When finished loading you will see a done message and the > prompt again. Type GO
4000 ↵↵ This tells MON12 to execute the program at address $4000 hex, which is the start of our test program.
5. If everything is working properly you should see the message “Hello World” echoed back
to your terminal screen. Press RESET to return to the monitor.
6. If you do not get this message, see the TROUBLESHOOTING section in this manual
7
CML12SDP256 07/17/02
You can modify the hello program to display other strings or do anything you want. The procedures for assembling your code, uploading it to the board and executing it remain the same. MON12 has many features such as breakpoints, memory dump and modify and simple program trace (no redirect of the PC is followed). Type HELP at the MON12 prompt for a listing of commands or consult the Mon12 documentation on the disk for more information.
For a more powerful debugger with many advanced features such as source level debugging, you can use the NoICE debugger software. A full-featured demo version is provided on the CD, which you can use to get started. NOTE: To use this program instead of MON12 you must set the Autostart, see the NOICE chapter for details.
Programming HCS12 Flash EEprom
After debugging, you can program your application into Flash Memory so it executes automatically when you apply power to the board as follows:
1. Make a backup copy of HELLO.ASM then use a text editor to modify it.
2. Remove the comment ';' character before one of the following lines to initialize the stack pointer which is necessary when running outside of a debugger:
LDS #$3F80 ; initialize stack location…
3. Re-Assemble HELLO.ASM as described in the "Assembling Source Code" section.
4. Select Program from the AxIDE menu and follow the message prompts. When prompted for a file name, enter the new HELLO.S19 file.
5. Press the RESET button on the board before clicking OK. When prompted to Erase, choose Yes.
6. When finished programming, Reset the board to get the Monitor prompt again. Use the monitor AUTO command to set the Autostart Reset vector:
>AUTO 4000 ↵↵
AutoStart ON, effective address = 4000
>
7. Verify AUTO OFF option jumper is not installed. (Spare jumper on revision C boards)
8. RESET or re-apply Power to the board. Your new program should start automatically and the “Hello World” prompt should be displayed in the terminal window.
To return to the MON12 monitor program, install the AUTO OFF option jumper then press RESET. Execute the monitor command NOAUTO to disable the Autostart and allow removal of the Auto Off option jumper for normal operation.
8
Loading...
+ 16 hidden pages