Arm board tutorial

  • View
    26

  • Download
    3

Embed Size (px)

DESCRIPTION

Arm board tutorial. Part 1 Using the ARM board And start working with C Tutorial 5 and 6. Outline. Software Hardware Download the program to the board The ARM7 board test program. Materials distributed. Materials will be distributed: NXP LPC2131 x 1 FT232BL x 1 Power adapter x 1 - PowerPoint PPT Presentation

Text of Arm board tutorial

IDE for ARM 7 board

Arm board tutorial Part 1Using the ARM boardAnd start working with CTutorial 5 and 61CES arm board v.14.7OutlineSoftwareHardwareDownload the program to the boardThe ARM7 board test program

2CES arm board v.14.7Materials distributedMaterials will be distributed:NXP LPC2131 x 1FT232BL x 1Power adapter x 1USB cable x 1

Please use them CAREFULLYYou MUST return all the materials at the end of this semester30 marks will be deduced if you lose or dont return anyone of them

3CES arm board v.14.7Hints for the exercisesThe User manual (UM10120.pdf) and the Schematic of the board are VERY usefully

You may need to check the lecture notes4CES arm board v.14.7SoftwareSetup the uVision project 5CES arm board v.14.7Start working with CNew ProjectProject New Vision ProjectFind somewhere to save you projectchoose NXP LPC2131with Startup.sEdit Startup.scomment the line 430

6CES arm board v.14.7Start working with CProject Options for target1 At "Linker" tabselect Use Memory Layout from Target DialogAt "Output" tabselect Create HEX File

7

CES arm board v.14.7Start working with C Create a C fileFile NewFile SaveFind a good place to save your codee.g. same folder as the project fileEnd the file name with ".c"Some examples : main.c, test_c.c Bad examples: a.c, asd.c

8CES arm board v.14.7Start working with C Add the code into your projectProject Manage Components, Environment and Books Add filesLocate the C file you just savedYour project should look like this:

9

CES arm board v.14.7Start working with C Paste the following template to your code:

10#include

int main(){ while(1); return 0;}CES arm board v.14.710Start working with C #include tell the compiler to use the header file "lpc213x.h"lpc213x.h defines all the register address for the devices in LPC213x familyIOPIN0 for GPIO0, U0THR for UART011CES arm board v.14.7Start working with Cint main(){ while(1); return 0;}the function "main" is the entry point of your program after the running the instructions in "Startup.s""while(1);" is an infinite loop which keeps the processor busy12CES arm board v.14.7HardwareIntroduction to the CUHK ARM7 board 201213CES arm board v.14.7CUHK ARM Board 2012The latest version of the board14

CES arm board v.14.7CUHK ARM7 board 2012

15A simple prototype boardSerial USB ICNXP LPC2131Connect to computerPowerResetCES arm board v.14.7CUHK ARM7 board 2012

16A simple prototype boardSerial USB ICNXP LPC2131Always light up with power onPress to resetConnect to computerUse Power Supply (9V)ORUse power adapterA Slide switch(Pull right is the programming mode; Pull left is the normal mode)CES arm board v.14.7Install the Serial USB driverAfter you power on and connect the board to computer, you may need to install the driver for the Serial USB chip

Please download the driver from BlackBoard, named CDM20828_Setup.exeYou can also download the driver from this linkhttp://www.ftdichip.com/Drivers/VCP.htmPlease install it, then, re-connect the board to computerNow, go to Device Manager to check the board can be recognize by the computer or not 17CES arm board v.14.7Install the Serial USB driver18

Your board is ready to use if this appear CES arm board v.14.7Flash the program to the board19CES arm board v.14.7Download to the BoardCreate a HEX fileUse the Flash Tools by Philips(LPC21XX)You can install it in your own computerPlease download Philips Flash Utility Installation.exe and install it if you needed

CES arm board v.14.72020Check the project settingChoose Option for Target

CES arm board v.14.72121Check the project settingMake sure Create Hex File in Output tab is selected

CES arm board v.14.72222Configure the Flash ToolClick Flash, select Configure Flash Tools

CES arm board v.14.72323Configure the Flash Tool24

Make sure it is correspond to the COM device of the board (Mostly it is COM4)You may need to check the Device Manager to confirmChange to 57600Make sure this part is same as follow(If you install the tool in your own computer, the path will be different. Please find it from your installed directory)CES arm board v.14.7Check the Hardware connectionConnect the USB cableSet the slide switch (SW2) to programming mode (Right)Press the reset button

Please pull to RightCES arm board v.14.72525Download

CES arm board v.14.72626UploadClick Upload to Flash if not start automaticallyOn error, please check:Any other program using the serial port?Make sure the switch is connectedPush the reset button

CES arm board v.14.72727Lab ExerciseCreate a new projectPlease mark sure all the settings are correctDownload the gpio.s form BlackBoardAdd it to the projectCompile and download it to the boardObserve and test the resultNow, change the BEQ in line 23 to BNECompile and download to the board againObserve the result, state the differences between the previous

28CES arm board v.14.7Lab ExerciseRemove the gpio.s in the project Create a new file, called gpio.c and add it to the projectRe-write the previous two gpio.s in CThe original one and the modified oneCompile and download to the boardCan you re-produce the previous two results?

29CES arm board v.14.7The ARM7 board Test programYou may use it to test out the board you make 30CES arm board v.14.7Test program of the boardYou can download a test program, named TestProg.hex from BlackBoard to test out your board31CES arm board v.14.7To use this test program Connect the board to the computerPull the slide switch to the programming modePress the Reset buttonPlease go to Start -> All Programs -> Philips Semiconductors -> Flash Utility -> Launch LPC210x_ISP.exeClick Launch LPC210x_ISP.exe to start the Flash Tool

32CES arm board v.14.733

CES arm board v.14.7Setting the Flash Tool34

Click this. Select the TestProg.hex file you downloadedSelect 57600Select the corresponding the COM port (Mostly is COM4). You may need to check it for Device ManagerAfter the settings are finished, Click this to download the program to the boardCES arm board v.14.7To use this test program Wait the download process is finishedIf it is not success, please redo the pervious steps againPull the switch back to the normal modePress the Reset buttonNow, the test program is running. You may observe the LEDs are blink. Also, you can turn on/off those LEDs using the push buttons

35CES arm board v.14.7part 2CES arm board v.14.736Building LDR module

Building LDR module37Supplementary38Change the COM Port Number39

Select PropertiesChange the COM Port Number40

Click AdvancedChange the COM Port Number41

Select the COM Port Number which between COM2-COM5Change the COM Port Number42

Click YesChange the COM Port Number43

Click OKChange the COM Port Number44

Now, the COM Port Number is changedUsing Hyper Terminal45Using Hyper Terminal

46Using Hyper Terminal

Choose a name for your connection47Using Hyper Terminal

Choose the com port connected to the device48COM PropertiesChoose a setting that match the boardBaudrateData Bit8Flow controlNone

49Communicate with ARM board

ConnectDisconnect50Other way to open Hyper TerminalDouble click the shortcut in Desktop, named by baudrate valueE.g 57600.ht, 115200.ht

LDR Module52LDR Module53

LDR moduleVoutVccGNDOn the ARM boardPlease dont forget this resistor

VoutVccGND47 ohm