Sei sulla pagina 1di 41

Internship report Nguyen Huynh Phuong Bao

VIETNAM NATIONAL UNIVERSITY HO CHI MINH CITY INTERNATIONAL UNIVERSITY SCHOOL OF ELECTRICAL ENGINEERING

----------oOo----------

INTERNSHIP REPORT
TOPIC:

INTRODUCTION TO THE RENESAS H8 FAMILY AND INVESTIGATING THE RENESAS STARTER KIT FOR H8SX1582 MICROCONTROLLER
ADVISOR: Full name: Dr. PHAM TUONG HAI Advisor Training Center Renesas Design Vietnam Co., Ltd. CONSULTANT: Full name: Dr. MAI LINH School of Electrical Engineering International University Vietnam National University STUDENT: Full name: Class: NGUYEN HUYNH PHUONG BAO EE08IU1 EEIU08004

Ho Chi Minh City, Vietnam 2011


1

Internship report Nguyen Huynh Phuong Bao

REMARK OF DR. PHAM TUONG HAI: ............................................................................................................................ ............................................................................................................................ ............................................................................................................................. ............................................................................................................................. ............................................................................................................................. ............................................................................................................................. ............................................................................................................................. ............................................................................................................................. ............................................................................................................................. ............................................................................................................................. ............................................................................................................................. ............................................................................................................................. ............................................................................................................................. ............................................................................................................................. ............................................................................................................................. .............................................................................................................................

Internship report Nguyen Huynh Phuong Bao

REMARK OF DR. MAI LINH: ............................................................................................................................. ............................................................................................................................. ............................................................................................................................. ............................................................................................................................. ............................................................................................................................. ............................................................................................................................. ............................................................................................................................. ............................................................................................................................. ............................................................................................................................. ............................................................................................................................. ............................................................................................................................. ............................................................................................................................. ............................................................................................................................. ............................................................................................................................. ............................................................................................................................. .............................................................................................................................

Internship report Nguyen Huynh Phuong Bao

ACKNOWLEDGMENT
August 9th, 2011 Dr. Pham Tuong Hai Advisor Training Center Renesas Design Vietnam Co., Ltd. Lot W.29-30-31a, Tan Thuan Rd., Tan Thuan EPZ, District 7, Ho Chi Minh City, Vietnam Dr. Mai Linh School of Electrical Engineering International University Vietnam National University Dear Dr. Hai and Dr. Linh, I would like to take this opportunity to thank you for your guidance and supervision this summer during my internship experience with Renesas Design Vietnam Company, especially the Training Center. Your leadership throughout the summer assisted me in further development of my working and communications skills as well as my ability to implement individual and final projects. Working for Renesas Design Vietnam helped me use the knowledge I have acquired over the past three years as college students. I also want to thank the entire staffs in the Training Center, G&A area, as well as all of the Internship students for taking the time to share their expertise and knowledge of the field. It was through these times that I felt I was able to learn and grow the most in developing my skills over the course of the summer. The staff was most responsive to my requests and always made me feel like fulltime member of the group. The Internship students from different universities, especially those from Group 4, have helped me, encouraged me to overcome obstacles, given me a change to cooperate and build a friendly working environment and even a friendship. I also give a thank Dr. Mai Linh for all necessary formalities and enthusiastic help through my summer internship.

Sincerely, Nguyen Huynh Phuong Bao

Internship report Nguyen Huynh Phuong Bao

