Freescale Semiconductor Quick Start Guide Rev. 0.1, 06/29/2004 DEMO9S12NE64 Demo Quick Start Guide Introduction This kit and guide contains everything you need to get started. You will connect the board to your PC, run the pre-programmed Startup Demo, install the correct version of CodeWarrior, and load the MC9S12NE64 demo game called “The Connector.” Source code for both demos and the Serial Monitor are provided on the MC9S12NE64 Resource CD. Figure 1 describes the power barrel connector requirements. Please follow it closely, mainly to avoid damaging the board by applying too much power. Please refer to the DEMO9S12NE64 User’s Guide on the MC9S12NE64 Resource CD provided for additional information about the board. Figure 1. Power Barrel Connector Requirements Connect the DEMO9S12NE64 to Your Computer and Apply Power 1. Connect one end of the Crossover Ethernet cable provided to the J1 Ethernet Port of the DEMO board. Connect the other end to the Ethernet Port of your host PC. 2. Connect the 9-pin serial cable provided to the SCI port of the DEMO board. Connect the other end to a COM port on your host PC. 3. Plug the wall plug power supply provided into a power outlet and install the barrel connector into the power jack on the DEMO board. If you are not using the original power adapter supplied, please refer to the specs in Figure 1. 4. Set the DEMO board SW3 switch to position 1, so that you can immediately start running the Startup Demo. 5. Apply power to the board. The PWR LED in the bottom left corner of the board (oriented with the power connector at the bottom left) should come on. Either LED1 or LED2 (not both) should also turn on, indicating that you are in Test1 of the Startup Demo. © Freescale Semiconductor, Inc., 2004. All rights reserved. Introduction Run the Startup Demo program The DEMO9S12NE64 is shipped with the Startup Demo already stored in on-chip flash memory as mentioned before. You may view the source code for this demo on the supplied MC9S12NE64 Resource CD as zip file, “Startup_Demo.zip.” To run through this demo, follow the instructions below: 1. Test1, Analog Input: After powering up the board with SW3 in position 1, either LED1 or LED2 should be on. You are in Test1 of the Startup Demo. Turn the Analog Input to blink LED1 and LED2 alternately. Press SW2 to go to Test2. 2. Test2, Switch: Both LED1 and LED2 should light up. Press SW2 to turn off LED2, and let go to turn it back on. Press SW1 to move on to Test3. 3. Test3, Ethernet/Ping: LED1 should turn off. You will now need to configure the IP address for the PC. Please follow the directions below. Set the PC’s IP address and the Ping Test The ping test will verify that the PC is communicating with the DEMO board through the Ethernet Crossover cable provide in the kit, but you must first set the PC’s IP address to one that is compatible with the board’s IP address. For this demo, you will set the PC’s IP address to 192.168.2.1. The board’s IP address is currently set at 192.168.2.3. The mask for both should be 255.255.255.0. 1. Board’s IP address: The board’s IP address is already preset to 192.168.2.3 and mask to 255.255.255.0. They can be changed later, by changing the “prot_addr” and “netw_mask” entries respectively, in the address.c source file of the Startup Demo project, Startup_Demo.mcp. 2. PC’s IP address: Setting the PC’s IP address using Windows XP (similar in other Windows platforms; see Figure 2): a. b. c. d. e. On your PC, go to Start -> Settings –> Control Panel -> Network Connections -> Local Area Connection. In the “Local Area Connection Status” window, click on “Properties.” In the “Local Area Connection Properties” window, click on “Internet Protocol (TCP/IP)” to highlight it, and click “Properties, or just double click it. In the “Internet Protocol (TCP/IP) Properties” window, select “Use the following IP address” and type in 192.168.2.1 for the IP address and 255.255.255.0 for the subnet mask. Notice the PC’s IP address is exactly like the board’s IP address but with the fourth number slightly different. Click OK, OK, and Close. To later return your LAN setting to normal, repeat steps 2a) -2c), select “Obtain an IP..,” and click OK. DEMO9S12NE64 Demo, Rev. 0.1 2 Freescale Semiconductor Introduction e (to restore normal LAN settings) a b and c d Figure 2. Setting the PC’s IP Address 3. Ping Test: a. b. c. Open a DOS command window (in Windows by clicking Start -> Run, typing “cmd”, and clicking OK). In this black window, type “ipconfig” to verify that your PC IP address and mask has changed (i.e., to 192.168.2.1 and 255.255.255.0). Now ping the board by typing “ping,” followed by the board’s IP address and the enter key, i.e., “ping 192.168.2.3” and <enter>. If the PC and board have a connection and are communicating, you will see something like: Pinging 192.168.2.3 with 32 bytes of data: Reply from 192.168. 2.3: bytes=32 time=1ms Reply from 192.168. 2.3: bytes=32 time=1ms d. TTL=127 TTL=127 . . . If communication could not be established, see “Reasons Why the Ping Test Might Fail.” Install CodeWarrior Development Studio Version 3.1 for HC(S)12 If you do not have Version 3.1 of CodeWarrior for HC(S)12 installed on your computer, please refer to the provided “CodeWarrior Development Studio for Motorola” CD for HC(S)12 Special Edition Version 3.1 and the included CodeWarrior Quick Start. Important: You must register and obtain the special edition license key, which will allow you to experience all the features of the CodeWarrior debugger (see install, register, and license key instructions in the CodeWarrior Quick Start). Be sure to select “CodeWarrior Special for HC12 Release 3.1” under “Product Name” in the registration window. To begin a new MC9S12NE64 project in CodeWarrior, please be sure to install the CodeWarrior service pack (CD is included in the kit) that includes all stationery files for the MC9S12NE64. DEMO9S12NE64 Demo, Rev. 0.1 Freescale Semiconductor 3 Introduction Use the Serial Monitor to Program the MC9S12NE64 Connector Game The Serial Monitor is a program in MCU memory used to program the chip using only a serial cable. Its source file is included on the provided MC9S12NE64 Resource CD as zip file, HCS12SerialMon2r1.zip. After installing CodeWarrior v3.1 for HC(S)12, follow the procedure below to load The Connector software into the DEMO board using the Serial Monitor. Note: If you later need to re-program the Serial Monitor, you will need a BDM interface cable to program the Flash on the MCU. The BDM interface cable is not provided in this kit. 1. In the MC9S12NE64 Resource CD, open and save the “Connector_App.zip” file to your PC, and extract the files into a working folder. Note: Be sure to extract, and not just copy, the files. 2. If you have not already done so, do step 2 of “Connect the DEMO9S12NE64 to Your Computer and Apply Power” (connect serial cable). If you are using a different PC COM port, you will need to adjust the settings within the CodeWarrior IDE. Default COM port in CodeWarrior is set to COM1. 3. In the working folder, double click on the “Connector_App.mcp” project file. The CodeWarrior IDE will launch. 4. Open the main source file, “Main.c,” by double clicking it in the list of Files on the left side. 5. Click on “Make” under Project in the menu bar or hit “F7.” 6. This saves, compiles, etc. A list of errors and warnings should appear. There should be no errors. A trick: If the errors window does not appear, make a small code change (ex. type a space and <Bksp>) and retry. 7. Make sure the SW3 switch is set to position 0. Then press and release the RESET button on the DEMO board. 8. Click on “Debug” under Project in the menu bar or hit “F5.” The True-Time Simulator & Real-Time Debugger should initiate serial communications with the DEMO board. As soon as the debugger opens, the code currently in the MC9S12NE64’s Flash memory is erased and the newly compiled code is programmed in. The serial monitor code is not erased. 9. If the debugger does not open, refer to “Reasons Why the Debugger Won’t Open” of this guide. 10. Once the “Connector” software has been programmed to the MCU and no error messages appear, you are ready to run and debug in real time. Move the SW3 switch to position 1, and click on the green arrow (Start/ Continue button) in the Debugger window to begin running/debugging the code. 11. Conduct another ping test (refer to step 3 of “Set the PC’s IP address and the Ping Test” for details). The board’s IP address in the “Connector” demo game is set to 192.168.2.3 and the mask is 255.255.255.0. The serial monitor can be used for much more than just programming new code. Many debug operations (memory modify, breakpoints, real-time bug traces, etc.) can also be run over the serial cable while in this mode. Refer to application note AN2548 for more information on the serial monitor. Running the MC9S12NE64 Demo Game: “The Connector” This completes the quick start for your DEMO9S12NE64! Now that you have compiled and loaded the “Connector” game into the Flash memory of the MC9S12NE64 using the Serial Monitor, you are ready to play the game. The switches and analog input serve as controls. Click on “Connector.exe” on the MC9S12NE64 Resource CD, and enjoy! DEMO9S12NE64 Demo, Rev. 0.1 4 Freescale Semiconductor Troubleshooting Troubleshooting Reasons Why the Debugger Won’t Open • If a series of error notifications appear, the debugger may have launched when the board is not powered. Cancel these messages, close the debugger window, and power up the board before opening the debugger again. • You may not have installed the special edition license key for this version (3.1) of CodeWarrior (see the CodeWarrior Quick Start Guide included with the CodeWarrior CD provided). • If the debugger could not establish a connection, press the RESET button on the DEMO board, and retry. • The COM port on the PC may be in use by another application. If so, disconnect that application or connection. • SW3 switch may not be in the correct position (position 0 to Flash memory and position 1 to run program). Please check your steps. Reasons Why the Ping Test Might Fail • Ethernet cable may not be secure. • IP addresses or masks may not be set correctly. The mask is typically 255.255.255.0. To check the board’s and the PC’s IP addresses, you must install and open CodeWarrior and do the steps in “Set the PC’s IP address and the Ping Test.” • You may not have waited long enough for the PC to regain its IP settings. This shouldn’t take more than a minute and takes typically 1-20 seconds. DEMO9S12NE64 Demo, Rev. 0.1 Freescale Semiconductor 5 How to Reach Us: Information in this document is provided solely to enable system and software implementers to use Freescale Semiconductor products. There are no express or implied copyright licenses granted USA/Europe/Locations not listed: Freescale Semiconductor Literature Distribution P.O. Box 5405, Denver, Colorado 80217 1-800-521-6274 or 480-768-2130 hereunder to design or fabricate any integrated circuits or integrated circuits based on the information in this document. Freescale Semiconductor reserves the right to make changes without further notice to any products herein. Freescale Semiconductor makes no warranty, representation or guarantee regarding the Japan: Freescale Semiconductor Japan Ltd. SPS, Technical Information Center 3-20-1, Minami-Azabu Minato-ku Tokyo 106-8573, Japan 81-3-3440-3569 suitability of its products for any particular purpose, nor does Freescale Semiconductor assume any liability arising out of the application or use of any product or circuit, and specifically disclaims any and all liability, including without limitation consequential or incidental damages. “Typical” parameters which may be provided in Freescale Semiconductor data sheets and/or specifications can and do vary in different applications and actual performance may vary over time. All operating parameters, including “Typicals” must be validated for each customer application by customer’s technical experts. Asia/Pacific: Freescale Semiconductor H.K. Ltd. 2 Dai King Street Tai Po Industrial Estate Tai Po, N.T. Hong Kong 852-26668334 Freescale Semiconductor does not convey any license under its patent rights nor the rights of others. Freescale Semiconductor products are not designed, intended, or authorized for use as components in systems intended for surgical implant into the body, or other applications intended to support or sustain life, or for any other application in which the failure of the Freescale Semiconductor product could create a situation where personal injury or death may occur. Should Buyer purchase or use Learn More: For more information about Freescale Semiconductor products, please visit http://www.freescale.com Freescale Semiconductor products for any such unintended or unauthorized application, Buyer shall indemnify and hold Freescale Semiconductor and its officers, employees, subsidiaries, affiliates, and distributors harmless against all claims, costs, damages, and expenses, and reasonable attorney fees arising out of, directly or indirectly, any claim of personal injury or death associated with such unintended or unauthorized use, even if such claim alleges that Freescale Semiconductor was negligent regarding the design or manufacture of the part. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2004. Rev. 0.1, 06/29/2004