The establishment of the minimum system of Hitachi SH3 single chip microcomputer

Publisher:AngelicWhisperLatest update time:2012-05-23 Source: 电子设计工程 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
0 Introduction
The SH series is a 32-bit high-end, RISC-type microcontroller series launched by Hitachi, Japan. So far, six types of microcontroller series have been launched: the basic SH1, the improved SH2, the low-power SH3, the enhanced SH4, and the SH2-DSP and SH3-DSP combined with DSP.
The SH3 series is a low-power SH processor with a high-performance RISC structure. At a clock of 133 MHz, the performance can reach 173 MIPS. When working at 2.25 V, the power consumption is 400 mW. The SH7709 of SH3 has a high energy efficiency of 315 MIPS per watt of power consumption. It integrates a 32-bit multiplier, a 4-way 8 KB CHACHE, a memory management unit MMU, some general internal control modules and external interface modules. Its performance is comparable to that of ARM's ARM9 series processors, and it occupies a large share in the world's embedded field. However, due to the limited reference materials for SH3 series microcontrollers in China and the lack of technical support, the ARM series almost dominates the domestic 32-bit processor market. The SH3 series processors cannot play its powerful functions in China. This article introduces how to use the HD6417708S model SH3 microcontroller to build the SH3 series microcontroller minimum system from hardware to software, and use the system's serial port module to verify whether the system can run normally. With this minimum system platform, developers can develop the required products by adding the functional modules they need to the system. In
the situation where ARM is the only choice for Chinese people, it also has certain references for developers who are starting from scratch to study a certain processor in the embedded field.

1 Overall introduction of the minimum system
The structural block diagram of the minimum system built with the HD6417708S model SH3 microcontroller is shown in Figure 1. This minimum system includes MCU (HD6417708S), power module, memory module, MCU peripheral auxiliary circuit. In order to visually see that the system can run normally, a serial communication module is added for demonstration.

b.JPG



2 Construction of the hardware platform
2.1 Power module
The ideal operating voltage of the "HD6417708S" microcontroller is 3.3 V, which can fluctuate by 0.3 V. Both the memory and the serial port chip support 3.3 V power supply. The power module here is a single-chip switching power supply circuit with the DCDC switching power supply chip "1CZ21H" as the core, with DC8V-DC28V input and 1.5 A current when powered by 3.3 V. The circuit principle is shown in Figure 2.

c.JPG [page]

2.2 Serial communication module
This module uses 3 pins: MD2/RXD (pin 84), MD1/TXD (pin 85), and MD0/SCK (pin 86), and they are all function multiplexed pins. When the 3 pins are used as MD0, MD1, and MD2 function pins, they are mode selection control pins. Their states during reset determine the setting of the clock circuit. The corresponding relationship can be found in the references. After
the system is running normally, the clock mode control function has been completed. If the system needs to use the serial port function, RXD (pin 84) and TXD (pin 84) can be used for full-duplex communication. Now the question is how to design the hardware to meet these two functions at the same time. Here are 2 solutions:
Solution 1: The serial port chip uses the MAX3223 chip. This chip has a function enable pin. If the chip is not enabled, the chip pin is in a high-impedance state. The block diagram of the solution provided is shown in Figure 3: When the system is reset, the MAX3223 is in a disabled state, and the RXD and TXD pins of the MAX3223 are in a high-impedance state. By adding auxiliary circuits, the SH7708 microcontroller can provide mode control signals at will. When the system is running, the SH7708 will definitely g.jpg access the ROM in Area 0 through the chip select signal of Area 0, so g.jpg whether a low pulse appears can be used as a flag signal to indicate whether the system is running. g.jpg The signal is sent to the mode control auxiliary circuit. Once a low pulse is detected g.jpg , the output of the mode control auxiliary circuit becomes a high-impedance state, and the MAX3223 chip is enabled at the same time. The mode control module of Solution 1 in Figure 3 can achieve its function with a combinational logic gate and a trigger.

d.JPG


Solution 2: Use CPLD to separate the microcontroller and the serial port chip. In this way, you can control it as you like. The specific solution is shown in Figure 4: Since other resources of CPLD are also used in the system, this solution is selected. If the system does not use CPLD in other functions, it is recommended to use Solution 1 because the cost of Solution 1 is much lower.

e.JPG

[page]