TABLE OF CONTENTS
I. INTRODUCTION TO RENESAS CORPORATION .................................................................. 6 I.1. Renesas Electronics Corporation .................................................................................................. 6 I.2. Renesas Design Vietnam............................................................................................................... 6 II. SUMMARY OF THE INTERNSHIP ............................................................................................ 7 II.1. Internship information .................................................................................................................. 7 II.2. Internship objectives ..................................................................................................................... 7 III. INTERNSHIP PLANNING ............................................................................................................ 8 III.1. Internship general schedule ........................................................................................................ 8 III.2. Individual task and result ........................................................................................................... 8 III.3. Group project plan ( July 4th to August 12th ) ......................................................................... 10 IV. RENESAS H8 FAMILY OF MICROCONTROLLERS ............................................................ 11 IV.1. Overview of H8 microcontroller family .................................................................................. 11 IV.2. Main features of H8 MCUs ...................................................................................................... 11 IV.2.1. Fully upward compatible ................................................................................................ 11 IV.2.2. Faster execution times..................................................................................................... 12 V. RENESAS H8SX SERIES OF MICROCONTROLLER .......................................................... 13 V.1. Overview of H8SX series of MCU features ............................................................................. 13 V.2. Features of H8SX1582 microcontroller ................................................................................... 15 VI. RENESAS STARTER KIT FOR H8SX1582 .............................................................................. 17 VI.1. Schematics and Board Layout .................................................................................................. 17 VI.1.1. Board Layout overview ................................................................................................... 17 VI.1.2. Power supply: .................................................................................................................. 18 VI.1.3. Switches .......................................................................................................................... 19 VI.1.4. LEDs ............................................................................................................................... 19 VI.1.5. Potentiometer .................................................................................................................. 20 VI.1.6. Serial port ........................................................................................................................ 20 VI.1.7. LCD module.................................................................................................................... 21 VI.1.8. Reset circuit .................................................................................................................... 22 VI.2. RSK H8SX1582 tutorial manual .............................................................................................. 23 VI.2.1. Introduction ..................................................................................................................... 23 VI.2.2. Usage preparation ........................................................................................................... 23 VI.2.3. Creating new project using HEW ................................................................................... 23 VI.2.4. Building tutorial project .................................................................................................. 25 VI.3. Small application examples for the Starter Kit......................................................................... 31 VI.3.1. Introduction to HEW, FDT and HMon ........................................................................... 31 VI.3.2. Standard project files ...................................................................................................... 32 VI.3.3. Demonstrative code for Starter Kit peripherals .............................................................. 34 VII.DEVELOP SIMPLE DIGITAL WATCH ON H8SX1582 STARTER KIT .............................. 38 VII.1. Features .................................................................................................................................. 38 VII.2. Specifications ......................................................................................................................... 38 VII.2.1. Modes .............................................................................................................................. 38 VII.2.2. Inputs/ Outputs ................................................................................................................ 38 VII.3. Operation modes .................................................................................................................... 38 VII.3.1. Clock mode ..................................................................................................................... 38 VII.3.2. Alarm mode .................................................................................................................... 39 VII.3.3. Chronometer mode.......................................................................................................... 40 LIST OF REFERENCES ..................................................................................................................... 41

Internship report Nguyen Huynh Phuong Bao

I. INTRODUCTION TO RENESAS CORPORATION


I.1. Renesas Electronics Corporation
Renesas Electronics Corporation is a Japanese semiconductor manufacturer. The company started its operation in April 2010, through a merger between NEC Electronics Corporation and Renesas Technology. Its former company, Renesas Technology was established on April 2003, as a joint venture of Hitachi Ltd. and Mitsubishi Electric. Renesas is one of the world's largest manufacturers of semiconductor systems for mobile phones and automotive applications. It is the world's largest manufacturer of microcontrollers and the second largest manufacturer of application processors. Renesas is also known for LCD drivers, RF ICs, mixed-signal integrated circuit and system-on-a-chip (SoC) semiconductors. Headquarter: President: Major fields: Employees: Nippon Bldg., 2-6-2, Ote-machi, Chiyoda-ku, Tokyo 100-0004, Japan. Yasushi Akao. Research, development, design, manufacture, and sale of semiconductor products. 46,000 (consolidated).

Group companies:

In Japan:

2 Sales Companies 17 Manufacturing and Engineering Service Companies 4 Design and Application Technologies Companies 3 Business Corporations and Others

Overseas:

11 Sales Companies 8 Manufacturing and Engineering Service Companies 7 Design and Application Technologies Companies (including Renesas Design Vietnam Co., Ltd.)

12 Business Corporations and Others

I.2. Renesas Design Vietnam


Renesas Design Vietnam Co., Ltd. (abbr. RVC) was established in October 2004, as one of the main centers for developing sophisticated multifunction System-on-Chips (SoCs) with a high level of design capability. Some of the projects the RVC engineers have already completed are verification work on SuperH CPU cores, design of IP modules such as video I/O and USB modules, SH-Mobile product development, and the development of digital TV software.

Internship report Nguyen Huynh Phuong Bao

In Vietnam, the company is contributing to the advancement of LSI technology and the growth of the high-tech industry in many ways. These include employment of local engineers at RVC, ongoing technical training, the establishment of semiconductor design courses at universities, and activities to provide technology education for students such as the annual summer internship program since 2009.

President: Business fields:

Mr. Tomoru Sato. General system LSI design operations, including hardware design, software design, logic verification, evaluation, incidental operations related to design.

