arm lab manual

23
Andhra Pradesh, India ARM LAB Manual H.NO: 16-11-741/16, FLAT NO: 101, First floor,Above Reliance fresh,Dilshuknagar, Hyderabad,Andhra pradesh -500060 Contact No:040-24144434 Email: [email protected] www.unistring.com www.stringtechnologies.net Unistring Tech Solutions Pvt Ltd, INDIA

Upload: shruthi-elisha

Post on 14-Oct-2014

648 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: Arm Lab Manual

Andhra Pradesh, India

ARM LAB Manual

H.NO: 16-11-741/16, FLAT NO: 101,

First floor,Above Reliance fresh,Dilshuknagar,

Hyderabad,Andhra pradesh -500060

Contact No:040-24144434 Email: [email protected]

www.unistring.com www.stringtechnologies.net

Unistring Tech Solutions Pvt Ltd, INDIA

Page 2: Arm Lab Manual

ARM7 Microcontroller Lab Manual

Unistring Tech Solutions (P) Ltd

www.unistring.com

2

LPC2148 (ARM) MICROCONTROLLER

Page 3: Arm Lab Manual

ARM7 Microcontroller Lab Manual

Unistring Tech Solutions (P) Ltd

www.unistring.com

3

Section - 1

Introduction to ARM Board (LPC2148)

This section of the document introduces LPC2148 microcontroller board

based on a 16-bit/32-bit ARM7TDMI-S CPU with real-time emulation and embedded

trace support, that combine microcontrollers with embedded high-speed flash memory

ranging from 32 kB to 512 kB. A 128-bit wide memory interface and unique

accelerator architecture enable 32-bit code execution at the maximum clock rate. For

critical code size applications, the alternative 16-bit Thumb mode reduces code by

more than 30% with minimal performance penalty. The meaning of LPC is Low

Power Low Cost microcontroller. This is 32 bit microcontroller manufactured by

Philips semiconductors (NXP).

Due to their tiny size and low power consumption, LPC2148 is ideal for

applications where miniaturization is a key requirement, such as access control and

point-of-sale.

1.1 Features of ARM Microcontroller

• 16-bit/32-bit ARM7TDMI-S microcontroller in a tiny LQFP64 package.

• 8 kB to 40 kB of on-chip static RAM and 32 kB to 512 kB of on-chip flash

memory; 128-bit wide interface/accelerator enables high-speed 60 MHz

operation.

• In-System Programming/In-Application Programming (ISP/IAP) via on-chip

boot loader software, single flash sector or full chip erase in 400 ms and

programming of 256 Bytes in 1 ms Embedded ICE RT and Embedded Trace

interfaces offer real-time debugging with the on-chip Real Monitor software

and high-speed tracing of instruction execution.

• USB 2.0 Full-speed compliant device controller with 2kB of endpoint RAM.

In addition, the LPC2148 provides 8 kB of on-chip RAM accessible to USB

by DMA.

• One or two (LPC2141/42 vs, LPC2144/46/48) 10-bit ADCs provide a total of

6/14 analog inputs, with conversion times as low as 2.44 ms per channel.

• Single 10-bit DAC provides variable analog output (LPC2148 only)

Page 4: Arm Lab Manual

ARM7 Microcontroller Lab Manual

Unistring Tech Solutions (P) Ltd

www.unistring.com

4

• Two 32-bit timers/external event counters (with four capture and four compare

channels each), PWM unit (six outputs) and watchdog.

• Low power Real-Time Clock (RTC) with independent power and 32 kHz

clock input.

• Multiple serial interfaces including two UARTs , two Fast I2C-bus (400

kbit/s),SPI and SSP with buffering and variable data length capabilities.

• Vectored Interrupt Controller (VIC) with configurable priorities and vector

addresses.

• Up to 45 of 5 V tolerant fast general purpose I/O pins in a tiny LQFP64

package.

• Up to nine edge or level sensitive external interrupt pins available.

• 60 MHz maximum CPU clock available from programmable on-chip PLL

with settling time of 100 ms.

• Power saving modes include Idle and Power-down

• Individual enable/disable of peripheral functions as well as peripheral clock

scaling for additional power optimization.

• Processor wake-up from Power-down mode via external interrupt or BOD.

• Single power supply chip with POR and BOD circuits:

