Professional Documents
Culture Documents
Lab 1
Lab 1
LAB#001SetupLPC4088
Motivation
Inthisexperiment,youwillgetintroducedwiththeKeildevelopmentenvironment1 and
thedevelopmentboardwhichutilizesLPC4088microcontrollerfromNXPSemiconductors2.
Withinthescopeofthisexperiment,youwilllearn:
settingupandworkinginatypicalembeddedsoftwaredevelopmentenvironment
downloadinganembeddedcodetothedevelopmentboard
readingandmodifyingdatainmemory
1) SetupEnvironment
1pt
From
https://www.keil.com/download/product/
downloadKeiluVision5application.
2) SetupDevice
2pt
Downloaddevicefirmwarefrom:
https://developer.mbed.org/users/embeddedartists/notebook/lpc4088updatingthecmsisdapi
nterface/
Startbydownloadingthefirmwarethatyouwant(linksabove)
TakethemicroBtoAUSBcableinyourboxesandDONOTCONNECTTHE
CARDTOYOURCOMPUTERFORTHETIMEBEING!!!!!Yourcomputermust
beaWindowsmachine(Linuxdoesnotalwaysworkthisisalimitationofthe
LPC11U35MCU).
ConnectthemicroBparttotheHDKUSBportoftheLPC4088QuickStartBoard.
TheHDKUSBinterfaceisfoundonthebottomsideoftheboardundertheReset
pushbutton(sameendoftheboardwheretheFPCdisplayconnectorislocated)as
showninthebelowfigure
1
2
PressandholddowntheRESETbuttonontheLPC4088QuickStartBoard.Inthe
meantimeinserttheAsideoftheUSBcable.Waituntilyourcomputerrecognizesthe
board.
ReleasetheRESETbutton
YoushouldnowhaveaCRP_DISABLDdrive(ifnot,thenunplugandredosteps2,3
and4)
Deletethefirmware.binfilefromtheCRP_DISABLDdrive
Copythebinarythatyoudownloadedinstep1totheCRP_DISABLDdrive
DisconnectandthenconnecttheAsideoftheUSBcabletogetthenormalMBED
drive
From
https://developer.mbed.org/handbook/Windowsserialconfiguration
download
mbedWindowsSerialandinstall.(ifinstallationcannotstart,disconnectandreconnecttheA
sideoftheUSBcableandretryinstallation)
3) SetupProject
2pt
EnterKeiluVision5andopenPackInstaller(
).
SelectNXPDevicesandselect
LPC4000_DFPandinstallthatpack.AlsoyoucanimportKeil.LPC4000_DFP.1.1.0.packfile
forinstalling.
Afterinstallation,reloadSoftwarePacksusingthemenu:
ProjectManageReload
SoftwarePacks.
Forcreatingprojectselect:
ProjectNewuVisionProject.
Select
LPC4088FET208
forDevice.
Afterclicking
OK
button,select
CMSISCORE
and
DeviceStartup.
YoucanchangetargetnameTarget1toanynamesuchasNXPLPC4088.
YoucanchangesourcegroupnameSourceGroup1toanynamesuchassrc.
4) AddSourceFilestoProject
1pt
Youcanaddfilesinseveralwaystoaproject.Themostcommonwayistoclickonafile
groupinthewindow
Project
andusethecontextmenu
AddNewItemtoGroup
or
Add
ExistingFilestoGroup.
AddNewItemtoGroup
Youcanaddnewitems:RightClickthe
SourceGroup
AddNewItem
SelectFile
.
Foradding
main.c
:RightClickthe
SourceGroup
AddNewItem
SelectCFile
and
nameitasmain.
In
main.c
fileyoucancopythefollowingcode:
#include
"LPC407x_8x_177x_8x.h"
int
millisecond=
1000
void
init(){
LPC_GPIO1>CLR=
1
<<
18
LPC_GPIO1>DIR|=
1
<<
18
LPC_IOCON>P1_18&=~(
0x3
<<
3
)
LPC_IOCON>P1_18|=(
0
&
0x3
)<<
3
}
void
update(){
int
i
LPC_GPIO1>SET=
1
<<
18
for(i=
0
i<millisecond*
12000
i++)
LPC_GPIO1>CLR=
1
<<
18
for(i=
0
i<millisecond*
12000
i++)
}
int
main(){
init()
while
(
1
){
update()
}
}
AddExistingFilestoGroup
Youcanaddexistingitems:RightClickthe
SourceGroup
AddExistingItem
Select
FilesfromFileDialog
.Yet,thisitemisnotrelatedwiththisweeksexperiment.So,youcan
skip.
5) OpenExistingProject
Select
Project
OpenProject.
Yet,thisitemisnotrelatedwiththisweeksexperiment.
So,youcanskip.
6) DebugSettings
4pt
Fordebugging,select
TargetName
Optionsfortarget
In
Target
tab,click
useMicroLIB
In
Debug
tab,select
CMSISDAPDebugger.
Click
Settings
forCMSISDAPDebugger.In
Debug
tab,click
StopafterBootloader
and
VerifyCodeDownload
.
In
FlashDownload
tab,click
ResetandRun
.
7) DebugProgram
2pt
Openyour
main.c
filefromyourProjectWindow.Nowyoucanadd
Breakpoints
by
clickingnexttotheline.
Addbreakpointnextto:LPC_GPIO1>SET=
1
<<
18
andLPC_GPIO1>CLR=
1
<<
18
Youcanbuildyourcodeby
.Beforedebugging,byusing
,runthecodeandobservethewhathappens.Afterthat,youcanstartdebuggingby
Youcannavigateby
indebugmode.
InDebugMode,therewillbeaviewwhichis
RegisterView
andyoucanopen
Symbols
Window
fromViewSymbolsWindowandalsoyoucanopen
Memory1
fromView
MemoryWindows
Memory1.
InRegisterView,youcanseetheregistervalues.
InSymbolsView,youcanseetheaddressofthevariablesandfunctions.
InMemory1view,youcanchangenumberrepresentationtoSignedIntandalsoyoucan
modifydatabyRightClickModifyMemoryat
Whatistheaddressofthevariable"millisecond"?
___________
2pt
Whichregisterhasthevalueofivariable?
___________
2pt
ifyouwrite0x1000Whathappens?
___________
2pt
ifyouwrite0x100Whathappens?
___________
2pt
ModifyMemoryContentof"millisecond":