Employees: Address:

600 (approximately). Lot W. 29-30-31a, Tan Thuan Road, Tan Thuan Export Processing Zone, District 7, Ho Chi Minh City, Vietnam.

Figure 1.1: Renesas Design Vietnam building

II. SUMMARY OF THE INTERNSHIP


II.1. Internship information
Duration: June 27th to August 12th 2011. Working hour: 8:00 to 17:00, from Monday to Friday. Company: Address: Renesas Design Vietnam Co., Ltd. Lot W. 29-30-31a, Tan Thuan Road, Tan Thuan Export Processing Zone, District 7, Ho Chi Minh City, Vietnam.

II.2. Internship objectives


1. Do research on H8 family, H8SX series and the H8SX1582 microcontroller by reading the technical documents.

Internship report Nguyen Huynh Phuong Bao

2. Group individual project: Investigating the Renesas Starter Kit for H8SX1582 microcontroller. My task is, in cooperation with other members, understand and develop example for the built-in peripherals on the kit (e.g. LCD, LEDs, switches), in order to get information about them for the final project. 3. Final project: Develop a simple watch, in which include some simple functions like date and time display, alarm mode and chronometer using the Renesas Starter Kit. I, myself, was assigned to investigate the changing between modes and act as the 2nd person in charge of the alarm mode. 4. Experienced in an industrial professional working environment. 5. Opportunity to apply knowledge from university into practical problems. 6. Improve soft skills such as English, communication, presentation, project management, etc.

III. INTERNSHIP PLANNING


III.1. Internship general schedule
8:00 8:30 Monday Tuesday Wednesday Thursday Friday Morning meeting Morning meeting Morning meeting Morning meeting Morning meeting 8:30 10:30 10:30 11:30 11:30 12:30 LUNCH LUNCH LUNCH LUNCH LUNCH 12:30 17:00 Follow up meeting Group meeting/ Study Group meeting/ Study Group meeting/ Study Presentation 17:00 17:10 Daily report Daily report Daily report Daily report Daily report

Group meeting/ Study Group meeting/ Study Lecture/ Study Group meeting/ Study

Group meeting/ Study Group meeting/ Study

III.2. Individual task and result


Task Person In Charge Result/Product

Week 1 ( Jun 27th to Jul 1st ) : INTRODUCTION AND LEADER ASSIGNMENT Welcome message from RVC Introduction to working environment and policies. Project Management Training Mr. Cang Tran, Mr. Noguchi, Dr. Hai Pham and HR staffs Dr. Hai Pham Understand Understand

Internship report Nguyen Huynh Phuong Bao

Lecture: English Training

Mr. Van Pham

Understand

Presentation: H8 Family and H8SX1582 13 slides micro-controller Week 2 ( Jul 4th to Jul 8th ): ORIENTATION & OVERVIEW Group assignment Researching on Renesas Starter Kit (quick start guide, tutorial manual) Lecture: C Programming Course Investigating the Starter Kit built-in peripherals, develop example. Lecture: HEW Introduction Continue investigating the Starter Kit for H8SX1582, develop example code. Lecture: LSI Design Flow Final project announcement Final Project Planning Presentation: RSK for H8SX1582 usage tutorial Investigate I/O port, interrupt and timer of H8SX1582 microcontroller Final project specification Dr. Hai Pham Understand. Ms. Ha Nguyen Dao Understand 14 pages of reference material Understand Example code for peripherals Understand Understand Understand 24 slides

Week 3 ( Jul 11th to Jul 15th ) : GROUP PROJECT RESEARCH

Mr. Thang Nguyen

