User Tools

Site Tools


lab1

Background information

Embedded Systems

An embedded system, as opposed to a general purpose computer, is a special purpose system in which the computer is completely encapsulated by or dedicated to the device or system it controls. Unlike a general purpose computer, such as a personal computer, an embedded system performs one or a few predefined tasks, usually with very specific requirements. Since the system is dedicated to specific tasks, design engineers can optimize it, reducing the size and cost of the product. Embedded systems are often mass produced, benefiting from economies of scale.

Usually intermediate developers face the following issues while working on embedded platforms:

  • Finding affordable hardware platform
  • Finding easy to follow and organized documentation
  • Finding open source and customizable compilers and assemblers
  • Finding a simple and affordable Integrated Development Environment (IDE)
  • Difficulties with testing, transferring and debugging code on target platform
  • Finding simple and understandable examples for hardware modules
  • Need of electrical knowledge and general understanding of target platform
  • Need of high tech and expensive equipments (i.e. precision oscilloscopes and logic analyzers)
  • Finding simple and affordable embedded operating system

Freescale Semiconductor Inc.

Freescale Semiconductor, Inc. is an semiconductor manufacturer created by the divestiture of the Semiconductor Products Sector of Motorola in 2004. Freescale focuses on the automotive, embedded and communications markets for their semiconductor products. Freescale is among the Worldwide Top 50 Semiconductor Sales Leaders.

The 68HC12 (6812 or HC12 for short) is a 16 bit micro-controller family from Freescale Semiconductor. Originally introduced in 1994, the architecture is an enhancement of the previous Freescale 68HC11. Programs written for the HC11 are usually compatible with the HC12, which has a few extra instructions. The first 68HC12 derivatives had a maximum bus speed of 8 MHz and flash memory sizes up to 128 KBytes.

Like the 68HC11, the 68HC12 has two 8 bit accumulators A and B (sometimes referred to as a single 16 bit register D), also two 16bit registers X and Y, a 16 bit program counter, a 16bit stack pointer and an 8 bit Condition Code Register.

Motorola has launched the new HCS12 (also known as MC9S12) product line in 2000. The bus speed was improved up to 25MHz and flash sizes up to 512 KBytes. The MC9S12NE64 was introduced by Freescale in September 2004, claiming to be the “industry's first single-chip fast-Ethernet Flash microcontroller.” It features a 25 MHz HCS12 CPU, 64 KBytes of FLASH EEPROM, 8 KBytes of RAM, and an Ethernet 10/100 Mbit/s controller. Since the HCS12 was a direct upgrade to the existing HC12 family, most of the links and information provided here are suitable for both lines.

Latest addition in 2004 was the advanced HCS12X, providing even more features, including the XGATE DMA co-processor. HCS12X is fully backward-compatible with HCS12 CPU. The S12X family utilizes the latest process technology. It boasts higher speed (40 MHz), more functionality, reduced power consumption and cost, and enhanced performance with the new XGATE on-chip memory-management and DMA module. The XGATE peripheral co-processor allows for some tasks to be offloaded from the CPU also allows several new instructions to increase performance.

Freescale announced the MC9S12XEP100 in May 2006 to further extend the S12X family to 50MHz bus speed and add a Memory protection unit (based on segmentation) and a hardware scheme to provide Emulated EEPROM.

Freescale HC1x platform has been around from 1990s which makes it affordable, well tested and stable candidates for embedded projects. Documentations can be downloaded free of charge from Freescale Semiconductor's website. GNU tool chain has been ported and tested on HC1x MCUs1). BDM features of HC12 series provide ease of transfer, testing and debugging codes to MCUs. We have decided to use HCS12 hardware as the host system for μC/OS.

Dragon12 Evaluation Board

Dragon12 is the name of the evaluation board made by evbplus.com. The board is using 9S12 family of Freescale 16-bit microcontrollers. Revision D of the Dragon12 board is using MC9S912DP256B processor with the following capabilities:

  • CAN controller
  • 16×2 LCD display module with LED backlight
  • it can be replaced by any size of LCD display module via a 16 pin cable assembly
  • 4-digit, 7-segment display module
  • Can be used to learn multiplexing techniques
  • 4 X 4 keypad
  • Eight LEDs connected to port B
  • An 8-position DIP switch connected to port H
  • Four pushbutton switches
  • IR transceiver with built-in 38KHz oscillator
  • RS485 communication port
  • speaker driven by timer, or PWM, or DAC for alarm, voice and music applications
  • Potentiometer trimmer pot for analog input
  • Dual SCIs with DB9 connectors
  • Dual 10-bit DAC for testing SPI interface and generating analog waveforms
  • I2C expansion port for interfacing external I2C devices
  • Fast SPI expansion port for interfacing external SPI devices
  • Abort switch for stopping program when program is hung in a dead loop
  • MC9S12DP256 MCU includes the following on-chip peripherals:
    • 3 SPIs
    • 2 SCIs
    • 2 CANs
    • I2C interface
    • 8 16-bit timers
    • 8 8-bit PWMs or 4 16-bit PWMs
    • 16-channel 10-bit A/D converter
  • Bus speed up to 25 MHz
  • The 112-Pins on-board MCU (MC9S12DP256B) with 89 I/O-Pins is included
  • BDM-in connector to be connected with a BDM from multiple vendors for debugging.
  • BDM-out connector for making this board as a HCS12 / 9S12 BDM or programmer.
  • PC board size 8.4“ X 5.3”

Evaluation

Demonstrate your program to your T.A.

Procedure

In this lab we are going to make a simple C program to turn on the LEDs on the 7-segment display module of Dragon12 board. The 7-segment display is connected to PORTB of microprocessor. We will use Data Direction Register for Port B (DDRB) to mark all the Port B's pins to output. This can be done by calling DDRB = 0xff

  • Launch the Freescale CodeWarrior IDE. The shortcut may look like: icon.jpg
  • Start a new project and use the following settings:

setting1.jpg setting2.jpg

  • We will use Data Direction Register for Port B (DDRB) to mark all the Port B's pins to output which can be done by calling DDRB = 0xff. On the main.c file add the following:
DDRB=0xff;
PORTB=0x5e; // sample value just to turn some of the LEDs on

code1.jpg

  • To compile the project use: icon2.jpg
  • To upload the compiled program to the board use: icon3.jpg
    • Make sure the board is powered up and connected to serial port on the PC (COM1). Please use only the top-left serial port as shown in the picture below. board1.jpg
    • If it is the first time you are running the the program you may need to setup the PC's serial port: setting3.jpg
  • Please demonstrate the program to your TA and make sure to understand how use the simulation and debugging tools as shown in the above picture.

Reference Manuals

Please note all the drivers to run the subsystems of the Dragon12 board will be provided and you don't need to write any driver code. However, in case you want to look at the official manuals of MC9S12DG256B they can be found in the course directory or on-line at http://gcc-hcs12.com/documnets/Freescale/motorolaindex.html

lab1.txt · Last modified: 2010/02/24 17:14 by natalia