- CPU operating voltage range of 3.0 V to 3.6 V (3.3 V ± 10 %) with 5 V

tolerant I/O.

1.2 Arm Board description

Power:

DC 6.5V with power LED On-board linear regulators generate

+3.3V/500mA and +5v/500mA from power supply.

USB connector ( as alternate power source).

Connectors:

Extension headers for all microcontroller pins.

RS232 connectors (2).

VGA connector.

PS/2 connector.

Page 5: Arm Lab Manual

ARM7 Microcontroller Lab Manual

Unistring Tech Solutions (P) Ltd

www.unistring.com

5

JTAG connector.

SD/MMC connector.

USB B-type connector with Link-LED.

All peripheral configurable via jumpers.

Other Peripherals:

256Kb I2C based EEPROM

Audio power amplifier.

2 line X 16 character LCD with back light control.

Configurable for manual and automatic program download(ISP) via serial

port.

8 controllable LEDs on SPI using 74HC595.

Page 6: Arm Lab Manual

ARM7 Microcontroller Lab Manual

Unistring Tech Solutions (P) Ltd

www.unistring.com

6

Page 7: Arm Lab Manual

ARM7 Microcontroller Lab Manual

Unistring Tech Solutions (P) Ltd

www.unistring.com

7

1. LPC2148 Plug-in module

2. 3V cell holder for RTC

3. UART1 DB9 connector

4. UART0 DB9 connector

5. 50-pin expansion header

6. 2X5 JTAG header

7. 9-12V AC/DC socket

8. ON/OFF slide switch

9. Boot loader switch

10. Microcontroller reset switch

11. USB connector B-type

12. Jumpers for LCD interface

13. Jumpers for Switches

14. Jumpers for Trimpots

15. Jumpers for Buzzer and IR Receiver

16. Jumpers for LEDs

17. Jumpers for selection between UART1 and Xbee

18. Jumpers for SPI – SD/MMC interface

19. Jumpers for I2C EEPROM

20. SD/MMC card socket

21. 16X2 character LCD

22. Four user switches

23. Two trimpots connected to ADC

24. Four user LEDs

Page 8: Arm Lab Manual

ARM7 Microcontroller Lab Manual

Unistring Tech Solutions (P) Ltd

www.unistring.com

8

HOW TO USE KEIL µVISION4 for ARM7 (LPC2148)

Step By Step

KEIL µVISION4 IDE

The LPC2148 microcontroller is supported by various commercially available IDEs

for compiling and debugging of the code. Keil being one of them is the widely used

IDE for LPC family of microcontrollers. The µVision4 IDE is Windows-based

software development platforms that combines a robust editor, project manager, and

make facility. µVision4 integrates all tools including the C compiler, macro

assembler, linker/locator, and HEX file generator. The evaluation version of Keil

µVision4 IDE is used for demonstrating the codes.

The open source community has been doing a lot in the development of open

source tools for ARM architecture based Microcontroller. The open source tools are

available at zero cost and are being improved with time. Eclipse being one of them

and is most commonly used IDE due to its unique features like auto complete, project

tree, etc. It requires GCC tool chain for code compilation.

Page 9: Arm Lab Manual

ARM7 Microcontroller Lab Manual

Unistring Tech Solutions (P) Ltd

www.unistring.com

9

Installing Keil µVision4 IDE

To install Keil µVision4 IDE, Go to “Software” folder in the documentation CD and

locate “mdk412.exe” file. Click on “mdk412.exe” to start the installation process.

Once the installation process is started Keil µVision welcome screen will appear.

Please read the instructions on the welcome window and click Next>> to start the

installation.

Please read the license agreement carefully. If it is acceptable click the check box and

Click Next>> to continue.

Page 10: Arm Lab Manual

ARM7 Microcontroller Lab Manual

Unistring Tech Solutions (P) Ltd

www.unistring.com

10

Select the destination folder where set-up will install files. It is always recommended

to select the default location. To create backup of old installation select the backup

option and click Next>> to continue.

In the next window enter your information and click Next>> to continue.

Page 11: Arm Lab Manual

ARM7 Microcontroller Lab Manual

Unistring Tech Solutions (P) Ltd

www.unistring.com

11

On clicking next the file copying process will begin. Wait till set-up is complete.

Click Finish to complete installation process.

Page 12: Arm Lab Manual