Week 4 ( Jul 18th to Jul 22nd ): GROUP PROJECT RESEARCH ( cont'd )

Mr. Nguyen Ngo Dr. Hai Pham All group members

Week 5 ( Jul 25th to Jul 29th ): FINAL PROJECT SPECIFICATION Understand All group members Understand

Week 6 ( Aug 1st to Aug 5th ): FINAL PROJECT PROGAMMING Responsibility for the mode changing issue. Finished 2nd person in charge of the alarm mode Lecture: Essential Competence as SW Mr. Vuong Cap Understand Engineer Week 7 ( Aug 8th to Aug 12th ): COMPLETING FINAL PROJECT Watch functions combination Lecture: Essential Competence as SW Engineer (cont'd) Presentation: Simple watch using Starter Kit for H8SX1582 microcontroller All group member Mr. Vuong Cap All group members Finished Understand Finished

END OF THE INTERNSHIP

Internship report Nguyen Huynh Phuong Bao

III.3. Group project plan (July 4th to August 12th )

Week 2 ( July 4th to July 8th )


Received group individual project. Assigned tasks to group members. Skim the documents.

Week 3 (July 11th to July 15th )


Investigate the Starter Kit (board schematics and layout) Read Starter Kit documents. Started developing example applications. Presentation on Starter Kit board layout and schematics.

Week 4 (July 18th to July 22nd )


Received final project requirement. Finished developing demo example. Presentation on Starter Kit board layout and schematics. Set up plan for final project.

Week 5 (July 25th to July 29th )


HMon investigation. Specified final project specifications. Assigned task for final project to group members. Presentation on HMon.

Week 6 (August 1st to August 5th )


Completed investigate HMon. Implement the operation modes for digital watch. Presentation on HMon (cont'd).

Week 7 (August 8th to August 12th )


Merged and verified code for final project. Release user manual for the digital watch. Presentation on final project.

10

Internship report Nguyen Huynh Phuong Bao

Individual project: INVESTIGATE THE H8 FAMILY, H8SX SERIES and H8SX1582 MICROCONTROLLER
IV. RENESAS H8 FAMILY OF MICROCONTROLLERS
IV.1. Overview of H8 microcontroller family
The H8 microcontroller (MCU) family encompasses a wide range of devices, from 8-bit lowcost, super-low-power, low-pin-count MCUs to 32-bit high-performance devices. Upward code compatibility is maintained in the various H8 MCU series.

Figure 4.1: The H8 Family Roadmap Renesas MCUs in the H8 family are ideal for low-power, high-performance embedded systems in consumer, industrial, medical, communication and automotive applications.

IV.2. Main features of H8 MCUs


IV.2.1. Fully upward compatible All of the H8 central processing units (CPUs) are designed base on the Complex Instruction Set

11

Internship report Nguyen Huynh Phuong Bao

Computation (CISC) platform. CISC-based computer allows single instruction can execute several low-level operations (such as a load from memory, an arithmetic operation, and a memory store) and are capable of multi-step operations or addressing mode within single instruction. Since designed from the same base, H8 MCUs are developed to allow compatibility up and down the H8 series. In addition, the next generation of H8 family also inherits and enhances the register set from its precedents, allowing fully upward compatibility

Figure 4.2: Upward compatibility in instruction and register sets IV.2.2. Faster execution times

Besides maintaining the compatibility between different series, the H8 CPUs have been optimized for achieving high performance. Most of the CISC-based instructions are executed in a one clock cycle. Moreover, the CPU cores also include enhanced multipliers and dividers to boost the mathematical operations. Especially, for the H8S/2600 and H8SX CPU cores, each have a hardware MAC (Multiply and Accumulate) block for extra performance in applications that involve data computations.

12

Internship report Nguyen Huynh Phuong Bao

Figure 4.3: H8 CPUs performance speed

V. RENESAS H8SX SERIES OF MICROCONTROLLER


The H8SX CPU is a high-speed CPU with an internal 32-bit architecture that is upward compatible with the H8/300, H8/300H, and H8S CPUs. The H8SX CPU has sixteen 16-bit general registers, can handle a 4 GB linear address space, and is ideal for a real time control system.

V.1. Overview of H8SX series of MCU features


Improve the operation frequency with the maximum rate at 50MHz. Sixteen 16-bit general registers, can be used as sixteen 8-bit or eight 32-bit registers. Architecture for the ease of use

Vector base register (VBR): modify the address of vector table to improve interrupt response.

Short-address base register (SBR): modify the position of 8-bit absolute address space for improving external I/O response.

13

Internship report Nguyen Huynh Phuong Bao

Figure 5.1: H8SX CPU registers

Improved code efficiency and higher speeds


New instructions and addressing modes have been added for improving code efficiency. 32-bit-wide bus shortens the instruction-execution cycle. Twice as fast as the H8S for a given level of CPU performance.

High-speed operation with most instructions executed in one or two states. Four CPU operation modes

Normal mode. Middle mode. Advance mode.


14

Internship report Nguyen Huynh Phuong Bao

Maximum mode.

Inherit and enhance instruction set of previous H8 MCU series


87 instructions. 11 addressing modes.

V.2. Features of H8SX1582 microcontroller

32-bit high-speed H8SX CPU


48 MHz of operation speed. Upward compatible with the H8/300 CPU, H8/300H CPU, and H8S CPU. Sixteen 16-bit general registers. 87 basic instructions.

Extensive peripheral functions


DMA controller (DMAC). Data transfer controller (DTC). 16-bit timer pulse unit (TPU). Programmable pulse generator (PPG). Watch dog timer (WDT). Serial communication interface (SCI) can be used in asynchronous and clocked synchronous mode.

Synchronous serial communication unit (SSU). 10-bit A/D converter. Clock pulse generator.

On-chip memory

256 Kb of Flash ROM memory. 12 Kb for Random Access Memory (RAM).

General I/O port


82 input/ output ports. 17 input ports.

Small package

Size: 14 x 14 mm. 120 pins. Pin pitch: 0.40 mm.

15

Internship report Nguyen Huynh Phuong Bao

Figure 5.2: Pin assignment

16

Internship report Nguyen Huynh Phuong Bao

Group project: INVESTIGATE THE RENESAS STARTER KIT for H8SX1582 MICROCONTROLLER
VI. RENESAS STARTER KIT FOR H8SX1582
The Renesas Starter Kit (RSK) is an evaluation tool provided by Renesas Electronics for the company microcontrollers. The tool includes features such as Renesas Microcontroller Programming, User Code Debugging, User circuitry, Sample application and Sample peripheral device initialization code. The CPU board also contains all the circuitry required for microcontroller operations.

Figure 6.1: Renesas Starter Kit for H8SX1582

VI.1. Schematics and Board Layout


VI.1.1. Board Layout overview The board includes 5 main blocks:

Power supply. Microcontroller. User circuitry.

17

Internship report Nguyen Huynh Phuong Bao

E8 Header. Application board interface and Microcontroller headers.

Figure 6.2: Block diagram of the H8SX1582 Starter Kit VI.1.2. Power supply:

The Starter kit operates from a 5V power supply. The power supply circuit contains a diode in order to prevent reverse polarity problem. The CPU can be powered directly through the E8 emulator or optionally from center positive supply connector by using 2-mm barrel power jack built-in the board. The maximum current can be provided by the E8 debugger for the CPU board is 300 mA.

Figure 6.3: Power supply circuit

18

Internship report Nguyen Huynh Phuong Bao

VI.1.3.

Switches

Renesas provides user 4 available switches on the CPU board.


Reset switch (RES). Three user switches (SW1, SW2 and SW3) for interrupt control or I/O function.

Table 6.1: Switch functions VI.1.4. LEDs

There are 6 LEDs on board


Green POWER LED. Orange BOOT LED. 4 active-low user LEDs (LED0, LED1, LED2 and LED3) connected to I/O ports. Microcontroller Port Pin function Port I 0 Port I 1 Port I 2 Port I 3 Table 6.2: LED pin references Microcontroller Pin number 113 115 118 12 Polarity Active low Active low Active low Active low

LED Reference LED0 LED1 LED2 LED3

19

Internship report Nguyen Huynh Phuong Bao

VI.1.5.

Potentiometer

A single turn potentiometer is connected to pin AN0 of the microcontroller. The potentiometer can be used to change the input analog voltage signal between AVCC (analog voltage supply) and Ground.

Figure 6.4: Potentiometer circuit diagram VI.1.6. Serial port

The programming serial port of MCU (SCI4) is connected to the E8 header as the board default setting. User can also connect SCI4 with the RS232 transceiver by moving optional resistors and fitting the D connector in position J9.

Table 6.3: Serial option links

20

Internship report Nguyen Huynh Phuong Bao

Figure 6.5: Serial port schematic VI.1.7. LCD module

The connector J13 is available on-board for user to attach a LCD module into the Starter Kit. The LCD module uses 4-bit interface to reduce the pin allocation. There is no contrast control for the module. J13 Pin 1 3 5 7 9 11 13 Circuit net name Ground No connection R/W (Wired to Write only) No connection No connection DLCD4 DLCD6 68 66 Device pin Pin 2 4 6 8 10 12 14 DLCD5 DLCD7 67 61 Circuit net name 5V only DLCDRS DLCDE No connection 51 55 Device pin

Table 6.4: LCD module connections

21

Internship report Nguyen Huynh Phuong Bao

Figure 6.6: LCD module circuit VI.1.8. Reset circuit

The Starter Kit also includes a simple latch circuit to configure the mode selection as well as the reset circuit. The board can be easily reset by the RES switch. User can also manually change the kit operation mode to Boot Mode by the following steps:

Step 1: Press and hold SW1, which connected to the D-input of D flip-flop. Step 2: Press and release RES switch, in order to generate the clock pulse for the corresponding D flip-flop.

Figure 6.7: Reset circuit

22

Internship report Nguyen Huynh Phuong Bao

Individual assigned task in group: SUMMARIZE THE TUTORIAL MANUAL and DEVELOP APPLICATION EXAMPLE
VI.2. RSK H8SX1582 tutorial manual
VI.2.1. Introduction This tutorial helps you to explain the following common questions when using the Renesas Starter Kit (RSK).

How can you compile, link, download and run a simple program on RSK? How can you build an embedded application? How do you use the Renesas Tool? The project generator will create a tutorial project with two selectable build configurations: Debug is a project built with the debugger support included. Release builds demonstrating code suitable for release in a product. VI.2.2. Usage preparation

Before connecting the E8 debugger and follow the instructions in this tutorial, you must have to install the software in your computer.

Insert the CD provided with your RSK into the CD/ROM drive on your computer to run the installation.

Choose the language you are familiar with. Accept the User License Agreement. Pick up the corresponding option for the world regions. Select all of the options and sub-options for the High-performance Embedded Workshop (HEW), the H8, H8S, H8SX family, Flash Development Toolkit (FDT) and Auto Update utility since you are using H8SX1582.

Next, you are recommended to keep the default setting for the installed destination folder. Continuously click Next for all appeared windows till the end of the installation. Accept the Auto Update to make sure your software is updated. VI.2.3. Creating new project using HEW

HEW is an integrated development tool that allows the user to write, compile, program and debug a software project on any of the Renesas Microcontrollers. HEW will have been installed during

23

Internship report Nguyen Huynh Phuong Bao

the software installation for the RSK product.

Step 1: Select Create a new project workspace when the Welcome dialog appears, and enter these information.

Step 2: A dialog will be available for you to choose different kinds of project that suitable for your demand, such as tutorial project, sample code for peripherals and blank project with configured debugger for your own application. In this material, we will choose the Tutorial project for investigation. After select Finish, the project generation will inform you the list of files will be added to your project, choose OK to confirm and import them.

Step 3: Your project has been generated with the necessary files showing in the tree on the lefthand side of the workspace. Double click on main.c to view the code.

Step 4: The next thing you have to do is configure the build and debug options.

There are 2 options for the build configuration. If you want to use with the debugger, choose the debug build, otherwise, release build is configured for final ROM-able code.

For the debug session on the right-hand side, you may choose between the type of debug interface like Session_H8SX_1582_HMon or the DefaultSession in order to use different debugger targets or debug setting on the same project.

24

Internship report Nguyen Huynh Phuong Bao

VI.2.4.

Building tutorial project

1. Building code HEW provides users with 3 available ways to build their code

Build all: build everything in the project, includes the standard library. Build: build all files have been changed from the last build. F7: has the same meaning with build.

2. Connecting the debugger The RSK power will be provided through the E8 emulator from USB port. Make sure that E8 emulator is the only device that connects to your USB port; otherwise, the computer will be shut down by Windows.

Use ribbon cable to connect E8 to J8 on RSK. Connect E8 to host computer via USB port. Accept and follow all steps of the hardware installation requirement. Select the Recommended option and finish the setup wizard.

3. Connecting to the target with E8Direct The E8 provides an interface called E8DIRECT to allow HMon embedded debugger to connect to the target device. The FDT Flash configuration wizard must be done once in the project in order to provide flash programming capabilities.

Select the Device on the RSK from the drop down list. In this tutorial, we choose H8SX/1582F. In the sub pane, select the kernel version that ends in .RSK. Press Next.

25

Internship report Nguyen Huynh Phuong Bao

Select E8DIRECT as the communication Port

The default settings are suitable for an un-modified RSK board. Confirm the Crystal Frequency matches the board.

26

Internship report Nguyen Huynh Phuong Bao

Confirm the main clock frequency multiplier. Confirm the peripheral clock multiplier.

Ensure that USER Program Mode is selected. Confirm that Use Default is selected.

27

Internship report Nguyen Huynh Phuong Bao

Confirm the default selections of Automatic and Advanced.

Unless you are very sure that the mode pin settings need to change. Do not modify the default settings. The microcontroller can be damaged with incorrect settings.

Do not change anything in the following dialog if you do not completely understand about the mode pin setting. Accept the default setting and press Finish
28

Internship report Nguyen Huynh Phuong Bao

to complete the Flash configuration.

4. Connecting to HMon

Now, we will connect our device with HMon. HMon is able to find the internal flash configuration of the device we did before and also allocate the I/O registers as well as internal/external RAM information of specific device stored in a corresponding .TCF file. You will be ask to choose the file that applies to your RSK in the following dialog.

29

Internship report Nguyen Huynh Phuong Bao

The next thing you have to do is set the baud rate and power supply option for the RSK. The default setting is 250000 bits/second for baud rate and to receive power supply of 5V from the E8 emulator.

If you receive a fail connection message, recheck the previous setting and try to connect with the RSK again. If it is still unable to connect, you are required to launch a Boot Mode download. Press Ignore on the notification to open the following dialog.

Now you have finished the configuration steps for using the Starter Kit and ready for download your application program.

30

Internship report Nguyen Huynh Phuong Bao

VI.3. Small application examples for the Starter Kit


VI.3.1. Introduction to HEW, FDT and HMon The High-performance Embedded Workshop (HEW) is a powerful development environment for embedded applications targeted at Renesas microcontrollers. It is an integrated development tool that allows the user to write, compile, program and debug a software project on any of the Renesas Microcontrollers. The main features of HEW are:

A configurable build engine that allows you to set-up compiler, assembler and linker options by using GUI.

An integrated text editor with user customizable syntax coloring to improve code readability. A configurable environment, which allows you to run your own tools. An integrated debugger, which allows you to build and debug in the same application. Version control support. The High-performance Embedded Workshop has been designed with two key aims:

Firstly to provide the user with a set of powerful development tools. Secondly, to unify and present them in a way that is easy to use.

Figure 6.8: HEW working window The Renesas Flash Development Toolkit (FDT) is an on-board FLASH programming tool for

31

Internship report Nguyen Huynh Phuong Bao

Renesas MCUs that provides a high-performance and user-friendly Graphical User Interface (GUI). Embedded software development projects created using the Renesas High-performance Embedded Workshop (HEW) may be programmed into Renesas devices using FDT. HMon is a debug monitor that is integrated in HEW, allows users to debug their application code in FLASH and/or RAM memory on a target device. HMon consists of HMon components for communication between HEW and HMon monitor code, flash programming code and user's application code. Most Renesas microcontrollers include some on-chip debugging functionality, which can comprise software interrupt instructions (TRAP) and an address break peripheral unit. The HMon monitor makes use of the particular MCUs debug capabilities to extend its capabilities beyond that of a simple monitor. HEW debugging functionality combined with HMon code and Flash programming code enables you to run, step and set breakpoints in your application code as well as using other debugging functionalities such as viewing memory and C/C++ source code. VI.3.2. Standard project files

The RSK tutorials are configured so that it is possible to provide the same tutorial code on multiple RSK products. This allows the evaluation of the different processor cores using equivalent code. To achieve that, the following files are common between all device cores/ Tool-chains. These following files are also the standard for all of your application codes that developed for this Starter Kit. a) Initialization code (resetprg.c / resetprg.h) This is the entry point of the main tutorial code. Depending upon the compiler used this file may be the actual entry point of the software or may be called during the initial setup of the environment.

The _INITSCT( ) function sets up the variables and stack pointers use in C compiler. HardwareSetup( ) function initializes the device hardware as well as peripherals. Calling Main ( ) function will start the main demonstration code.

32

Internship report Nguyen Huynh Phuong Bao

b) Board initialization code (hwsetup.c / hwsetup.h) There are four common stages to the configuration of the microcontroller device. The code to demonstrate this is therefore split into four functions. Each function is written specifically for the device supported. The function calls are shown below.

c) Main tutorial code (main.c/ main.h) The main tutorial code is common to all tutorial projects. The display initialization and string display functions operate on the LCD display module.

