Advertisement

Quick Links

S12compact
Hardware Version 1.10
User Manual
July 4 2008

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the S12compact and is the answer not in the manual?

Questions and answers

Summary of Contents for Elmicro S12compact

  • Page 1 S12compact Hardware Version 1.10 User Manual July 4 2008...
  • Page 2 S12compact Copyright (C)2002-2008 by ELMICRO Computer GmbH & Co. KG Hohe Str. 9-13 D-04107 Leipzig, Germany Tel.: +49-(0)341-9104810 Fax: +49-(0)341-9104818 Email: leipzig@elmicro.com Web: http://elmicro.com This manual and the product described herein were designed carefully by the manufacturer. We have made every effort to avoid mistakes but we cannot guarantee that it is 100% free of errors.
  • Page 3: Table Of Contents

    User Manual Contents 1. Overview ..........
  • Page 4 S12compact ....... . . A/D-Converter (ADC) ....... . .
  • Page 5: Overview

    User Manual 1. Overview The S12compact is a versatile controller module based on the HCS12 16-bit microcontroller family from Motorola. It combines compact size (Half-Euro form factor, 80mm x 100mm) with powerful computing features and a rich set of peripherals. The controller module can be used for a wide range of applications, e.g.
  • Page 6: Optional Components

    S12compact w 2x SCI - asynch. serial Interface (e.g. RS232, LIN) w 3x SPI - synch. serial Interface w 1x IIC - Inter-IC-Bus w 5x msCAN-Module (CAN 2.0A/B-compatible) w 8x 16-Bit Timer (Input Capture/Output Compare) w 8x PWM (Pulse Width Modulator)
  • Page 7: Package Contents

    User Manual Package Contents w Controller Module (with options as ordered) w TwinPEEKs Monitor program (in the MCU's Flash Memory) w RS232 Cable (Sub-D9) w USB Cable (only for option /USB) w set of header connectors (two 72-pin male headers) w User Manual (this document) w Schematic Diagrams w CD-ROM: contains assembler software, data sheets, CPU12...
  • Page 8: Quick Start

    +5V on X4 pin 72 w Check voltage and polarity before making the connection! w Once powered up, the Monitor program will start, display a message and await your commands. We hope you will enjoy working with the S12compact Controller Module!
  • Page 9: Parts Location Diagram

    User Manual 3. Parts Location Diagram Place Plan - Component Side...
  • Page 10 S12compact Solder Bridges on the solder side of the PCB...
  • Page 11: Jumpers And Solder Bridges

    User Manual 4. Jumpers and Solder Bridges Jumpers There are no jumpers on the S12compact. Solder Bridges On the solder side of the module, the following solder bridges can be found: BR1: VRH open external supply of VRH required closed*...
  • Page 12 S12compact BR7: R2OUT open Port pin PM2 freely available closed* PM2 connected to RS232 Transceiver IC3 BR8: TPOUT open* TPOUT and /IRQ not connected closed TPOUT connected to /IRQ, Real Time Clock IC7 can issue an interrupt BR9: VREF open...
  • Page 13: Mechanical Dimensions

    User Manual 5. Mechanical Dimensions The following table summarizes the mechanical dimensions of the S12compact. The values provide a basis for the design of carrier boards etc. Please note: Always check all mechanical dimensions using the real hardware module! The reference point (0,0) is located at the "south/west" corner of the PCB.
  • Page 14: Circuit Description

    6. Circuit Description Schematic Diagram To ensure best visibility of all details, the schematic diagram of the S12compact controller module is provided as a separate document. Controller Core, Power Supply The nominal operating voltage of the MC9S12DP512 is 5V. This MCU (IC1) has three supply pin pairs: VDDR/VSSR, VDDX/VSSX and VDDA/VSSA.
  • Page 15: Reset Generation

    User Manual bridge BR1. This can be useful if the main supply is not in the desired tolerance band or if the ATD should work with a reference value lower than 5V. VRH must not exceed VDDA, regardless of the selected supply mode.
  • Page 16: Clock Generation And Pll

    The MC9S12DP512 uses a Colpitts oscillator with translated ground scheme. The main advantage is a very low current consumption, though the component selection is more critical. The S12compact circuit uses a 16MHz automotive quartz from NDK together with two load capacitors of only 3.9pF. Furthermore, special care was taken for the PCB design to introduce as little stray capacitance as possible in respect to XTAL and EXTAL.
  • Page 17: Operating Modes, Bdm Support

    MC9S12DP512 if the internal oscillator and PLL are disabled by apply- ing a low level to the /XCLKS pin during reset. Since this option is not used on the S12compact Controller Module, R5 is used to pull /XCLKS high. Please note, that other HCS12 derivatives will have different features associated with the /XCLKS pin.
  • Page 18: Integrated A/D-Converter

    Each module (ATD0, ATD1) provides eight multiplexed input channels. VRH is the upper reference voltage for all A/D-channels. On the S12compact, VRH is connected to VDDA (5V) through solder bridge BR1. After opening BR1, it is possible to use an external reference volta- ge, which has to be applied to X5/46.
  • Page 19 User Manual routine. The source file S12_ATD.C also contains some additional functions for the integrated ATD module. //============================================================================= // File: S12_ATD.C - V1.00 //============================================================================= //-- Includes ----------------------------------------------------------------- #include "datatypes.h" #include <mc9s12dp512.h> #include "s12_atd.h" //-- Code --------------------------------------------------------------------- // Func: Initialize ATD module // Args: - // Retn: - void initATD0(void) {...
  • Page 20: Integrated Eeprom

    S12compact Integrated EEPROM The internal EEPROM module of the MC9S12DP512 contains 4KB of memory. It consists of 1024 sectors with 4 bytes (32 bits) per sector. For erasure, any single sector can be selected. Programming is done by words (2 bytes). Read accesses can be made to any word or byte.
  • Page 21 User Manual //============================================================================= // File: S12_EETS.C - V1.00 //============================================================================= //-- Includes ----------------------------------------------------------------- #include "datatypes.h" #include <mc9s12dp512.h> #include "s12_eets.h" //-- Code --------------------------------------------------------------------- void initEETS(void) { ECLKDIV = EETS_ECLKDIV; // set EEPROM Clock Divider Register //----------------------------------------------------------------------------- INT8 wrSectEETS(UINT16 *dest, UINT16 *src) { // check addr: must be aligned 32 bit if((UINT16)dest &...
  • Page 22: Indicator-Led

    MC9S12DP512. High level activates the integrated Colpitts oscillator. After reset, PE7 can be used as a general-purpose I/O-pin. On the S12compact, this signal is used to control the indicator LED D2, driven by buffer IC6C.
  • Page 23 User Manual //============================================================================= // File: ACPRD_FREQOUT.C - V1.00 //============================================================================= //-- Includes ----------------------------------------------------------------- #include "datatypes.h" #include <mc9s12dp512.h> #include "s12_ect.h" #include "s12_crg.h" // contains S12_ECLK value #include "acprd_freqout.h" //-- Static Vars -------------------------------------------------------------- UINT16 freqout_tticks; //-- Code --------------------------------------------------------------------- void initFreqOut(void) { // make sure timer is enabled TSCR1 |= BM_TEN;...
  • Page 24: Rs232 Interface

    MCU pins can be used freely after opening the four solder bridges BR4..BR7. To connect the S12compact to a PC, a 10-wire flat ribbon cable can be used. The cable must have a 10-pin female header connector at the S12compact side (X2) and a female Sub-D9 connector at the PC side.
  • Page 25: If-Module Connection

    X3 using a 10-wire flat ribbon cable. The I/O signals PM4..7 are associated to SCI1 as handshake lines on the S12compact. If there is no IF-Module on X3 and also the USB option is not present, these signals (including RXD1 and TXD1) can be used as general-purpose I/Os.
  • Page 26 S12compact implemented. The MCU can read the /RTS output using port pin PM6, while PM7 controls the /CTS input of the USB-UART. Transmit- and receive-activities can be displayed using two LEDs. Their anodes must be wired to VCC (5V), while the cathodes have to be connected to /RXLED and /TXLED (X4/67+68), respectively.
  • Page 27: Spi Subsystem

    SPI0 consists of four individual signals: MISO, MOSI, SCK and /SS (MCU port pins PS4 to PS7). The slave select signal /SS is not in use on the S12compact, though it can be accessed on the side header connectors. The SPI chip select signals are derived from MCU port pins PH[4..6].
  • Page 28: Extra Ports Parin And Parout

    S12compact //============================================================================= // File: S12_SPI.C - V1.01 //============================================================================= //-- Includes ----------------------------------------------------------------- #include "datatypes.h" #include <mc9s12dp512.h> #include "s12_spi.h" //-- Code --------------------------------------------------------------------- void initSPI0(UINT8 bauddiv, UINT8 cpol, UINT8 cpha) { DDRS |= 0xe0; // SS,SCK,MOSI Output SPI0BR = bauddiv; // set SPI Rate // enable SPI, Master Mode, select clock polarity/phase SPI0CR1 = BM_SPE | BM_MSTR | (cpol ? BM_CPOL : 0) | (cpha ? BM_CPHA : 0);...
  • Page 29: Real Time Clock (Rtc)

    User Manual //----------------------------------------------------------------------------- void putSPIPO(UINT8 abyte) { // set up SPI mode SPI0CR1 = BM_SPE | BM_MSTR; // CPOL=0 CPHA=0 // send data PTH = S12CO_SPICS5; // enable /CS5 xferSPI0(abyte); PTH = S12CO_SPICSH; // disable /CS5 //----------------------------------------------------------------------------- Using the same SPI port, IC8 provides eight additional input pins. Two chip selects (/SPICS3 and /SPICS4) are needed to latch the input information coming from PI0..PI7 and to shift out data via MISO respectively.
  • Page 30 // transfer data PTH = S12CO_SPICS0_WR; // enable /CS0 (writing) xferSPI0((data << 4) | (regno & 0x0f)); PTH = S12CO_SPICSH; // disable all /CSx //----------------------------------------------------------------------------- On the S12compact, the RTC (including BT1) is an optional component (not included in the standard version).
  • Page 31: A/D-Converter (Adc)

    ADC (delivered by IC4). IC10 is a precision voltage reference, delivering 4.096V for the ADC and the DAC on the S12compact. This reference voltage determi- nes the maximum limit for the analog inputs AIN0..AIN7. The lower limit is ground (0V). After opening solder bridge BR9, an external reference voltage can be used instead of IC10 (note: influence on DAC IC12).
  • Page 32: D/A-Converter (Dac)

    S12compact On the S12compact, the ADC is an optional component (not inclu- ded in the standard version). D/A-Converter (DAC) The 16-bit D/A-Converter (IC12) is a DAC8532 from Burr Brown. This device contains two output channels (VOUTA, VOUTB), which can be set either simultaneously or individually.
  • Page 33: Serial Data Flash (Sdf)

    User Manual Serial Data Flash (SDF) The Serial Data Flash (SDF) on the S12compact allows to store a large amount (up to 2MB / 16Mbit) of data, arriving sequentially at high rates. This is often the case for data logger applications.
  • Page 34: Iic-Bus

    IIC software emulation is obsolete. For the two IIC-Bus signals (SDA, SCL), pull-up resistors are required. They can be soldered in directly on the S12compact PCB (R10, R11) or they can be added externally. The following listing shows a simplified Master Mode implementa-...
  • Page 35 User Manual // Func: Issue IIC Restart Condition // Args: - // Retn: - void restartIIC(void) { IBCR |= BM_RSTA; // issue RESTART condition //----------------------------------------------------------------------------- // Func: Issue IIC Stop Condition // Args: - // Retn: - void stopIIC(void) { IBCR = BM_IBEN;...
  • Page 36: Can Interface

    IC5 in High Speed mode, R9 must be shorted (refer to the PCA82C251 data sheet for details). R8 is a termination resistor, required if the S12compact is the last node in a CAN bus chain. BR2 should be closed in this case, otherwise opened.
  • Page 37 User Manual //============================================================================= // File: S12_CAN.C - V1.01 //============================================================================= //-- Includes ----------------------------------------------------------------- #include "datatypes.h" #include <mc9s12dp512.h> #include "s12_can.h" //-- Defines ------------------------------------------------------------------ //-- Variables ---------------------------------------------------------------- //-- Code --------------------------------------------------------------------- // Func: initialize CAN // Args: - // Retn: - // Note: - void initCAN0(UINT16 idar, UINT16 idmr) { CAN0CTL0 = BM_INITRQ;...
  • Page 38: Bus Interface

    //============================================================================= Bus Interface The MCU ports A, B, K and (partly) E are related to the Multiple- xed External Bus Interface (MEBI). On the S12compact, all bus signals are accessible via two header connectors (X7, X8; not mounted by default).
  • Page 39: Application Hints

    MCU reads the Interrupt Vector at memory address $FFFE/F and then jumps to the address found there. In the default delivery condition of the S12compact, the Flash module of the MCU contains Motorola's Monitor Program D-Bug12. The reset vector points to the start of this Monitor Software. As a result, the monitor will start immediately after reset.
  • Page 40: Twinpeeks Monitor

    S12compact 8. TwinPEEKs Monitor Software Version 2.3 Serial Communication TwinPEEKs communicates over the first RS232 interface ("SER0", X3) at 19200 Baud. Settings are: 8N1, no hardware or software hand- shake, no protocol. Autostart Function After reset, the TwinPEEKs monitor checks, whether port pins PE5 (MODA) and PE6 (MODB) are connected (X1B pins 1+2).
  • Page 41: Redirected Interrupt Vectors

    User Manual would require a second write access to the same (word) address - which is not allowed. As a consequence, a write error ("not erased") will be issued. To avoid this problem, it is necessary to align all S-Record data before programming.
  • Page 42 S12compact The following assembly listing is part of the monitor program. It shows the original vector addresses (1st column from the left) as well as the redirected addresses in RAM (2nd column): FF80 : 3F43 dc.w TP_RAMTOP-189 ; reserved FF82 : 3F46 dc.w...
  • Page 43: Usage

    User Manual Usage A TwinPEEKs command is comprised by a single character, follo- wed by a number of arguments (as required). All numbers are hexadeci- mal numbers without prefix or suffix. Both, upper and lower case letters are allowed. The CPU's visible address range is 64KB, therefore address arguments are not longer than 4 digits.
  • Page 44 S12compact Edit Memory Syntax: E [addr {byte}] Edit memory contents. In the command line, the start address addr can be followed by up to four data bytes {byte}, thus allowing byte, word and doubleword writes. The write access will be performed immediately and then the function will return to the input prompt.
  • Page 45 User Manual System Info Syntax: I Display system information. This includes address range of register block, RAM, EEPROM and Flash, and the MCU identifier (PARTID). Load Syntax: L Load an S-Record file into memory. Data records of type S1 (16-bit MCU addresses) and S2 (linear 24-bit addresses) can be processed.
  • Page 46 S12compact Select PPAGE Syntax: P [page] Select a program page (PPAGE). This page will become visible in the 16KB page window from $8000 to $BFFF. Erase Flash Syntax: X [page] Erase one page (16KB) of Flash memory. If page is not specified, the whole Flash memory (ex. monitor code space) will be erased after user confirmation.
  • Page 47: Memory Map

    User Manual 9. Memory Map The memory map of the microcontroller is initialized by the TwinPEEKs monitor as follows (Note: partly different from reset default values!): S12compact.DP512 Begin Ressource $0000 $03FF Control Registers 1KB (of total 4KB) EEPROM $0400 (the area below $0400 is hidden by control registers,...

Table of Contents