ARM7 Microcontroller Lab Manual

Unistring Tech Solutions (P) Ltd

www.unistring.com

12

Overview of Keil µVision4 IDE

To start Keil IDE click Start>Programs>Keil µVision4. The initial screen will appear

followed by the main window.

The Keil IDE main window in basic configuration is mainly divided into three areas.

Editor - It is the area where .c and .h files of the project are edited.

Project Explorer- It shows the project tree.

Output Window- This window shows the messages related to compiling, project

building and debugging.

Page 13: Arm Lab Manual

ARM7 Microcontroller Lab Manual

Unistring Tech Solutions (P) Ltd

www.unistring.com

13

Create a Project in Keil for LPC2148 development board

Step1: Click for KEIL µVISION4 Icon . Which appearing after Installing Keil

µVISION4.

1. To create a new project, Select Project>New uVision Project from the main menu.

Page 14: Arm Lab Manual

ARM7 Microcontroller Lab Manual

Unistring Tech Solutions (P) Ltd

www.unistring.com

14

2. Create a new directory and name it as First_Project. Click open to enter in to this

directory.

3. Inside this directory create a new project and name it as First_Project and click

Save to continue.

Page 15: Arm Lab Manual

ARM7 Microcontroller Lab Manual

Unistring Tech Solutions (P) Ltd

www.unistring.com

15

4. In the next window locate NXP (founded by Philips) tree and expand it.

5. Now select target device as LPC2148 and click OK to continue.

Page 16: Arm Lab Manual

ARM7 Microcontroller Lab Manual

Unistring Tech Solutions (P) Ltd

www.unistring.com

16

6. Click Yes to copy Startup.s file to project folder. This file configures stack, PLL

and maps memory as per the configurations in the wizard. It is discussed in the later

sections.

7. Observe the project explorer area in the main window.

Page 17: Arm Lab Manual

ARM7 Microcontroller Lab Manual

Unistring Tech Solutions (P) Ltd

www.unistring.com

17

8. Now click Project>Manage>Components, Environments, Books from the main

menu to ensure compiler settings.

9. In the Folders/Extensions tab ensure the compiler settings are as shown in the fig.

Below. If you have installed Keil software at a different location then change Tool

Base Folder location. Click OK to continue.

Page 18: Arm Lab Manual

ARM7 Microcontroller Lab Manual

Unistring Tech Solutions (P) Ltd

www.unistring.com

18

10. Now click File>New to create a new file.

11. Save the new file in to the same folder that was created earlier and name it as

main.c and click Save to continue.

Page 19: Arm Lab Manual

ARM7 Microcontroller Lab Manual

Unistring Tech Solutions (P) Ltd

www.unistring.com

19

12. Now add “main.c” to the source group by right clicking on the Source Group 1

From the project explorer and select the highlighted option as shown in the fig. below.

13. Select “main.c” file to be added and click ADD to continue.

Page 20: Arm Lab Manual

ARM7 Microcontroller Lab Manual

Unistring Tech Solutions (P) Ltd

www.unistring.com

20

14. Observe that “main.c” file is added to the source group in the project explorer

window.

15. Right click Target1 in the project explorer window and select the highlighted

option as shown in the fig. below.

Page 21: Arm Lab Manual

ARM7 Microcontroller Lab Manual

Unistring Tech Solutions (P) Ltd

www.unistring.com

21

16. In the appearing window select Target tab and set Xtal. frequency as 12MHz.

17. In the Output tab ensure that Create HEX File option is selected.

Page 22: Arm Lab Manual

ARM7 Microcontroller Lab Manual

Unistring Tech Solutions (P) Ltd

www.unistring.com

22

18. In the Linker tab ensure that the highlighted option is selected and click OK to

Continue.

19. Now since the project is almost setup we can start writing code in the “main.c” file that

was created earlier. For demonstration purpose you can copy the following code and paste it

in the “main.c” file.

20. Now build the project by clicking on Rebuild button on the main toolbar.

Page 23: Arm Lab Manual

ARM7 Microcontroller Lab Manual

Unistring Tech Solutions (P) Ltd

www.unistring.com

23

21. You can alternatively build project by clicking on Project>Build Target from the main

menu.

22. You can observe the build process in the output window. If any errors, rectify it by double

clicking on it and you will be pointed to the erroneous line.