33

Internship report Nguyen Huynh Phuong Bao

VI.3.3.

Demonstrative code for Starter Kit peripherals

The following example was done by the cooperation between members in my group at Renesas Design Vietnam Co., Ltd. Our purpose is to investigate how to control the peripherals that are already built-in in the kit, then, we can apply them to our final project for the internship program. In this example, we mainly used the LEDs and LCD module to demonstrate the binary counting, or combine with the A/D converter to display its changeable values. At the beginning, when generating a new project in HEW, there are files will be automatically imported. These files will define the setting, variables that available for users to write their application code, such as iodefine.h and rsk1582def.h.

34

Internship report Nguyen Huynh Phuong Bao

Figure 6.9: Defined variables in rsk1582def.h We have developed specific functions for controlling the LCD module, interrupt and LED display. Like other applications in C language, each function must be in combination with its header file, which declares the function prototype or parameters.

35

Internship report Nguyen Huynh Phuong Bao

Figure 6.10: Function for LCD to display A/D converter value

Figure 6.11: Interrupt function to control switch SW1

36

Internship report Nguyen Huynh Phuong Bao

Figure 6.12: LEDs counting function

Figure 6.13: Example of header file

37

Internship report Nguyen Huynh Phuong Bao

FINAL PROJECT
VII. DEVELOP SIMPLE DIGITAL WATCH ON H8SX1582 STARTER KIT
VII.1. Features

