NXP STAR-XL-S08 Operating instructions

Type
Operating instructions
Developingcodefor
the
element14/Freescale
XL_STARboard
DocumentRevision:1.0407/2011
2
PleasenotewhenusingtheXL_STARforUSBdevicedevelopment,viaJ1(the
USBconnectoronthetopsideoftheXL_STAR),theXL_STARmustbepowered
viaaUSBcableconnectedtoJ6(theUSBconnectorontheundersideofthe
XL_STAR)beforeaUSBcableisconnectedtoJ1.
IfUSBcablesarenotconnectedinthisordertheUSBregulatoronU1willbe
overloadedandpermanentdamagetoU1mayoccur.
ForthoseofyouwhowishtopermanentlymodifytheXL_STARboardsothat
thisdamagewillnotoccurthepicturebelowdetailsarelativelysimple
modification.InsummaryavianexttocapacitorC1onthetopsideofthe
boardmustbedrilledoutbreakingtheconnectionofthe+3.3VsupplytoC1
andC2.Thebreakinconnectivitycanbeconfirmedbyplacingamultimeter
setforresistancemeasurementbetweenthe+3.3Vsupply(topleftplated
throughhole)andthelefthandpadofC2,whichshouldshowhighimpedance.
3
Informationinthisdocumentisprovidedsolelytoenablesystemandsoftwareimplementerstouse
FreescaleSemiconductorproducts.Therearenoexpressorimpliedcopyrightlicensesgranted
hereundertodesignorfabricateanyintegratedcircuitsorintegratedcircuitsbasedonthe
informationinthisdocument.
FreescaleSemiconductorreservestherighttomakechangeswithoutfurthernoticetoanyproducts
herein.FreescaleSemiconductormakesnowarranty,representationorguaranteeregardingthe
suitabilityofitsproductsforanyparticularpurpose,nordoesFreescaleSemiconductorassumeany
liabilityarisingoutoftheapplicationoruseofanyproductorcircuit,andspecificallydisclaimsany
andallliability,includingwithoutlimitationconsequentialorincidentaldamages.“Typical”
parametersthatmaybeprovidedinFreescaleSemiconductordatasheetsand/orspecificationscan
anddovaryindifferentapplicationsandactualperformancemayvaryovertime.Alloperating
parameters,including“Typicals”,mustbevalidatedforeachcustomerapplicationbycustomer’s
technicalexperts.FreescaleSemiconductordoesnotconveyanylicenseunderitspatentrightsnor
therightsofothers.FreescaleSemiconductorproductsarenotdesigned,intended,orauthorizedfor
useascomponentsinsystemsintendedforsurgicalimplantintothebody,orotherapplications
intendedtosupportorsustainlife,orforanyotherapplicationinwhichthefailureoftheFreescale
Semiconductorproductcouldcreateasituationwherepersonalinjuryordeathmayoccur.Should
BuyerpurchaseoruseFreescaleSemiconductorproductsforanysuchunintendedorunauthorized
application,BuyershallindemnifyandholdFreescaleSemiconductoranditsofficers,employees,
subsidiaries,affiliates,anddistributorsharmlessagainstallclaims,costs,damages,andexpenses,
andreasonableattorneyfeesarisingoutof,directlyorindirectly,anyclaimofpersonalinjuryor
deathassociatedwithsuchunintendedorunauthorizeduse,evenifsuchclaimallegesthatFreescale
Semiconductorwasnegligentregardingthedesignormanufactureofthepart.
Freescale™andtheFreescalelogoaretrademarksofFreescaleSemiconductor,Inc.Allotherproduct
orservicenamesarethepropertyoftheirrespectiveowners.
©FreescaleSemiconductor,Inc.2011.Allrightsreserved
4
TableofContents
1.Introduction.......................................................................................................................6
2.XL_STARboardhardware...................................................................................................7
2.1.TopSide...............................................................................................................................7
2.2.BottomSide.........................................................................................................................8
2.3.Jumpers.............................................................................................................................10
3.TheSampleApplication.....................................................................................................11
3.1.DemoSelection.................................................................................................................11
3.2.Changingsensitivity..........................................................................................................12
3.3.Selecting8‐or14bitdata.................................................................................................13
3.4.LowPowerMode..............................................................................................................13
4.InstallingCodeWarrior.......................................................................................................14
4.1.SystemRequirements.......................................................................................................14
4.2.EasyInstall.........................................................................................................................14
4.3.InstallingtheUSBDrivers..................................................................................................17
4.4.CheckingthattheXL_STARboardisrecognisedbyWindows..........................................18
4.5.InstallingCodeWarrior6.3SEmanually............................................................................19
5.DevelopingcodefortheXL_STARBoard............................................................................21
5.1.Introduction......................................................................................................................21
5.2.SampleCodeWarriorProject............................................................................................21
5.3.TurningoffMultiDocumentInterface(MDI)mode(Optional)........................................22
5.4.TheCodeWarriorProjectwindow....................................................................................24
5.5.EditingandcompilingaFile..............................................................................................25
5.6.Buildingcode.....................................................................................................................27
5.7.Debuggingcode................................................................................................................
28
5.8.Problemsconnectingtotheboard...................................................................................31
5
5.9.Problemsdebuggingathighclockspeeds........................................................................33
6.UpdatingtheOSBDMJM60Firmwareontheboard...........................................................34
7.UnderstandingthesourcecodeoftheDemoprogram.......................................................38
7.1.Orientation........................................................................................................................38
7.2.LightingtheorangeLEDs...................................................................................................38
7.3.CommunicatingwiththeAccelerometer..........................................................................40
7.4.InterruptHandling............................................................................................................40
7.5.LowPowermode..............................................................................................................41
7.6.FloatingPointcode...........................................................................................................41
7.7.FreescaleApplicationNotesfortheMMA8451QAccelerometer....................................41
8.WritingyourowncodefortheXL_STARBoard..................................................................43
8.1.Creatinganewproject......................................................................................................43
8.2.FindingyourwayaroundtheCodeWarriorProjectWindow...........................................49
8.3.Writingsomesimplesourcecode.....................................................................................50
8.4.Buildingthenewproject...................................................................................................53
8.5.DownloadingtheprojecttotheXL_STARboard..............................................................53
8.6.Runningthecode..............................................................................................................53
6
1. Introduction
ThisdocumentdescribestheprocessofdevelopingcodeforFreescale’sXL_STAR,alowcost
developmentboardfeaturingoneofthemostrecentmembersoftheHCS08familyof8bit
microcontrollers,theMC9S08MM128.
Thedocumentwilllookatthefollowingtopics:
AnintroductiontotheXL_STARhardware
Howtousethesampleapplicationpreprogrammedontotheboard
HowtoinstallFreescale’sCodeWarriorforMicrocontrollersV6.3Integrated
DevelopmentEnvironment(IDE)onaWindowsPC
HowtocompileandbuildasampleHCS08project
ProgrammingthecodeintotheFlashmemoryontheHCS08
Debugging
WritingyourowncodefortheXL_STARboard
Ifyouarekeentoexperimentbeforereadingthismanual,justswitchontheboardandtry
thepreprogrammedapplication.Itfeaturesanumberofdemosdesignedtoshowsomeof
thethingsyoucandowiththeonboardaccelerometer.Youcanfinddetailsaboutthe
availabledemomodesinSection3.
NB:DonotconnecttheboardtoaPCuntilyouhaveinstalledCodeWarrior,becausethePC
won’trecognisetheboarduntilaUSBdriverhasbeeninstalled.
7
2. XL_STARboardhardware
TheXL_STARisadoublesidedboard.Itmaybesimplesttoimaginethatthetwosidesare
separatecircuitboardsthatarestucktogether.Asadeveloperyouwillmainlybeconcerned
withthetopside.
2.1. TopSide
Figure1:XL_STARBoard‐TopSide
8
Onthetopsideoftheboard(Figure1)isthemainmicrocontroller(MCU)‐aFreescale
MC9S08MM128.Thisisan8bitMCUbasedontheHCS08familyarchitecture,withthe
followingspecification:
128KBofFlash
12KBofRAM
Processorspeedconfigurableupto48MHz
AlsoonthetopsideisaFreescaleaccelerometer,theMMA8451Q.Thiscandetectbothits
orientation,throughthestaticpullofgravity,andanymovementoftheboardwhichcauses
accelerationordeceleration.
Thereisasetof48orangeLEDsarrangedinan8pointedstarwiththeaccelerometeratits
centre.TheLEDsareusedbythedemoprogramtoindicateinformationsuchashowthe
boardistilted.
ThreesmallpushbuttonsSW1‐SW3allowtheusertoselectdifferentaccelerometerdemos
(tilt,tap,shake,freefalldetection,etc),andtoconfiguretheaccelerometer.The
accompanyinggreenLEDsareusedbythedemoprogramtoindicatestatusinformation.
ThereisanOn/OffswitchconnectedtoaLithiumIonCoinCellbatterywhichismountedon
theundersideoftheboard.
FinallythereisaspareUSBconnectornexttotheOn/Offswitch.Youwillnotneedtouse
thisUSBconnectorunlessyouarewritingyourownapplicationwhichincludesaUSB
interface.ItisnottheUSBportwhichisusedtodebugtheboard.
2.2. BottomSide
Innormaluse,whentheXL_STARboardisnotconnectedtoaPCfordebugging,mostofthe
circuitonthebottomsideoftheboardisnotpowered.Theonlythinginuseisthebattery.
Thebottomsideoftheboard(Figure2)isrequiredwhendownloadinganewprogramfrom
thePCtobestoredintheflashontheMC9S08MM128,andwhendebuggingtheprogram.
9
Figure2:XL_STARBoard‐BottomSide
Thebottomsideoftheboardincludesthefollowingmajorcomponents:
TheLiIonbattery
Asecondary8bitmicrocontroller(aFreescaleMC9S08JM60)whichaccepts
debuggingcommandsfromthePCandformstheOpenSourceBackgroundDebug
Mode(OSBDM)interface.TheJM60thencontrolsthemainMCUonthetopsideof
theboardusingitsBDMinterface.
TheUSBportusedtoconnecttheJM60toaPC
AFreescaleMC34673batterychargerfortheLiIonbattery.
10
WhenaUSBcableispluggedintotheundersideUSBport,thepowerforbothsidesofthe
boardistakenfromthePCandregulateddownto3.3VusingaFreescaleMC34727CFC.The
batterychargerwilltopupthebatteryusingpowerdrawnfromtheUSBconnection.
NB:IfyouhaveusedotherFreescaledevelopmentsystemsyoumaybefamiliarwithasetup
inwhichthetargetboardthatyou’rewritingcodeforisconnectedtothePCviaspecial
debughardwaresuchasa‘P&E’USBBDMMULTILINK.SuchdevicestypicallyhaveaUSB
connectiontoconnecttothePC,anda6pinBDMcabletoconnecttothetargetboard.In
thecaseoftheXL_STARboardthisseparatedebuginterfaceisnotrequired;this
functionalityisprovidedbytheelectronicsonthebottomoftheboard.
2.3. Jumpers
Alsoonthetopsideoftheboardarefourjumpers.Fornormalusetheyshouldbe
configuredasfollows:
JP1FittedAccesspointformeasuringS08MM128MCUcurrent
JP2NotfittedWhenfitted,theJM60actsasaUSBtoSerialconverter
(Requiresadditionalsoftware)
JP3NotfittedWhenfitted,theJM60runsabootloaderoutofreset,
allowingupdatingoftheOSBDMdebugfirmware.(See
Section0).
JP4FittedAccesspointformeasuringMMA8451Qaccelerometer
current
11
3. TheSampleApplication
TheXL_STARboardcomeswithasampleapplicationalreadyprogrammedintotheonchip
FlashoftheMM128MCU.Theprogramisdesignedtoshowsomeofthethingsthatcanbe
donewiththeonboardMMA8451Qaccelerometer.
Whenfirstpoweredon,theboardwillgointoan'orientation'demomode.Trypickingthe
boardupandtippingitindifferentdirections.YoushouldseethattheorangeLEDs
illuminatetoindicatethedirectionofthetipanditsmagnitude.
3.1. DemoSelection
YoucanselectbetweenfivedifferentdemosbyrepeatedlypressingbuttonSW3,labelled
ChanasshowninFigure3.ThecurrentdemomodewillbeindicatedbythegreenLEDs
D6D10.
Theavailabledemomodesare:
Orient:TrytippingtheboardandwatchtheorangeLEDsindicatethedirectionand
magnitudeoftip
Shake: Tryflickingtheboardinadirection,eitherupordown,leftorright,or
forwardorback.Youneedtouseasharpflick,likestrikingaballinagameof
tabletennis.TheorangeLEDswillpointinthedirectionoftheinitialflick,re
settingafteracoupleofseconds.
Iftheinitialflickisnotfastenough,theaccelerometermayinsteaddetect
thereboundeventasyourhandstopstheboard’smovement.Inthiscase
thereversedirectionwillbeilluminated.
Tap: Holdtheboardlooselyandtapitoncewithyourfinger;theLEDswillshowa
'pulse'pattern.Taptwiceinquicksuccession(doubletap)togetadifferent
animatedpattern.
Freefall: Droptheboardfromtheheightofafewcentimetresormore.Thefreefall
eventwillbedetectedanddisplayedontheLEDsforacoupleofseconds.
Transient: TheorangeLEDswillallilluminateiftheboardismoving(strictly,ifitis
acceleratingordecelerating)andturnsoffafterashortwhileiftheboardis
stationary.
12