2.3 Memory Module
There is no ROM space inside the SH3 microcontroller, and the system must connect the ROM memory on the external bus. The SH3 microcontroller bus adopts a design mode in which the address bus and the data bus are separated, and the address bus supports a maximum of 64 MB of storage space. Any ROM that meets this bus mode can be used (there is no NAND FLASH controller inside the SH3 microcontroller, so do not choose NAND FLASH memory). Since one instruction occupies 16 bits of space, an 8 MB 16-bit wide FLASH memory LH28F640BFN is selected.
The SH3 series processor has an 8 KB CACHE embedded inside. When the cache function is not used, there is a 4 KB CACHE space that can be used as a general RAM. Since this time we are only discussing the establishment of the minimum system, the program is relatively simple, and 4 KB of space is sufficient. When introducing larger applications in the future, the SDRAM memory connected to the system will be introduced, and it will be discussed in other articles in the future.
2.4 MCU peripheral auxiliary circuit
(1) Reset circuit: The HD6417708S microcontroller requires a low-level reset signal of at least 10 ms. If other chips in your system also require a reset signal, please consider the length and level of the reset signal. The reset circuit of this system uses a "1075" reset chip that integrates a reset and watchdog circuit.
(2) Clock circuit: The clock module of the HD6417708S microcontroller has two pins: EXTAL (79) and XTAL (80). If you want to use a passive crystal oscillator, connect the crystal oscillator between EXTAL and XTAL, and connect an 18 pF capacitor to each pin to ground. If you want to use an active crystal oscillator, connect the clock output pin of the crystal oscillator to the EXTAL pin.
(3) PLL module peripheral auxiliary circuit: The HD6417708S microcontroller phase-locked loop circuit requires a 470 pF capacitor to be connected to ground at pins 74 and 77 respectively.
(4) Processing of several special pins Pin 87 is a bus request input function pin. If a low-level signal is added to this pin when the system is running normally, the microcontroller will release the bus. If your system has multiple processors that need to share the bus, bus allocation can be achieved by properly controlling this pin. If the system does not use the microcontroller to release the bus, you can add a 10 kΩ pull-up resistor to this pin. This pin must not be left floating.
Pins 89 to 93 are external interrupt input pins. Pin 89 is the NMI (non-maskable interrupt) pin, which is an edge-triggered interrupt.
Pins 90 to 93 are maskable interrupt pins, which are level-triggered interrupts. These pins cannot be left floating. If they are not used, add a 10 kΩ pull-up resistor to each of these pins.
Pin 94 is a PCMCIA bus control pin. If this type of memory is not used, you can add a 10 kΩ pull-up resistor, which will not affect other parts.
MD3 (pin 103), MD4 (pin 104), and MD5 (pin 130) are three mode control pins. MD3 and MD4 control the bus width of Area0. For the corresponding relationship, please refer to the references.
The state of MD5 at reset tells the microcontroller how the data (including code and data) in the memory on the bus is stored. When MD5 is zero at reset, it means that the data in the memory is stored in big-endian mode. When reset, the data in the memory should be in little-endian mode.
(Pin 132) is a wait request pin, which is valid at low level. When the access speed of the processor exceeds the response speed of the external device, this pin can be set low to let the processor wait. If the external device of the system is fast enough to use this function, a weak pull-up resistor must be added, and it must not be left floating or grounded. Since then, the minimum system hardware platform of the HD6417708S microcontroller with a monitoring serial port has been built, and the system can be run by writing related software.