High precision and simple digital watch. Easy to use, friendly to customers. Three basic operation modes with configuration. Clock with 12-hour and 24-hour format. Integrated calendar. Alarm with snooze mode. Chronometer with 2 available options: split-time view and lap view.

VII.2. Specifications
VII.2.1. Modes

Clock mode Alarm mode Chronometer (or Stopwatch) mode VII.2.2. Inputs/ Outputs

Inputs:

SW1: Mode button


Pressed to change between modes. Pressed an hold to enter configuration.

SW2: Up button SW3: Down button

Outputs:

LCD module LEDs (used in Alarm mode)

VII.3. Operation modes


VII.3.1. Clock mode a) Time display: use SW3 to toggle the 12-hour or 24-hour format.

38

Internship report Nguyen Huynh Phuong Bao

b) Calendar display: Press SW2 in normal display to change between calendar and time display.

c) Configuration

Press and hold SW1 to enter or exit configuration display. The current setting parameter is blinked. SW1 is used to change the parameters. SW2/ SW3 will increase/ decrease current parameter's value. Adjusting order: Hour Minute Year Month Day. Weekday is automatically updated correspondingly to changing of other calendar values. VII.3.2. Alarm mode a) Alarm setting Toggle alarm on/off using SW2/ SW3 button. A bell icon appeared in Alarm mode and Clock mode display notified the alarm is set.