Figure3:Demomodeselection
3.2. Changingsensitivity
TheaccelerometersensitivitycanbechangedbypressingbuttonSW1,labelledGsel.This
selectswhichmultipleofnormalgravitycorrespondstoafullscaleaccelerometerreading.
Theoptionsare2g,4gand8gasindicatedbythegreenLEDsD3D5.
Notethatchangingthesensitivityonlyaffectsthe'Orient'demo,becausetheother
accelerometerfunctionsusedheredon'tdependonthesensitivitysetting.
13
3.3. Selecting8or14bitdata
Theaccelerometercanreturn8bitor14bitdatatotheMM128MCU.Applications
requiringmoreaccuracycanuse14bitdata;otherwiseitisfastertoread8bitdata.Youcan
selectbetweenthetwooptionsbypressingtheSW2button,labelledDataW,seeFigure3.
ThecurrentselectionisshownonthegreenLEDsD1D2.
Changingbetween8bitand14bitdataonlyaffectsthe'Orient'demobut,althoughthe
datawidthsettingishonoured,youprobablywon'tnoticethedifference.SeeSection7.3
formoreinformation.
3.4. LowPowerMode
Whentheaccelerometerdoesn'tdetectanyinterestingeventsi.e.accelerationor
decelerationforaround20seconds,softwarewillputtheboardintoapowersavingmode.
Sothatyoucanseethishappening,an'X'patternisdisplayedbrieflybeforealmostallthe
LEDsturnoff.
Towaketheboardup,justpickitup.A'+'patternisdisplayedbrieflytoindicatethatthe
boardisawakeagain,andthecurrentdemomodeisthenresumed.SeeSection7.5for
moreinformation.
14
4. InstallingCodeWarrior
NB:DonotconnecttheboardtoaPCuntilyouhaveinstalledCodeWarrior,becausethePC
won’trecognisetheboarduntilaUSBdriverhasbeeninstalled.
TheXL_STARdevelopmentkitincludesacopyofCodeWarriorforMicrocontrollersV6.3
SpecialEdition.CodeWarriorisanintegrateddevelopmentenvironmentforediting,
compilinganddebuggingcode.TheSpecialEditionisfree,buttheCcompilerislimitedtoa
maximumof32KBofobjectcode.InlaterreleasesofCodeWarriorforMicrocontrollersV6.3
SpecialEditionthiswasincreasedto64KBofobjectcode,pleasechecktheFreescalewebsite
forthelatestrelease‐
http://www.freescale.com/webapp/sps/site/overview.jsp?code=CW_SPECIALEDITIONS&tid
=CWH
4.1. SystemRequirements
1.0GHzPentiumcompatibleprocessororbetter
MicrosoftWindowsXPorlater
512MBRAM(1GBrecommended)
2GBharddiskspaceonWindowssystemdisk
CDROMdriveforinstallation
USBportforcommunicationswithtargethardware
4.2. EasyInstall
ThesoftwarefortheXL_STARdevelopmentkitissuppliedonCD.WhenyouinserttheCD,
theautorunfeatureshouldlaunchtheXL_STARStarterKitInstallationWizard.Alternatively
youcandoubleclickonthefileinstall_all.htatorunthewizard.
Initialinstallationrequiresthecompletionofsixinstallsteps(Figure4),thefirstfiveofwhich
launchaseparateinstaller.Followtheonscreeninstructionstocompleteeachstep.
15
Figure4:XL_STARStarterKitinstallationwizard
Notethattheremaybealongdelaybetweenclickingononeofthebuttonsandthe
individualinstallerstartingup.Pleasebepatient.
Makesureyouwaitforeachinstallsteptocompletebeforegoingontothenextstep.
AttheendofStep1,whichinstallsthebaseCodeWarriorsoftware,youwillseeadialog
askingwhetheryouwanttocheckforonlineupdates(Figure5).Donotcheckforupdates
atthistime.
16
Figure5:Donotcheckforupdateswhenthefirstinstallercompletes
DuringStep3youwillseeawarningmessagethatProcessorExpertv3.09ServicePackisnot
installed(Figure6).Ignorethiswarningandcontinuewiththeinstallationanyway.
Figure6:IgnorethewarningaboutProcessorExpert
17
Step5allowsyoutoinstallademonstrationCodeWarriorprojectforusewiththeXL_STAR
board.Installthisinafolderthatiseasilywritable‐forexample,usetheDocumentsfolder
notC:\Program FileswhichisprotectedunderWindowsVistaandlaterOSversions.
UsingthedemonstrationprojectisdescribedindetailinSection5.
4.3. InstallingtheUSBDrivers
TheXL_STARboardrequiresanumberofUSBdrivers.Althoughthedriverswerepartially
installedinStep4aboveyoumayneedtocarryoutsomeadditionalconfiguration,
dependingontheversionofWindowsyouareusing.Whendoingthisyoushouldnotethat
therearethreedriversintotal,andtheprocesswillneedtoberepeatedforeach.Thethree
driversareasfollows:
OSBDMDebugPort
OSBDMSerialPort
OSBDMBootloaderPort
Toinstallthefirsttwodrivers,makesurethatjumperJP3ontheXL_STARboardisnotfitted.
ThenconnecttheboardtothePCusingaUSBcable.Youshouldseeadialogsimilartothe
following(Figure7):
Figure7:InstallingtheOSBDMDebugPortdriver
18
Windowswilllookforasuitabledriverinanumberoflocations,butfailtofindone.Youwillthenbe
giventheoptionofspecifyingthedriverlocationmanually(Figure8).Specifythefolderinwhichyou
installedtheP&EDriversinStep4above,e.g.C:\Program Files\PEMicro
Figure8:SpecifyingthelocationoftheOSBDMDebugPortdriver
AftersuccessfulinstallationoftheOSBDMDebugPortdriver,youwillbepromptedtorepeat
thestepsfortheOSBDMVirtualSerialPort.
Finally,disconnectthecable,installjumperJP3andthenreconnectthecable.Youwillbe
promptedoncemoretocompletethestepsfortheOSBDMBootloaderPort.
Afterinstallingthelastdriver,removejumperJP3andreconnecttheboardoncemore,
readyfornormaloperation.
4.4. CheckingthattheXL_STARboardisrecognisedbyWindows
YoucancheckthattheboardisrecognisedbyWindowsusingtheDeviceManager.Withthe
boardconnectedtothePCandJumperJP3notinstalled,theboardwillshowuptwice
(Figure9):
19
OpenSourceBDMDebugPortinthesectionLibUSBWin32Devices
PEMicroUSBSerialPort(i1)inthesectionJungo
Figure9:WindowsDeviceManagershowingUSBconnectionstoXL_STARboard
4.5. InstallingCodeWarrior6.3SEmanually
InsteadofusingtheinstallationwizarddescribedinSection4.2above,youcanalsoproceed
manually,usingtheindividualinstallerssuppliedontheCDinthefollowingorder:
(1)InstallCodeWarriorforMicrocontrollersV6.3
CW_MCU_V6_3_SE.exe
(2)InstalltheCodeWarriorforMicrocontrollersV6.3.1update
CWMCUV631.exe
20
(3)InstalltheMM128specificpatches
CW08_V6_3_HCS08_MM128_JE128_SP.exe
(4)InstallthelatestUSBdriversneedwhendebuggingcodeontheboard
PEDrivers_install.exe
(5)InstallthesampleXL_STARCodeWarriorproject
setup_sample_project.exe
  • Page 1 1
  • Page 2 2
  • Page 3 3
  • Page 4 4
  • Page 5 5
  • Page 6 6
  • Page 7 7
  • Page 8 8
  • Page 9 9
  • Page 10 10
  • Page 11 11
  • Page 12 12
  • Page 13 13
  • Page 14 14
  • Page 15 15
  • Page 16 16
  • Page 17 17
  • Page 18 18
  • Page 19 19
  • Page 20 20
  • Page 21 21
  • Page 22 22
  • Page 23 23
  • Page 24 24
  • Page 25 25
  • Page 26 26
  • Page 27 27
  • Page 28 28
  • Page 29 29
  • Page 30 30
  • Page 31 31
  • Page 32 32
  • Page 33 33
  • Page 34 34
  • Page 35 35
  • Page 36 36
  • Page 37 37
  • Page 38 38
  • Page 39 39
  • Page 40 40
  • Page 41 41
  • Page 42 42
  • Page 43 43
  • Page 44 44
  • Page 45 45
  • Page 46 46
  • Page 47 47
  • Page 48 48
  • Page 49 49
  • Page 50 50
  • Page 51 51
  • Page 52 52
  • Page 53 53
  • Page 54 54

NXP STAR-XL-S08 Operating instructions

Type
Operating instructions

Ask a question and I''ll find the answer in the document

Finding information in a document is now easier with AI