3. Building the software platform
The development environment for the SH3 series of microcontrollers is the "High-performance Embedded Workshop" software specially provided by Renesas Corporation of Japan. There are many versions, which can be downloaded from the website of Renesas Corporation. I downloaded the "shv9200_ev.exe" version.
First, install the "High-performance Embedded Workshop" software, the development tool for the HD6417708S microcontroller. After the installation is complete, a "Renes as" installation program will appear in the program directory. The "High-performance Embedded Workshop" icon inside is the icon of the development software.
Create a template project. Double-click the development tool icon to display a project dialog box. Select the first item "Create a new project workspace", and then click the OK button to enter the "New Project Workspace dialog box. In the "Workspace In the "Name" dialog box, give the project a name, such as "123". The system will
default the names of the "ProjectName" and "Directory" items to "123". If you want to specify the save path of the project, click the "Browse" button to select the place where you want to save the program. Use the default options for other options and click the "OK" button to enter the next dialog box. Select the "SH-3" option in the "CPUSerise" selection box, select the "SH7708" option in the "CPUType" selection box, and then click the "Next" button to enter the next dialog box interface. Set the "Endian" option to "Little" mode. This option is very important. The MD5 pin introduced in the previous "MCU peripheral auxiliary circuit" section is used to set the program storage big and small end mode. If the big and small end of the MD5 pin setting is different from the software setting, the whole program will be messed up. Because the hardware sets the MD5 pin to the little end mode, set the "Endian" option to "Little" mode here. Use the default values ​​for other options, and then click the "Next" button to enter the next dialog box interface. At the bottom of the dialog box, at "Generate Hardware Setup Select the "C/C++ source file" option from the drop-down menu of "Function", and then click the "Next" button continuously until the "Targets" option interface appears. Select the "SH-3Simulator (Little endian)" option, and then click the "Next" button continuously until the icon turns gray, and then click the "Finish" button to enter the main interface of the project, and the template project is completed.
Introduction to template project related files. Since a template project is established, some files are brought with the project after it is established, including startup code, exception handlers, and program interfaces provided for software developers, etc. Several key file functions are introduced as follows in the order of program execution:
First, click the "handle.src" file in the program directory and find the segment mark ".sectionRSTHandler.code". The program code in this segment is the first code executed after the microcontroller is powered on and reset. Then click the "resetprg.c" file, which contains a "void PowerON_Reset(void)" function. After the microcontroller executes the program code in the ".section RSTHandler,code" segment in the "handle.src" file, it jumps to this function. If you want to know why it jumps to this function, please calculate the address to be jumped by the "JMP" instruction in the ".section RSTHandl er,code" program segment and the address allocated by "void PowerON_Reset(void)". You will find that the two addresses correspond to the same storage unit. The "set_vbr((void*)((_UINT)INTHandlerPRG-INT_OFFSET))" function called in the "void PowerON_Reset(void)" function, "_INITSCT()" and "_INIT_IOLIB()" are all system library functions. Their functions are introduced in the compiler manual and will not be introduced in detail here.
Click the "hwsetup.c" file to see the specific content of the HardwareSetup() function called in the "void PowerON_Reset(void)" function. This function is used to initialize the microcontroller bus and various peripheral function modules. The set_cr(SR_Init) function is a system function used to initialize the status register. It is closely related to the setting of interrupts and is not very meaningful for this system. In line with the principle of simplifying the system, this function is commented out. Then it is the "main()" function. Click the "123.c" file to find that the "main()" function is an empty function. This is the interface provided by the system for programmers. Just add your program code in this function. So far, the relevant files in the template project have been introduced. When the system is powered on, the microcontroller jumps to the "main()" function after running the template's built-in initialization program. The programmer only needs to add the required functional code to this function to implement the required functions.

[page]

Implementation of the serial port monitoring program In order to verify that the system is really running, a serial port monitoring module is added to the hardware.

f.JPG


Here we implement the following simple function: initialize the serial port baud rate to 9600b/s, receive one byte of data through the serial port and send it out through the serial port. This simple function verifies that the system works properly. The program flow chart is shown in Figure 5. Compile the application program, and finally generate the machine code in Motorola format. Parse the useful data and burn it into the system ROM. The system can be powered on for demonstration.

a.JPG


System test. Connect this system to the computer through a serial port line, and the computer runs the serial port software to send the byte "0xaa" to the system board. The receiving area of ​​the computer serial port software shows "aa", as shown in Figure 6: This phenomenon shows that the system is running normally. Since then, the minimum system of the HD6417708S microcontroller has been successfully established from scratch. This system elaborates on the solutions to possible problems in the development and application of the SH3 series microcontroller, and verifies the correctness of the minimum system with serial port experiments. This minimum system basically shows the differences between the SH3 processor and other processors. On this basis, developers can use the SH3 microcontroller well as long as they use the common theory of microcontroller development, greatly shortening the development cycle and reducing the difficulty of development. At the same time, it also provides domestic engineers of ARM-Tongtianxia with the choice of data update sent and received by the host computer serial port monitoring software as shown in Figure 6.

4 Conclusion
This minimum system has been applied in industrial products. Practice has proved that the minimum system runs stably and can well meet product indicators.

Reference address:The establishment of the minimum system of Hitachi SH3 single chip microcomputer

Previous article:Detailed explanation of the classification and functions of single-chip microcomputer programmers
Next article:Design of Solar LED Street Light Controller Based on STC Microcontroller

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号