Press and hold SW1 to enter or exit configuration display. The current setting parameter is blinked. SW1 is used to change the parameters. SW2/ SW3 will increase/ decrease current parameter's value. Adjusting order: Alarm hour Alarm minute. Alarm runs independently with other modes. b) Snooze mode activation: when reaching the alarm time

Activated by SW1. Alarm will be hold and waited for an interval of time. Turn off alarm and snooze mode by pressing SW2/ SW3. Snooze icon will display on LCD
39

Internship report Nguyen Huynh Phuong Bao

VII.3.3. Chronometer mode a) Operating state

SW2 is used for start/ pause/ reset stopwatch

While running, press SW3 to record the current value

b) Split time and Lap view when chronometer is stopped

Press SW3 to view recorded values.

Press and hold SW3 for viewing appropriate result of laps.

40

Internship report Nguyen Huynh Phuong Bao

LIST OF REFERENCES
1. Renesas Technology (2008). H8 family of microcontrollers catalog. Retrieved June 27th, 2011. 2. Renesas Technology. (2008). H8SX Family catalog. Retrieved June 28th, 2011. 3. Renesas Technology. (2006). H8SX/1582 Hardware manual. Retrieved June 30th, 2011. 4. Renesas Technology. (2004). H8SX Family Software manual. Retrieved June 30th, 2011. 5. Renesas Technology. (2007). High-performance Embedded Workshop V.4.04 User's manual. Retrieved July 25th, 2011. 6. Renesas Electronics. (2006). Renesas FLASH Development Toolkit 3.07 User's manual. Retrieved July 25th, 2011. 7. Renesas Technology Europe Ltd. (2005). Renesas Debugger HMon manual. Retrieved July 25th, 2011. 8. Renesas Technology Europe Ltd. (2005). Renesas Starter Kit for H8SX1582 Board Schematics. Retrieved July 4th, 2011. 9. Renesas Technology Europe Ltd. (2005). Renesas Starter Kit for H8SX1582 User's manual. Retrieved July 4th, 2011. 10. Renesas Technology Europe Ltd. (2006). Renesas Starter Kit for H8SX1582 Quick Start Guide. Retrieved July 5th, 2011. 11. Renesas Technology Europe Ltd. (2007). Renesas Starter Kit RSK H8SX1582 Tutorial manual. Retrieved July 5th, 2011.

41

Potrebbero piacerti anche