Communication System Design Using DSP Algorithms .pdf

Communication System Design Using DSP Algorithms .pdf

ID:34817001

大小:2.25 MB

页数:352页

时间:2019-03-11

上传者:不努力梦想只是梦
Communication System Design Using DSP Algorithms .pdf_第1页
Communication System Design Using DSP Algorithms .pdf_第2页
Communication System Design Using DSP Algorithms .pdf_第3页
Communication System Design Using DSP Algorithms .pdf_第4页
Communication System Design Using DSP Algorithms .pdf_第5页
资源描述:

《Communication System Design Using DSP Algorithms .pdf》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库

CommunicationSystemDesignUsingDSPAlgorithmswithLaboratoryExperiments™fortheTMS320C6713DSK InformationTechnology:Transmission,Processing,andStorageSeriesEditors:RobertGallagerElectricalEngineering&ComputerScienceMassachusettsInstituteofTechnologyCambridge,MassachusettsJackKeilWolfElectrical&ComputerEngineeringUniversityofCaliforniaatSanDiegoLaJolla,California CommunicationSystemDesignUsingDSPAlgorithmswithLaboratoryExperiments™fortheTMS320C6713DSKStevenA.TretterUniversityofMarylandCollegePark,MD13 StevenA.TretterDepartmentofElectricalEngineeringUniversityofMarylandCollegePark,MD,20742,USASeriesEditorsRobertGallagerJackKeilWolfElectricalEngineering&ComputerScienceElectricalandComputerEngineeringMassachusettsInstituteofTechnologyUniversityofCaliforniaatSanDiegoCambridge,MassachusettsLaJolla,CaliforniaISBN:978-0-387-74885-6e-ISBN:978-0-387-74886-3LibraryofCongressControlNumber:2007940172¬2008SpringerScience+BusinessMedia,LLCAllrightsreserved.Thisworkmaynotbetranslatedorcopiedinwholeorinpartwithoutthewrittenpermissionofthepublisher(SpringerScience+BusinessMedia,LLC,233SpringStreet,NewYork,NY10013,USA),exceptforbriefexcerptsinconnectionwithreviewsorscholarlyanalysis.Useinconnectionwithanyformofinformationstorageandretrieval,electronicadaptation,computersoftware,orbysimilarordissimilarmethodologynowknownorhereafterdevelopedisforbidden.Theuseinthispublicationoftradenames,trademarks,servicemarks,andsimilarterms,eveniftheyarenotidentifiedassuch,isnottobetakenasanexpressionofopinionastowhetherornottheyaresubjecttoproprietaryrights.ThefollowingaretrademarksofTexasInstruments:CodeComposerStudio,TMS320C30,C6000,C6x,TMS320C5000,TMS320C3x,TMS320C40,C67x,C2x,C24x,C5x,C8x,C54x,C55x,andTMS320C67x.MATLABisaregisteredtrademarkofMathWorks.Printedonacid-freepaper987654321springer.com ToTeresa,Anne,Jeffrey,Max,Norah,andinmemoryofDavid PrefaceThefirsteditionofthisbookbeganinJanuary1993whenIwas“elected”byDr.WilliamDestler,whowasthenChairmanoftheElectricalEngineeringDepartmentattheUniversityofMarylandandisnowPresidentoftheRochesterInstituteofTechnology,tosetupandwriteexperimentsforanewseniorelectivelaboratorycourse,ENEE418cCommunicationsLaboratory,scheduledtobegivenforthefirsttimeintheFall1993semester.Atthattime,wechosetousethestate-of-the-artTexasInstrumentsTMS320C30EVM(evaluationmodule)DSPboard.InJanuary2001weupgradedthelabtousethenewstate-of-the-artTexasInstrumentsTMS320C6701EVMDSPboardwhichisnownolongersupportedbyTI.StartingwiththeFall2007semester,wewilluseTI’sTMS320C6713DSKwhichisrelativelyinexpensiveandconnectsconvenientlytoaUSBportofamodernPC.Thelab’sPC’sareallconnectedtothecampusnetwork.Eachlabgroupisgivenaprivateworkspaceonadepartmentalserver.Studentsaregivenonlyread/executeprivilegesforthestandardutilityanddevelopmentsoftwareonthePC’ssotheydonotinadvertentlyalterthesefiles.In1993,booksforhardwarebasedlaboratorycourseswithstandarddigitalsignalpro-cessingandfilterdesignexperimentsexisted,butnobookfocusingonanaloganddigitalcommunicationstechniqueswasavailable.Thisisstilllargelytrue.LaboratoriesintheDepartmentofElectricalandComputerEngineeringattheUniversityofMarylandareseparatecourses.Eachweektheyhaveaonehourlecturegivenbyaregularfacultymembertointroducethetheoryandexplaintheexperimentsfollowedbyathreehourlaboratoryperiodrunbyagraduateteachingassistant.Studentsinthislabworkinpairs.Wehavefoundthatthisworkswellbecausebothgroupmembersactivelyparticipate.Withgroupsofthreeormore,somemembersjustsitandwatch.Studentshavecardkeyaccesstothelaboratoryfrom8:00AMto11:00PMsevendaysaweekandsotheycanworkoutsideofregularclasshoursiftheywish.OnesectionofthelabwasfirstofferedintheFall1993semesterandtwointheSpring1994semester.Thenfivesectionsaweekwereofferedforseveralyearsuntilacoupleofyearsagowhenanewcommunicationscapstonedesigncoursewasofferedinaddition.Thestu-dentshavebeenhighlyenthusiasticandoftenspendextrahoursworkingontheexperimentsbecausetheyfindthemtobeveryinterestingandchallenging.Theyalsohaverealizedthatthiscoursewillhelpthemgetjobsandprovidethemwiththeskillsrequiredtoperformwellintheirfuturejobs.Thelabwasdesignedforseniors,but1/4to1/3oftheclassisnowgraduatestudentswhowanttolearnsomereal-worldpracticalskillsinadditiontothepurelytheoreticalconceptspresentedinthetypicalgraduatecommunicationsandsignalprocessingcourses.Whenaskedwhytheyaretakingthisseniorclass,thegraduatestudentsoftensaytheythinkitwillhelpthemgetjobs.vii viiiPrefaceThegoalofthissetofexperimentsistoexplorethedigitalsignalprocessingandcom-municationsystemstheoreticalconceptspresentedintypicalseniorelectivecoursesonthesesubjectsbyimplementingthemwithactualhardwareandinrealtime.Intheprocess,studentswillgainexperienceusingequipmentcommonlyusedinindustry,suchas,oscillo-scopes,spectrumanalyzers,signalgenerators,errorratetestsets,digitalsignalprocessors,andanalog-to-digitalanddigital-to-analogconverters.Theywillalsolearnabouttypicalsoftwaredevelopmenttools.Inaddition,theywilllearnthatthereisabigstepingoingfromanequationonpapertoarealworkingsystem.Thisbookdiffersfromanyothersonthemarketinthatitsprimaryfocusisoncommuni-cationsystems.FundamentaldigitalsignalprocessingconceptslikedigitalfiltersandFFT’sareincludedbecausetheyarerequiredincommunicationsystems.Approachesthatarepar-ticularlyusefulforDSPimplementationsarepresented.Whiletheexperiments,particularlytheearlierones,aredescribedfortheTMS320C6713DSK,theycanbeeasilymodifiedforanyDSPboardwithanA/DandD/Aconverter.Thereareseveralbooksondigitalsignalprocessingexperimentsforstablesoftwarepack-ageslikeMATHCADandMATLAB.Inmyview,oneofthepurposesofalaboratorycourseistohelppreparestudentsforindustrialjobs.Off-linesoftwaresimulationisnosubstituteformakingactualhardwareworkinreal-time.Itdoesnotpresentstudentswiththestrangeunexpectedandoftenfrustratingthingsthatoccurwhenusingactualhardwareinreal-timewhichcannotbeexplainedbyniceequations,nordoesitteachthemhowtousestandardlabequipment.TheprerequisitesforthiscourseareanunderstandingoflinearsystemsandtransformmethodsatalevelthatisoftenpresentedinajuniorrequiredcourseonSignalsandSystemsandaworkingknowledgeofPC’sandCprogramming.StudentswhohaveprogrammedinotherlanguageslikeBASIC,PASCAL,orFORTRANcanquicklylearnenoughCtodotheexperimentsiftheyarewillingtomaketheeffort.CorequisiteareaseniorlevelelectivecourseinDigitalSignalProcessingand/orCommunicationSystems.Ideally,bothcoursesshouldbetakenbeforetheCommunicationsLaboratory.However,thisisnotusuallypossibleforourseniors.Wewantedourstudentstohavetheopportunitytotakethislab,sowemadejustoneofthemacorequisite.Withtheengineeringbackgroundofasenior,thepresentationofthenecessarytheoryinthetext,andtheonehourlablecturetoexplainthetheory,studentshavequicklylearnedthesignalprocessingandcommunicationsystemconceptsrequiredfortheexperiments.Inaddition,itcanbearguedthatalabcourseshouldhelppreparestudentsfortheworkworldwheretheywillhavetofigureoutnewthingsforthemselvessotheexperimentsshouldhavesomeuncertaintyandrequirestudentstofillinsomeofthedetails.Thereisalargeinitialhurdleforthestudentstogetoverwhilelearningthedetailsre-quiredtousethelab’shardwareandsoftwaretools.Chapters1and2graduallyintroducethemtothesetoolsandthearchitectureoftheTMS320C6713floating-pointDSP.Anat-tempthasbeenmadetoreducethishurdlebyincludingsomebasicprogramsontheprogramdiskforinitializingtheDSKthatcanbeusedasastartingpointfortheexperiments.FIRandIIRfilterdesignandimplementationareexploredinChapter3.Filtersarere-quiredinmanycommunicationsystemsignalprocessingalgorithms.ExperimentscomparingtherelativemeritsofCandassemblylanguageimplementationsareperformed.Inparticu- Prefaceixlar,TI’slinearassemblyisbrieflydiscussed.ModernDSPapplicationsinindustryareoftenwrittenprimarilyinCwithonlynumericallyintensivecriticalfunctionswritteninassemblytoreducedevelopmenttimeandimproveportabilitytonewplatforms.TI’soptimizingCcompilergeneratesrelativelyefficientsoftwarepipelinedexecutablecodethatisadequatefortheexperimentsinthiscourse.Therefore,assemblyprogrammingisnotemphasized.Chapter4investigatestheFFTandpowerspectrumestimation.Asimplespectrumanalyzerismade.Chapters5through8exploretheclassicalanalogcommunicationmethodsofampli-tudemodulation,double-sidebandsuppressed-carrieramplitudemodulation,single-sidebandmodulation,andfrequencymodulation.TransmittersandreceiversarebuiltusingDSPtechniques.Noncoherentreceiversusingenvelopedetectorsandcoherentreceiversusingphase-lockedloopsareimplemented.TheuseofHilberttransformsandcomplexsignalrepresentationsinmodulationsystemsareexplored.Chapters9through16introducesomedigitalcommunicationtechniques.Theseex-perimentsfocusonmethodsusedinhigh-speedwire-linedatamodemswhereDSP’shavebeenextensivelyused.Topicscoveredincludelinearshiftregisterscramblers,theRS232Cinterface,pulseamplitudemodulation(PAM),variablephaseinterpolation,andquadra-tureamplitudemodulation(QAM).TheexperimentsleaduptobuildingalmostacompleteV.22bistransmitterandreceiver.Symbolclockrecoveryandtracking,carriertracking,andadaptiveequalizerreceiverfunctionsareimplemented.TheechocancelingtechniqueusedinV.32,V.34,V.90,andV.92modemsisstudiedinChapter16.Enoughdetailsareincludedsothatthissetofexperimentscouldformagoodpracticalguidetoengineersinindustryinter-estedinwire-linemodemdesign.Ilearnedmanyofthesetechniqueswhileconsultingsince1970forcompaniesthatbuildhigh-speedwire-linemodemsandhaveseenthememployedinhundredsofthousandsofmodems.Multi-carriermodulationhasbecomepopularinavarietyofsystems.ItisemployedinseveraltypesofDigitalSubscriberLine(DSL)systemswhichusecoppertelephonelineswhereitiscalledDiscreteMulti-Tone(DMT)modulation.ItisapopularchoiceforwirelesssystemstransmittingoverfadingchannelswhereitiscalledOrthogonalFrequencyDivisionMultiplexing(OFDM).TheseincludeexistingHFradioandWi-FisystemsaswellassoontobedeployedWiMaxsystems.TheEuropeancellular3GPPcommitteesareworkingtofinalizeamulti-carriersystemcalledLTE.Multi-carriermodulationisexploredinChapter17.Chapter18brieflypresentssomeideasforadditionalprojectsrelatedtohigh-speedwire-linemodemdesign,error-controlcoding,andspeechcodecs.TheseideascanbeexpandedtosatisfythecapstonedesignprojectrequirementsoftheABETaccreditingcommittee.AppendixCcontainsacompletelistoftheequipmentusedforthislaboratoryattheUniversityofMaryland.Ithasbeenincludedasaguidetootherssettingupasimilarlabandisnotintendedtobeanendorsementofanyspecificmanufacturer.Clearly,anyequipmentwithequivalentcapabilitiescanbesubstitutedforitemsinthelist.Therearemanymoreexperimentsinthisbookthancanbeperformedinonesemester.Basedonourexperience,anambitiousgoalistohaveallstudentsdoChapters1,2,and3followedbyachoiceofanythreeadditionalexperiments.Insomesemesters,wehavelimitedthechoicetothreeoftheclassicalanalogmodulationchaptersandinotherstothreeofthe xPrefacedigitalcommunicationchapters.Itwouldbeniceifstudentscouldcontinueinthelabforasecondsemesterforadditionalcreditandbuildontheirearlierexperiments.Utilityprograms,softwareupdates,textcorrections,lablectureslides,andsupplementarymaterialcanbefoundonmywebsitewww.ece.umd.edu/~tretter.StevenA.Tretter AcknowledgementsIwouldliketothankMarkKohlerandSonjaiGuptaforhelpingtounpackequipmentandinstallanddebughardwareandsoftwareinthePC’sduringtheSpring1993semesterwhenthelabwasinitiallybeingsetup.ThestudentsintheoriginalCommunicationsLaboratorysectionofferedintheFall1993semesteraswellastheirTeachingAssistant,YifengCui,deserveagreatdealofthanksforbeingextremelypatientandenthusiasticGuineapigs.Theyhelpedcorrectandsignificantlyimprovethefirstfewexperiments.Inparticular,IwanttothankMikeBarrwho,withhispartnerBrianSilverman,forgedwellaheadoftherestofthestudentsandwassoenthusiasticbytheendofthesemesterthatheaskedabouthelpingwiththelabintheSpring1994semester.TheElectricalEngineeringDepartmentwasabletomakeanexceptionandassignMikeasaseniortobetheTAforonesectionandhedidanoutstandingjob.Mrs.TaherehFazelwasalsoanexcellentGraduateTAforasecondlabsectionintheSpring1994semester.IalsowanttothankthosewhohavebeenTA’sforthelabsincethattimeandhavealldoneexcellentjobs,aswellasDr.AdrianPapamarcouandDr.JeromeGansmanwhohavesharedinteachingthelab.JayRenneroftheUniversityofMarylandECEstaffalsodeservesthanksforlayingoutandgettingmanufacturedtheRS232/TTLdaughtercards,andforsecuringtheTMS320C6713DSK’sinsidethePCcases.Dr.BrianEvansoftheUniversityofTexasatAustinalsodeservesthanksforreviewingpreliminaryversionsofthepreviouseditionofthisbookandmakinggoodsuggestionsforimprovements.IwouldalsoliketothankmyfriendsfromRIXON(whichwasinSilverSpring,MD,buthaslongsincedissipatedinachainofcorporatetake-overs),fromPenrilDatabilityNetworks(whichwasinGaithersburg,MD,andwasboughtbyBayNetworks,whichwasinturnboughtbyNortelNetworks,becametheSignalProcessingGroupofNortelinGermantown,MD,andisnowgone),andatTexasInstrumentsinGermantown,MD(whichwasformerlyTelogyNetworks)forhelpingmestayatthestate-of-the-artinDSPapplicationstowire-lineandwirelessmodemsbyusingmeasaconsultant.IalsowanttothankTexasInstrumentsfordesignatingourlabasoneoftenEliteDigitalSignalProcessingLabsinthecountry.TIhasbeenverygenerousinsupportingourlabwithTIhardwareandsoftwaretools.Inparticular,TorrenceRobinson,formerlyinchargeofUniversityProgramsatTIinHouston,andnowCathyWicksdeservemanythanksfortheirconstantandcheerfulsupport.xi Contents1OverviewoftheHardwareandSoftwareTools11.1SomeDSPChipHistoryandTypicalApplications...............21.2TheTMS320C6713Floating-PointDSP.....................61.2.1The’C6000CentralProcessingUnit(CPU)..............61.2.2MemoryOrganizationfortheTMS320C6713DSK...........111.2.3EnhancedDirectMemoryAccessController(EDMA).........111.2.4SerialPorts................................121.2.5OtherInternalPeripherals........................131.2.6BriefDescriptionoftheTMS320C6000InstructionSet........131.2.7ParallelOperationsandPipelining...................161.3TheTMS320C6713DSPStarterKit(DSK)..................181.3.1TheAudioInterfaceOnboardtheTMS320C6713DSK........201.4SoftwareSupportfortheDSKBoardand’C6xDSP’s.............211.4.1TheBoardSupportLibrary(BSL)...................211.4.2TheChipSupportLibrary........................221.5CodeComposerStudio..............................221.5.1ProjectFilesandBuildingPrograms..................221.5.2TheOptimizingCompilerandAssembler................231.5.3TheLinker................................251.5.4BuildingProgramsfromCommandLinePrompts...........251.5.5TheArchiver...............................261.5.6AdditionalCodeComposerStudioFeatures..............261.6OtherSoftware..................................271.6.1DigitalFilterDesignPrograms.....................271.6.2CommercialSoftware...........................271.7IntroductoryExperiments............................282LearningtoUsetheHardwareandSoftwareTools292.1GettingStartedwithaSimpleAudioLoopThroughProgram........292.1.1ALinkerCommandFileandBeginningCProgram..........292.1.2PropertiesoftheAIC23Codec.....................352.1.3CreatingaCCSProjectfordskstart32.c...............362.1.4Experiment2.1:BuildingandTestingdskstart32.c.........372.2MoreDetailsontheMcBSPSerialPortsandCodecs.............38xiii xivContents2.2.1BasicMcBSPTransmitterandReceiverOperation..........382.2.2ExampleCCodeforReadingfromandWritingtotheCodec.....412.3The’C6000Timers................................422.4GeneratingaSineWavebyPollingXRDY...................432.4.1Experiment2.2:InstructionsforthePollingExperiment.......452.5GeneratingaSineWaveUsingInterrupts....................462.5.1TheCPUInterruptPrioritiesandSources...............462.5.2InterruptControlRegisters.......................462.5.3WhatHappensWhenanInterruptOccurs...............502.5.4TIExtensionstoStandardCInterruptServiceRoutines.......512.5.5Usingthedsk6713bsl32LibraryforInterrupts.............512.5.6Experiment2.3:GeneratingSineWavesbyUsingInterrupts.....532.6GeneratingaSineWavewiththeEDMAandaTable............562.6.1EDMAOverview.............................562.6.2EDMAEventSelection..........................572.6.3RegistersforEventProcessing.....................582.6.4TheParameterRAM(PaRAM).....................592.6.5SynchronizationofEDMATransfers..................602.6.6LinkingandChainingEDMATransfers.................612.6.7EDMAInterruptstotheCPU......................622.6.8Experiment2.4:GeneratingaSineWaveUsingtheEDMAController623DigitalFilters673.1Discrete-TimeConvolutionandFrequencyResponses.............673.2FiniteDurationImpulseResponse(FIR)Filters................683.2.1BlockDiagramforMostCommonRealization.............683.2.2TwoMethodsforFindingtheFilterCoefficientstoAchieveaDesiredFrequencyResponse...........................693.3UsingCircularBufferstoImplementFIRFiltersinC.............723.4CircularBuffersUsingthe’C6000Hardware..................753.4.1HowtheCircularBufferisImplemented................753.4.2IndirectAddressingThroughRegisters.................763.5InterfacingCandAssemblyFunctions.....................763.5.1ResponsibilitiesoftheCallingandCalledFunction..........763.5.2UsingAssemblyFunctionswithC....................793.6LinearAssemblyCodeandtheAssemblyOptimizer..............793.6.1ALinearAssemblyConvolutionFunctionthatUsesaCircularBufferandCanbeCalledfromC........................813.7InfiniteDurationImpulseResponse(IIR)Filters................893.7.1RealizationsforIIRFilters........................893.7.2AProgramforDesigningIIRFilters..................923.7.3TwoMethodsforMeasuringaPhaseResponse.............953.8LaboratoryExperimentsforDigitalFilters...................963.8.1Experiment3.1:FIRFiltersEntirelyinC...............96 Contentsxv3.8.2Experiment3.2:FIRFiltersUsingCandAssembly..........973.8.3Experiment3.3:ImplementinganIIRFilter..............983.9AdditionalReferences...............................984TheFFTandPowerSpectrumEstimation1014.1TheDiscrete-TimeFourierTransform......................1014.2DataWindowFunctions.............................1024.3TheDiscreteFourierTransformanditsInverse.................1044.4TheFastFourierTransform...........................1044.5UsingtheFFTtoEstimateaPowerSpectrum.................1124.6LaboratoryExperiments.............................1134.6.1Experiment4.1:FFTExperiments...................1134.6.2Experiment4.2:MakingaSpectrumAnalyzer.............1144.7AdditionalReferences...............................1185AmplitudeModulation1215.1TheoreticalDescriptionofAmplitudeModulation...............1215.1.1MathematicalFormulaforanAMSignal................1215.1.2ExampleforSingleToneModulation..................1225.1.3TheSpectrumofanAMSignal.....................1235.2DemodulatinganAMSignalbyEnvelopeDetection..............1235.2.1Square-LawDemodulationofAMSignals................1245.2.2HilbertTransformsandtheComplexEnvelope.............1255.3LaboratoryExperimentsforAMModulationandDemodulation.......1275.3.1Experiment5.1:MakinganAMModulator..............1285.3.2HowtoCaptureDSKOutputSampleswithCCSforPlotting....1295.3.3Experiment5.2:MakingaSquare-LawEnvelopeDetector......1305.3.4Experiment5.3:MakinganEnvelopeDetectorUsingtheHilbertTrans-form....................................1315.4AdditionalReferences...............................1326DSBSCAmplitudeModulationandCoherentDetection1336.1MathematicalFormforaDSBSC-AMSignal..................1336.2TheIdealCoherentReceiver...........................1346.3TheCostasLoopasaPracticalApproachtoCoherentDemodulation....1366.4ExercisesandExperimentsfortheCostasLoop................1386.4.1TheoreticalDesignExercises.......................1396.4.2HardwareExperiments..........................1406.5AdditionalReferences...............................1417Single-SidebandModulationandFrequencyTranslation1437.1Single-SidebandModulators...........................1437.2CoherentDemodulationofSSBSignals.....................1457.3FrequencyTranslation..............................1467.4LaboratoryExperiments.............................147 xviContents7.4.1Experiment7.1:MakinganSSBModulator..............1487.4.2Experiment7.2:CoherentDemodulationofanSSBSignal......1487.5AdditionalReferences...............................1508FrequencyModulation1518.1TheFMSignalandSomeofitsProperties...................1518.1.1DefinitionofInstantaneousFrequencyandtheFMSignal.......1518.1.2SingleToneFMModulation.......................1528.1.3NarrowBandFMModulation......................1548.1.4TheBandwidthofanFMSignal....................1548.2FMDemodulationbyaFrequencyDiscriminator................1548.2.1AnFMDiscriminatorUsingthePre-Envelope.............1558.2.2ADiscriminatorUsingtheComplexEnvelope.............1568.3UsingaPhase-LockedLoopforFMDemodulation...............1578.4LaboratoryExperimentsforFrequencyModulation..............1608.4.1Experiment8.1:MeasuringtheSpectrumofanFMSignal......1608.4.2Experiment8.2:FMDemodulationUsingaFrequencyDiscriminator1618.4.3Experiment8.3:UsingaPhase-LockedLoopforFMDemodulation.1618.5AdditionalReferences...............................1629Pseudo-RandomBinarySequencesandDataScramblers1639.1UsingShiftRegisterstoGeneratePseudo-RandomBinarySequences....1649.1.1TheLinearFeedbackShiftRegisterSequenceGenerator.......1649.1.2TheConnectionPolynomialandSequencePeriod...........1659.1.3PropertiesofMaximalLengthSequences................1669.2SelfSynchronizingDataScramblers.......................1679.2.1TheScrambler..............................1679.2.2TheDescrambler.............................1699.3TheoreticalandSimulationExercises......................1699.3.1ExercisesforaShiftRegisterSequenceGeneratorwithaPrimitiveConnectionPolynomial..........................1699.3.2ExercisesforaShiftRegisterSequenceGeneratorwithanIrreduciblebutnotPrimitiveConnectionPolynomial................1709.3.3ExercisesforaShiftRegisterSequenceGeneratorwithaReducibleConnectionPolynomial..........................1719.4AdditionalReferences...............................17110TheRS-232CProtocolandaBit-ErrorRateTester17310.1TheEIARS-232CSerialInterfaceProtocol...................17310.2ErrorRateforBinarySignalingontheGaussianNoiseChannel.......17610.3TheNavtelDatatest3BitErrorRateTester..................17710.4Bit-ErrorRateTestExperiment.........................17810.5AdditionalReferences...............................185 Contentsxvii11DigitalDataTransmissionbyPulseAmplitudeModulation18711.1DescriptionofaBasebandPulseAmplitudeModulationSystem.......18711.2BasebandShapingandIntersymbolInterference................19011.2.1TheNyquistCriterionforNoISI....................19011.2.2RaisedCosineBasebandShapingFilters................19111.2.3SplittingtheShapingBetweentheTransmitandReceiveFilters...19211.2.4EyeDiagrams...............................19211.3ImplementingtheTransmitFilterbyanInterpolationFilterBank......19411.4SymbolErrorProbabilitywithAdditiveGaussianNoise............19411.5SymbolClockRecovery..............................19611.6SimulationandTheoreticalExercisesforPAM.................19811.6.1GeneratingFour-LevelPseudo-RandomPAMSymbols........19811.6.2EyeDiagramforaPAMSignalUsingaRaisedCosineShapingFilter19911.6.3EyeDiagramforaPAMSignalUsingaSquare-RootofRaisedCosineShapingFilter...............................19911.6.4TheoreticalErrorProbabilityforaPAMSystem............20011.7HardwareExercisesforPAM...........................20011.7.1GeneratingaPAMSignalandEyeDiagram..............20011.7.2TestingtheSquare-LawSymbolClockFrequencyGenerator.....20111.7.3OptionalTeamExercise.........................20211.8AdditionalReferences...............................20312VariablePhaseInterpolation20512.1ContinuouslyVariablePhaseInterpolation...................20512.1.1ComputingtheLeast-SquaresFits....................20812.2QuantizedVariablePhaseInterpolation.....................20812.3ClosingtheTrackingLoop............................20912.4ChangingtheSamplingRatebyaRationalFactor...............21112.5ExperimentsforVariablePhaseInterpolation.................21312.5.1Experiment12.1:OpenLoopPhaseShiftingExperiments.......21312.5.2Experiment12.2:MakingaSymbolClockTrackingLoop.......21312.6AdditionalReferences...............................21413FundamentalsofQuadratureAmplitudeModulation21513.1ABasicQAMTransmitter............................21513.2TwoConstellationExamples...........................21713.2.1The4×416-PointConstellation.....................21813.2.2A4-PointFourPhaseConstellation...................22013.3AModulatorStructureUsingPassbandShapingFilters............22113.4IdealQAMDemodulation............................22313.5QAMModulatorExperiments..........................22413.5.1StepstoFollowinMakingaTransmitter................22513.5.2TestingYourTransmitter........................22613.5.3GeneratingaStartupSequence.....................227 xviiiContents13.6AdditionalReferences...............................22814QAMReceiverI–ClockRecoveryandOtherFront-EndSubsystems22914.1OverviewofaQAMReceiver..........................22914.2DetailsAbouttheReceiverFront-EndSubsystems...............23114.2.1AutomaticGainControl.........................23114.2.2TheCarrierDetectSubsystem......................23214.2.3SymbolClockRecovery.........................23214.3ExperimentsfortheQAMReceiverFront-End.................23914.4AdditionalReferences...............................24015QAMReceiverII–EqualizerandCarrierRecoverySystem24115.1TheComplexCross-CoupledPassbandAdaptiveEqualizer..........24115.1.1TheLMSMethodforAdjustingtheEqualizerTapValues......24215.1.2TheoreticalBehavioroftheLMSAlgorithm..............24715.1.3AddingTapLeakagetotheLMSAlgorithm..............24815.2ThePhase-SplittingFractionallySpacedEqualizer...............24915.3DecisionDirectedCarrierTracking.......................25115.4BlindEqualization................................25315.4.1BlindEqualizationwiththeComplexCross-CoupledEqualizer....25415.4.2BlindEqualizationwiththePhase-SplittingEqualizer.........25515.5ComplexCross-CoupledEqualizerandCarrierTrackingExperiments....25615.5.1ImplementingtheSlicer.........................25615.5.2MakingaDemodulatorandCarrierTrackingLoop..........25815.5.3MakingaComplexCross-CoupledAdaptiveEqualizer.........25915.5.4Bit-ErrorRateTest............................25915.5.5OptionalExperiment–Receivingthe16-PointV.22bisConstellation25915.5.6OptionalExperiment–IdealReferenceTraining............26015.6OptionalPhase-SplittingFractionallySpacedEqualizerExperiment.....26015.7OptionalBlindEqualizationExperiment....................26115.8AdditionalReferences...............................26216EchoCancellationforFull-DuplexModems26316.1TheEchoSourcesinaDialedTelephoneLineCircuit.............26316.2TheData-Driven,Nyquist,In-BandEchoCanceler..............26516.2.1GeneralDescription............................26516.2.2TheNear-EndEchoCanceler......................26716.2.3TheFar-EndEchoCanceler.......................26916.2.4Far-EndFrequencyOffsetCompensation................27016.3EchoCancelerExperiments...........................27116.3.1MakingaNear-EndEchoCanceler...................27116.3.2MakingaFar-EndEchoCancelerwithFrequencyOffsetCorrection.27116.4AdditionalReferences...............................272 Contentsxix17Multi-CarrierModulation27317.1HistoryandImplementationofMulti-CarrierModulation..........27317.2AsymmetricDigitalSubscriberLine(ADSL)SystemArchitecture......27717.3ComponentsofaSimplifiedADSLTransmitter................27817.3.1TheCyclicRedundancyCheckGenerator...............27817.3.2TheScrambler..............................28117.3.3TheReed-SolomonEncoder.......................28117.3.4TheConvolutionalInterleaver......................28217.3.5TheMapandIFFTModulatorBlocks.................28517.3.6SomeSignalsUsedforInitializationandSynchronization.......28817.4ASimplifiedADSLReceiver...........................29017.4.1DemodulationandFrequencyDomainEqualization..........29117.4.2SampleClockAcquisitionandTracking.................29217.4.3SymbolAlignmentAcquisitionandTracking..............29617.4.4RemainingBlocks.............................29717.5MakingaSimplifiedADSLTransmitterandReceiver.............29817.5.1Makinga64-PointIFFTanda64-PointFFT.............29817.5.2MakingaScrambler,ConstellationPointMapper,andTheirInverses29917.5.3MeasuringtheChannelImpulseResponseDuration..........29917.5.4CompletingtheTransmitter.......................30017.5.5MakingtheReceiver...........................30117.6AdditionalReferences...............................30418SuggestionsforAdditionalExperiments30718.1ElementaryModemHandshakeSequence....................30718.2MakeanITU-TV.21FrequencyShiftKeyed(FSK)Modem.........30718.3FastEqualizerTrainingUsingPeriodicSequences...............30818.4TrellisCodedModulation............................30918.5Reed-SolomonEncoderandDecoder......................30918.6TurboCodes....................................30918.7LowDensityParityCheckCodes........................31018.8V.34ConstellationShapingbyShellMapping.................31018.9NonlinearPrecodingforV.34..........................31118.10SpeechCodecs..................................311AGeneratingGaussianRandomNumbers313A.1The’C6713CCompilerPseudoRandomNumberGenerator.........313A.2ABetterUniformRandomNumberGenerator.................314A.3TurningUniformlyDistributedRandomVariablesintoaPairofGaussianRandomVariables.................................316A.4LimitonthePeakoftheSimulatedGaussianRandomVariables.......317BATTL/RS-232CInterfaceforMcBSP0319CEquipmentListforEachStation323 xxContentsReferences325I.ListofManuals....................................325II.SelectedReferenceBooksandPapers.......................325A.DSPLaboratoryBooksUsingDSPHardware................325B.DSPLaboratoryBooksUsingSoftwareSimulation.............326C.BooksandPapersonDigitalSignalProcessing...............327D.BooksandPapersonCommunications...................328E.ReferencesforWirelineandWirelessMulti-CarrierModulation......331F.BooksandPapersonErrorCorrectingCodes................332III.InterestingWebSites................................333Index335 Chapter1OverviewoftheHardwareandSoftwareToolsThepurposeofthisinitialchapteristointroduceyoutothemainfeaturesofthehardwareandsoftwaretoolsthatwillbeusedinthiscourse.Avarietyofsignalprocessingandcom-municationsystemcomponentswillbeimplementedbywritingCand/orassemblylanguageprogramsfortheTMS320C6713floating-pointDSPinourlab.TheTMS320C6713residesonaboardTexasInstruments(TI)callstheTMS320C6713DSK(DSPStarterKit)whichisasmallexternalboardthatconnectstothePCthroughaUSBport.TheTMS320C6713communicateswiththeanalogworldthroughaTIAIC23stereocodecontheDSKboard.TheexperimentsinthisbookcanbeeasilymodifiedforotherDSPboards.Itisimportanttohaveageneralpictureofthehardwareplatformsoyouwillunderstandhowtowriteprogramstoaccomplishthedesiredtasks.First,averybriefhistoryofDSPchipsispresentedandsometypicalapplicationsarediscussed.Then,theimportantfeaturesoftheTMS320C6713DSParedescribed.Asashortcut,thisDSPwillsometimesbereferredtoasthe’C6713.Itisapartofalargerfamilyoffloating-pointDSP’sincludingtheTMS320C6701,TMS320C6711,TMS320C6722,TMS320C6726,andTMS320C6727.Thisfamilywillbereferredtoasthe’C6xor’C6000family.Next,ablockdiagramfortheDSKisdiscussedfollowedbyanintroductiontosomeofthesoftwaretools.Forthefirstexperiment,youareaskedtoworkthroughtheCodeComposerTutorial.Ifyouworkthroughallpartsofthetutorial,itwillmorethanfillupthethreehourlabperiod.Detailsofthe’C6713architectureandinstructionsetandoftheDSKboardwillbegraduallyintroducedinthefirstfewexperimentsastheyarerequired.CompletedetailsfortheDSP’s,DSK,andTIsoftwarecanbefoundintheTexasInstrumentsmanualswhenrequired.YoucanfindthemonthePCharddrive,TIwebsite,andlabbookshelf.(Theabilitytoreadmanualsisanimportantskilltoacquire!)ExtensivedocumentationfortheDSKboard,’C6713DSPhardware,andsoftwaredevelopmenttoolsisincludedwiththespecialversionofTI’sCodeComposersuppliedwiththeDSK.LookatCodeComposer’s“Help”menuforthisextensivedocumentation.Therearealargenumberofthingstobelearnedinitiallyandyoumayfeeloverwhelmed.Pleasebeassuredthatthemajorityofyourclassmatesfeelthesameway.Veryshortly1 2OverviewoftheHardwareandSoftwareToolsyouwillgetoverthisinitialhurdleandfindtheexperimentsinterestingandchallenging.Asthesemesterprogresses,youwillbuildupabag-of-tricksthatcanbeusedinfollowingexperimentssotheywillalmostseemtogeteasier.1.1SomeDSPChipHistoryandTypicalApplicationsDigitalsignalprocessingchips(DSP’s)wereintroducedintheearly1980’sandhavecausedarevolutioninproductdesign.CurrentmajorDSPmanufacturersincludeTexasInstru-ments(TI),Motorola,Lucent/Agere,AnalogDevices,NEC,SGS-Thomson,andConexant(formerlyRockwellSemiconductor).DSP’sdifferfromordinarymicroprocessorsinthattheyarespecificallydesignedtorapidlyperformthesumofproductsoperationrequiredinmanydiscrete-timesignalprocessingalgorithms.Theycontainhardwareparallelmultipliers,andfunctionsimplementedbymicrocodeinordinarymicroprocessorsareimplementedbyhighspeedhardwareinDSP’s.SincetheydonothavetoperformsomeofthefunctionsofahighendmicroprocessorlikeanIntelPentium,aDSPcanbestreamlinedtohaveasmallersize,uselesspower,andhavealowercost.LowcostDSP’shavemadeitmoreeconomicaltoimplementfunctionsbydigitalsignalprocessingtechniquesratherthanbyhard-wiredana-logcircuits,particularlyforaudiobandapplicationslikespeechcompressionandtelephonelinemodems.ThespeedsofthelatestgenerationsofDSP’shaveincreasedtothepointwheretheyarebeingusedinhighspeedapplicationslikeDSLandwirelessbasestationsandhandsets.Someoftheadvantageresultsfromthefactthatintegrateddigitalcircuitsareveryreliableandcanbeautomaticallyinsertedinboardseasily.Inaddition,programmableDSP’scanimplementcomplicatedlinearandnonlinearalgorithmsandeasilyswitchfunc-tionsbyjumpingtodifferentsectionsofprogramcode.ThecomplexityofthealgorithmsisonlylimitedbytheimaginationoftheprogrammerandtheprocessingspeedoftheDSP.Oncetheprogramisperfected,thechipfunctiondoesnotchangewithageunlessaveryrarefailureoccurs.Ontheotherhand,analogcomponentsrequiremoreboardspace,sometimesmustbetrimmedtothecorrectvaluesafterinsertion,andchangewithtemperatureandage.AnalogcircuitsaredesignedtoperformspecificfunctionsandlacktheflexibilityoftheprogrammableDSPapproach.AnotheradvantageisthatsmallchangesintheDSPfunctionorbugfixescanbemadebychangingafewlinesofcodeinaROMorEPROMwhilesimilarchangesmaybeverydifficultwithahard-wiredanalogcircuit.DigitalsignalprocessingalgorithmswereusedlongbeforetheadventofDSPchips.Theywereimplementedonlargemain-framecomputersand,later,onexpensive“high-speed”mini-computers.Dependingonthesignalbandwidths,theseimplementationswererealornon-real-time.Assemiconductortechnologyevolved,customprocessorswerebuiltwithmanyTTLMSIchipsincludingcascadableALUsectionsandstandalonemultiplierchips.Atypicalsystemcontainedover100MSIchips.Thesesystemswerebigandexpen-sivetomanufacturebecauseofthelargechipcount,andconsumedmanywattsofpowerrequiringcoolingfans.ThemostpopularfirstgenerationDSPchips,theNECµPD7720andTexasInstrumentsTMS32010,becamecommerciallyavailableinlate1982.Thesechipsperformed16-bitintegerarithmeticattherateof5millioninstructionspersecond(MIPS)andhadlimitedinternalRAM,ROM,andI/Ocapabilities.Theyinitiallycostabout$600notincludingthesoftwareandhardwaredevelopmenttools.ManycurrentDSP’sthatare 1.1SomeDSPChipHistoryandTypicalApplications3ordersofmagnitudemoreadvancedcostlessthan$20.Theyreducedthechipcountbyaverylargepercentageresultinginsmallercircuitboardsusingsignificantlylesspower,morereliablesystems,andreducedmanufacturingcomplexityandcosttothepointwhereDSP’sarepresentinmanyconsumerproducts.CellphonesandtelephonelinemodemsareprobablythelargestDSPmarkets.DSP’shavecontinuallyevolvedsincetheywerefirstintroducedasVLSItechnologyim-proved,asusersrequestedadditionalfunctionality,andascompetitionarose.MoreinternalRAMandROMhasbeenaddedandthetotaladdressspacehasbeenincreased.Additionalfunctionshavebeenaddedlikehardwarebit-reversedaddressingforFFT’s,hardwarecir-cularbufferaddressing,serialports,timers,DMAcontrollers,andsophisticatedinterruptsystemsincludingshadowregistersforlowoverheadcontextswitching.AnalogDeviceshasincludedswitchedcapacitorfiltersandsigma-deltaA/DandD/AconvertersonsomeDSPchips.Instructionrateshaveincreaseddramatically.State-of-the-artintegerDSP’sliketheTMS320C5000seriesareavailablewithmembersthatcanoperateatclockratesof200MHzandcostaround$20inquantity.TheevennewerTMS320C6000family,whichhasaverylonginstructionwordarchitecture(VLIW),hasmemberswithclockratesupto1GHzandcostabout$150.ThespeedincreaseislargelyaresultofreducedgeometriesandimprovedCMOStechnology.Inthelastcoupleofyears,DSPmanufactureshavebeendevelopingchipswithmultipleDSPcoresandsharedmemoryforuseinhigh-endcommercialapplicationslikenetworkaccessservershandlingmanyvoiceanddatachannels.DSPchipswithspecialpurposeacceleratorslikeViterbidecoders,turbocodedecoders,multimediafunctions,andencryption/decryptionfunctionsareappearing.TherapidemergenceofbroadbandwirelessapplicationsispushingDSPmanufacturerstorapidlyincreaseDSPspeedsandcapabilitiessotheydonotloseouttoFPGA’s.TheintroductionofCMOStechnologyafterthefirstcoupleofgenerationsofDSP’ssignificantlyreducedpowerconsumption.Also,lowersupplyvoltagesarenowbeingused.ApplicationsliketelephonelinemodemsthatrequiredatleasttwoDSP’sandanadditionalordinarymicroprocessoractingasacontrollerfifteenyearsagocannowbeimplementedusingasingleDSPandatlowercost!PowerconsumptionhasbeensignificantlyreducedforsomeDSP’stoconservebatterylifeincellphones.CustomTIchipscurrentlyinproductionwithsixDSPcorescandoaround90fullduplexV.90modemsconcurrently.WithconcurrentprocessrunninginDSP’s,softwareissuesinvolvingreal-timemulti-taskingoperatingsystemshavebecomeasimportantashardwareissues.AmilestoneinDSPhistoryoccurredaround1986whenAT&Tintroducedthefirstcommercialfloating-pointDSP,theDSP32.In1988,TIshippedinitialsamplesoftheTMS320C30atapriceof$1,300tobeginitsfirstgenerationTMS320C3xfloating-pointDSPfamily.Bothprocessorshavea32-bitwordlength.TheTMS320C30familyhasamemberthatcanrunat25millioninstructionspersecond(MIPS)andcostsabout$200.Astrippeddownversion,theTMS320C31,followedandhasamemberthatcanperform40MIPswithapriceofabout$35.TIstarteditssecondgenerationfloating-pointDSPfamilywiththeTMS320C40whichcontainsextensivesupportforparallelprocessing.Atleasteightornineyearsago,TIintroducedtheTMS320C67xseriesoffloatingpointDSP’s.ThefirstofthesewastheTMS320C6701whichwasfollowedbytheTMS320C6711,TMS320C6713,andTMS320C672xfamilyoffloatingpointDSP’s.The’C67xDSP’shaveaVLIW(VeryLong 4OverviewoftheHardwareandSoftwareToolsInstructionWord)architecturewitheightexecutionunitsintheirCPU’sandclockspeedscurrentlyrangeupto350MHz.Floating-pointDSP’sareusedinsomeapplicationsbecauseoftheireaseinprogramming.However,integerDSP’sareusedmostfrequently.Somereasonsarebecausetheyaresmaller,cheaper,faster,anduselesspower.Costisamajorconcerninthecompetitivecommercialmarketparticularlyformassproducedproductslikemodems,cellphones,andharddiskdrives.Powerconsumptionisofparticularconcernforcellphones.CaremustbetakenwithintegerDSP’stoscalesignalstoavoidoverflowandunderflow.However,thisisnotmuchofaprobleminmostdigitalcommunicationsystemapplicationswheresignalpowerlevelsremainrelativelyconstant.Floating-pointDSP’sautomaticallyperformthisscaling.DSP’sareusedinawidevarietyofofflineandreal-timeapplications.Sometypicalareasandspecificapplicationsare:•Telecommunications:telephonelinemodems,FAX,cellulartelephones,speakerphones,ADPCMtranscoders,digitalspeechinterpolation,broadbandwirelesssys-tems,andansweringmachines•Voice/Speech:speechdigitizationandcompression,voicemail,speakerverification,andspeechsynthesis•Automotive:enginecontrol,antilockbrakes,activesuspension,airbagcontrol,andsystemdiagnosis•ControlSystems:headpositioningservosystemsindiskdrives,laserprintercontrol,robotcontrol,engineandmotorcontrol,andnumericalcontrolofautomaticmachinetools•Military:radarandsonarsignalprocessing,navigationsystems,missileguidance,HFradiofrequencymodems,securespreadspectrumradios,andsecurevoice•Medical:hearingaids,MRIimaging,ultrasoundimaging,andpatientmonitoring•Instrumentation:spectrumanalysis,transientanalysis,signalgenerators•ImageProcessing:HDTV,patternrecognition,imageenhancement,imagecompres-sionandtransmission,3-Drotation,andanimationTexasInstrumentsDSP’scanbegroupedintothefollowingthreecategories:•LowCost,Fixed-Point,16-BitWordLengthMotorcontrol,diskheadpositioning,controlTMS320C1s,’C2x,’C24x•PowerEfficient,Fixed-Point,16BitWordsWirelessphones,modems,VoIP’C5x,’C54x,’C55x 1.1SomeDSPChipHistoryandTypicalApplications5•HighPerformanceDSP’sCommunicationsinfrastructure,xDSL,imaging,video’C62x(16-bitfixed-point)’C3x,’C4x,’C64x,’C67x(32-bitfloating-point)Clearly,real-timeDSPapplicationsarelimitedtocaseswheretherequiredsignalsam-plingrateissufficientlylessthantheDSPinstructionratesoareasonablenumberofin-structionscanbeperformedbetweensamples.Forexample,awide-bandradiofrequency(RF)signalwithahighcarrierfrequencycannotbedirectlysampledanddemodulatedwithaDSP.However,whenthebandwidthoftheRFsignalissufficientlylessthantheinstructionrate,analogfront-endcircuitscanbeusedtodemodulateittobasebandinphaseandquadraturecomponentswhichcanthenbesampledatarateequaltothebandwidthandprocessedbyaDSP.Alternatively,ananalogfiltercanbeusedtoformtheHilberttransformoftheRFsignalandthentheoriginalsignalanditsHilberttransformcanbesampledatarateequaltothebandwidthandprocessedwithaDSP.DSP’shavebeenextensivelyusedinaudiofrequencyapplicationswheremanyinstructionscanbeperformedbetweensamples.However,theyarebeingusedtoprocessincreasinglywide-bandsignalsastheinstructionratesofnewgenerationsincrease.SpecialpurposeVLSIchipsandFPGA’shavebeenusedtoimplementlimitedDSPfunctionsatveryhighrates.AveryimportantattributeoftheDSPapproachistheflexibilityofaprogrammablede-vice.Anexampleillustratinganidealapplicationforthisflexibilitywillnowbepresented.InJune1994,theITUapprovedthefinaldraftoftheV.34telephonelinemodemrecom-mendation.Thismodemcantransmitdataatratesvaryingfrom2400to33600bits/secinmultiplesof2400bits/sec.Avarietyofmodulationschemesareusedduringhandshakingandnormaldatatransmission.Duringtheinitialhandshakingphase,binary,continuousphase,frequencyshiftkeyingisusedtoexchangeinformationaboutmodemcapabilitiesusingtheV.8protocol.Later,thecalledmodem,usuallyreferredtoastheanswermodem,transmitsasignalcalledtheanswertonetothecallingmodem.IntheV.34case,asmallsinusoidalamplitudemodulationisimpressedontheanswertonetoidentifyitasaV.34modem,sothereceiverinthecallingmodemneedstoperformthefunctionofanenvelopedetector.Inanotherphaseofthehandshake,achannelprobingsequenceconsistingofasumofsinewavesistransmittedfirstbyonemodemandthenbytheother.Thecallingandanswermodemtransmittersmustsynthesizethissignalandthereceiversmustprocessittoestimatechannelcharacteristicssuchasfrequencyresponse,noiselevel,andnonlinearities.Anotherspecialsequenceistransmittedtorapidlyadjustadaptiveequalizersinthereceivers.Duringstillanotherportionofthehandshake,binarydifferentialphaseshiftkeying(DBPSK)isusedtoexchangeconfigurationinformationbetweenthemodems.Quadratureamplitudemodulation(QAM)isusedduringnormaldatatransmission.Transmitandreceivesignalseparationisachievedbyusingadaptiveechocancellers.Additionaltasksthatmustbeperformedduringnormaldatatransmissionarescramblinganddescramblingtheinputbitstream,mappingthescrambleddatabitstotransmittedsignalpointsbyatechniquecalledshellmapping,trellisencoding,nonlinearprecoding,andsoftdecisionViterbidecoding.Allthesetasks,andmore,cannowbeperformedbyasingleintegerDSP.Infact,astate- 6OverviewoftheHardwareandSoftwareToolsof-the-artDSPcanrunseveralfullduplexV.34modemsconcurrently.InadditiontotheV.34recommendation,thesechipsoftencontaincodetoactasatleastsixoldermodemtypes,haveFAXmodes,anddoV.90andV.92modems.Allthatisrequiredtoincludenewfunctionsisto“addafewmorelinesofcode”and,possibly,somemorememory.Consumermodemcostshaveplummetedtolessthan$100.ProgrammableDSP’shavemadeitpossibletomanufactureproductswithtremendouscomplexityandsophisticationatpricesthattheordinaryconsumercaneasilyafford.Finally,tomaintainabalancedviewpoint,itshouldbepointedoutthattheDSPap-proachisnotalwaysthebestsolutiontoaproblemevenifaDSPcanaccomplishthetask.Forexample,acommercialAMradiosignal,whichhasacarrierfrequencyintheorderof1MHz,cantriviallybedemodulatedbyasimpleenvelopedetectorconsistingoflittlemorethanadiode,resistor,andcapacitor.Asengineers,youshouldalwayslookforthemostreasonableandeconomicalmethodofsolvingadesignproblem.1.2TheTMS320C6713Floating-PointDSPTheexperimentsinthisbookareexplainedfortheTexasInstrumentsTMS320C6713DSKfloating-pointDSPboards.Floating-pointDSP’swith32-bitwordswerechosenforthislabtosimplifytheprogrammingtasks,especiallyinahigh-levellanguagelikeC.MostintegerDSP’shave16-bitwordssounderflow,overflow,anddynamicrangemustbetakenintoac-countwhenprogrammingthem.Inaddition,emulating32-bitfloating-pointarithmeticona16-bitintegerDSPgeneratesinefficientmachinecode.Inpractice,integerarithmeticcanbeusedformostapplicationswithoutverymuchdifficulty.Therefore,highvolumecommercialproductsalmostalwaysuse16-bitintegerDSP’sbecausetheyarefaster,uselesspower,andarecheaper.Floating-pointDSP’sareusedforhigh-endlowvolumeapplications.Afunc-tionalblockdiagramoftheTMS320C6713isshowninFigure1.1,respectively.Theirmajorcomponentsandfeaturesarebrieflydescribedinthefollowingsubsections.Forcompletede-tails,seetheTMS320C6000CPUandInstructionSetReferenceGuide[I.7],TMS320C6000PeripheralsReferenceGuide[I.10],andtheTMS320C6713BFloating-PointDigitalSignalProcessor[I.12].1.2.1The’C6000CentralProcessingUnit(CPU)MembersoftheTMS320C67xfamilyofDSP’sallhaveessentiallythesamecentralprocessingunit(CPU)whichisalsocalledtheDSPcore.TheCPUhasaverylonginstructionword(VLIW)architecturethatTIcallsVelociTi.TheCPUalwaysfetcheseight32-bitinstructionsatonceandthereisa256-bitbustotheinternalprogrammemory.Eachgroupofeightinstructionsiscalledafetchpacket.TheCPUhaseightfunctionalunitsthatcanoperateinparallelandareequallysplitintotwohalvescalledtheAor1andBor2sides.Alleightunitsdonothavetobegiveninstructionwordsiftheyarenotready.Therefore,instructionsaredispatchedtothefunctionalunitsasexecutepacketswithavariablenumberof32-bitinstructionwords.Thisvariablelengthfeaturedistinguishesthe’C6000CPUfromotherVLIWarchitectures.Theeightfunctionalunitsinclude: 1.2TheTMS320C6713Floating-PointDSP732EMIFL1PCacheL2Cache/DirectMappedMemory4KBytesTotal4BanksMcASP164KBytesTotalMcASP0C67xCPU(Upto4−Way)InstructionFetchControlMcBSP1RegistersInstructionDispatchControlMcBSP0InstructionDecodeLogicDataPathADataPathBTestI2C1In−CircuitARegisterFileBRegisterFileL2EmulationPinMultiplexingI2C0Memory(16Channel)192KInterrupt.L1.S1.M1.D1.M2.D2.S2.L2BytesControlTimer1EnhancedDMAControllerTimer0L1DCache2−WaySetAssociative4KBytesGPIOClockGeneratorPower−DownOscillatorandPLL16Logicx4throughx25MultiplierHPI/1through/32DividerFigure1.1:FunctionalBlockDiagramoftheTMS320C6713DSP•Fourarithmeticandlogicunits(ALU’s)thatcanperformfixedandfloating-pointoperations(.L1,.L2,.S1,.S2)•TwoALU’sthatperformonlyfixed-pointoperations(.D1,.D2)•Twomultipliersthatcanperformfixedorfloating-pointmultiplications(.M1,.M2)TheGeneralPurposeRegisterFileTheCPUhasthirty-two32-bitgeneralpurposeregisterssplitequallybetweentheAandBsides.TheCPUhasaload/storearchitectureinwhichallinstructionsoperateonregisters.Thedata-addressingunits.D1and.D2areinchargeofalldatatransfersbetweentheregisterfilesandmemory.Thefourfunctionalunitsonasidecanfreelysharethe16registersonthatside.Eachsidehasasingledatabusconnectedtoalltheregistersontheotherside,sothefunctionalunitsononesidecanaccessdataintheregistersontheotherside.Accesstoaregisteronthesamesideusesoneclockcyclewhileaccesstoaregisterontheothersiderequiresareadandwritecycle.IntegerandFloating-PointWordFormatsAnintegerinthe’C6000familyisa32-bitword.Supposethewordhastheformd=(d31,d30,...,d1,d0).Theleft-mostbit,d31,isthemostsignificantbit(MSB)andtheright-mostbit,d0,istheleastsignificantbit(LSB).Integerscanbeunsignedorsigned.An 8OverviewoftheHardwareandSoftwareToolsunsignedintegerhasthedecimalvalue31nv=dn2(1.1)n=0andisintherange[0,232−1].Signedintegersareinthetwo’scomplementformatwiththeMSBasthesignbit.Asignedintegerhasthedecimalvalue3031nv=−b312+dn2(1.2)n=0whichisintherange[−231,231−1].Noticethatwhenb=0theintegerispositive,while31itisnegativeforb31=1.TheseformsassumethebinaryradixpointisontherightoftheLSB.Theradixpointcanbeassumedtobeanywherewithinthewordsothewordhasbothanintegerandfractionalpart.IfLfractionalbitsareassumed,thewordhastheformb=(b31,...,bL.bL−1,...,b0)andhasthedecimalvalue30−L31nv=2(−b312+dn2)(1.3)n=0TheintegerissaidtohaveQLformat.Itisuptotheprogrammertokeeptrackofthelocationoftheradixpointwhenintegerarithmeticisperformed.Integersoccupyoneregisterintheregisterfile.The’C6000DSP’salsosupport40-bitlongintegers.Longintegersarestoredintwosuccessiveregistersintheregisterfile.Theleastsignificant32bitsarelocatedinanevennumberedregisterandthemostsignificant8bitsarelocatedinthelower8bitsofthenexthigherregisterwhichisoddnumbered.Thefloating-pointDSP’s(’C67x)canalsoformdoubleprecision64-bitintegersthatoccupyallbitsinapairofconsecutiveregisters.Someinstructionsalsooperateon16-bithalvesofregisters.The’C67xDSP’ssupportIEEEsingleanddouble-precisionfloating-pointnumbers.IEEEfloating-pointnumberscanbenormalnumbers,denormalized(orsubnormal)numbers,NaNs(notanumber),andinfinitynumbers.Denormalizednumbersarenonzeronumbersthataresmallerinmagnitudethanthesmallestnonzeropositivenormalnumber.Single-precisionnumbersare32bitslonganddouble-precisionnumbersare64bitslong.Normalsingle-precisionnumbersareaccuratetoatleastsixdecimalplacesandnormaldouble-precisionnumberstoatleast15places.Thesingle-precisionwordformatisshownintheFigure1.2.313023220se7,e6,...,e0f1,f2,...,f22,f23Figure1.2:IEEESingle-PrecisionFloating-PointNumberFormatThefieldsinthiswordwillnowbedescribed.•Theone-bitfieldsisthesignbit.Numbersarepositivefors=0andnegativefors=1. 1.2TheTMS320C6713Floating-PointDSP9•Theeight-bitfield(e7,...,e0)isthebiasedexponentwhichhasthedecimalvalue7ke=ek2k=0so0≤e≤255.Thebiasedexponentforanormalnumbercannotbe0or255.Thevaluee=0isreservedfornumbersthatareidentically0.Thevaluee=255isreservedforinfinityandNaN.•The23-bitfield(f1,...,f23)isthemantissaorfractionalpartandhasthedecimalvalue23−kf=fk2k=1correspondingtothebinaryword0.f1f2...f23.Themantissaisintherange[0,1−2−23]Thenumericalvalue,x,ofthesingle-precisionfloating-pointwordisdeterminedbythefollowingrules:1.Ife=255andf=0,thenxisNaNindependentofs.2.Ife=255andf=0,thenx=(−1)s∞.3.If0#include#include#include#include#include/*Codecconfigurationsettings*//*Seedsk6713_aic23.handtheTLV320AIC23StereoAudioCODECDataManual*//*foradetaileddescriptionofthebitsineachofthe10AIC23control*//*registersinthefollowingconfigurationstructure.*/DSK6713_AIC23_Configconfig={x0017,/*0DSK6713_AIC23_LEFTINVOLLeftlineinputchannelvolume*/x0017,/*1DSK6713_AIC23_RIGHTINVOLRightlineinputchannelvolume*/x00d8,/*2DSK6713_AIC23_LEFTHPVOLLeftchannelheadphonevolume*/x00d8,/*3DSK6713_AIC23_RIGHTHPVOLRightchannelheadphonevolume*/x0011,/*4DSK6713_AIC23_ANAPATHAnalogaudiopathcontrol*/x0000,/*5DSK6713_AIC23_DIGPATHDigitalaudiopathcontrol*/x0000,/*6DSK6713_AIC23_POWERDOWNPowerdowncontrol*/x0043,/*7DSK6713_AIC23_DIGIFDigitalaudiointerfaceformat*/x0081,/*8DSK6713_AIC23_SAMPLERATESampleratecontrol(48kHz)*/x0001/*9DSK6713_AIC23_DIGACTDigitalinterfaceactivation*/};/***********************************************************//*Mainprogram:Replacewithyourcode*//***********************************************************/voidmain(void){DSK6713_AIC23_CodecHandlehCodec;Uint32sample_pair=0;/*Initializetheinterruptsystem*/ 34LearningtoUsetheHardwareandSoftwareToolsintr_reset();/*dsk6713_init()mustbecalledbeforeotherBSLfunctions*/DSK6713_init();/*IntheBSLlibrary*//*Startthecodec*/hCodec=DSK6713_AIC23_openCodec(0,&config);/*Changethesamplingrateto16kHz*/DSK6713_AIC23_setFreq(hCodec,DSK6713_AIC23_FREQ_16KHZ);/*ReadleftandrightchannelsamplesfromtheADCandloop*//*thembackouttotheDAC.*/for(;;){while(!DSK6713_AIC23_read(hCodec,&sample_pair));while(!DSK6713_AIC23_write(hCodec,sample_pair));}}HowSamplesareSenttotheCodecLeftandrightsamplepairsaresenttothecodecas32-bitwordswiththeleftchannelsampleintheupper16bitsandtherightchannelsampleinthelower16bits.Eachsampleisin16-bittwo’scomplementformat.These32-bitwordsaresenttothecodecbytheBSLfunctionDSK6713_AIC23_write().ThisfunctionpollstheMcBSP1XRDYflagandreturnsimmediatelywithoutsendingthesampleifitisfalseandalsoreturnsthevalue0(FALSE).ItsendsthesamplewordbywritingittotheDataTransmitRegister(DXR)ofMcBSP1ifXRDYis1(TRUE)andreturnsthevalue1.TheCcodeforthisfunctionisshownbelow.#include#includeInt16DSK6713_AIC23_write(DSK6713_AIC23_CodecHandlehCodec,Uint32val){/*IfMcBSPnotreadyfornewdata,returnfalse*/if(!MCBSP_xrdy(DSK6713_AIC23_DATAHANDLE)){return(FALSE);}/*Write16bitdatavaluetoDXR*/MCBSP_write(DSK6713_AIC23_DATAHANDLE,val);/*ShortdelayforMcBSPstatemachinetoupdate*/asm("nop");asm("nop");asm("nop");asm("nop");asm("nop");asm("nop"); 2.1GettingStartedwithaSimpleAudioLoopThroughProgram35asm("nop");asm("nop");return(TRUE);}ThelowerlevelfunctionsMcBSP_xrdy()andMCBSP_write()areinTI’sCSLlibrary.McBSP_xrdy()teststheXRDYflagoftheMcBSPcorrespondingtothehandleandMCBSP_write()writesthedatawordtothedatatransmitregister(DXR)oftheMcBSP.HowSamplesareReadfromtheCodecWordsarereadfromthecodecbyusingthefunctionDSK6713_AIC23_read().ThisfunctionpollstheRRDYflagofMcBSP1andreturnsimmediatelyifitisFALSEwithoutreadingawordandalsoreturnsthevalueFALSE.IfRRDYisTRUEitreadsawordfromtheDataReceiveRegister(DRR)ofMcBSP1andreturnsthevalueTRUE.Thesourcecodeforthisfunctionisshownbelow.#include#includeInt16DSK6713_AIC23_read(DSK6713_AIC23_CodecHandlehCodec,Uint32*val){/*Ifnonewdataavailable,returnfalse*/if(!MCBSP_rrdy(DSK6713_AIC23_DATAHANDLE)){return(FALSE);}/*Readthedata*/*val=MCBSP_read(DSK6713_AIC23_DATAHANDLE);return(TRUE);}MCBSP_rrdy()andMCBSP_read()areinTI’sCSLlibrary.MCBSP_rrdy()teststhereceiveready(RRDY)flagoftheMcBSPassociatedwiththehandle.MCBSP_read()readsa32-bitwordfromtheDataReceiveRegister(DRR)oftheMcBSP.Noticethatthewordreadistypedasanunsignedint.2.1.2PropertiesoftheAIC23CodecTheTMS320C6713DSKsuppliesa12MHzclocktotheAIC23codecwhichisdivideddowninternallyintheAIC23togivethesamplingratesshowninthetablebelow.ThecodeccanbesettothesesamplingratesbyusingthefunctionDSK6713_AIC23_setFreq(handle,freqID)fromtheBSLlibrary.Thisfunctionputsthequantity“Value”intoAIC23controlregister8.SomeoftheAIC23analoginterfacepropertiesare•TheADCforthelineinputshasafull-scalerangeof1.0VRMS.•Themicrophoneinputisahigh-impedance,low-capacitanceinputcompatiblewithawiderangeofmicrophones. 36LearningtoUsetheHardwareandSoftwareToolsTable2.1:AIC23SamplingRatesfreqIDValueFrequencyDSK6713AIC23FREQ8KHZ0x068000HzDSK6713AIC23FREQ16KHZ0x2c16000HzDSK6713AIC23FREQ24KHZ0x2024000HzDSK6713AIC23FREQ32KHZ0x0c32000HzDSK6713AIC23FREQ44KHZ0x1144100HzDSK6713AIC23FREQ48KHZ0x0048000HzDSK6713AIC23FREQ96KHZ0x0e96000Hz•TheDACforthelineoutputshasafull-scaleoutputvoltagerangeof1.0VRMS.•Thestereoheadphoneoutputsaredesignedtodrive16or32-ohmheadphones.•TheAIC23hasananalogbypassmodethatdirectlyconnectstheanaloglineinputstotheanaloglineoutputs.•TheAIC23hasasidetoneinsertionmodewherethemicrophoneinputisroutedtothelineandheadphoneoutputs.ForcompletedetailsontheAIC23codecincludinginputandoutputfilterfrequencyresponses,seetheTLV320AIC23StereoAudioCODECDataManual[I.4].2.1.3CreatingaCCSProjectfordskstart32.cNowthatyouhavegottenthestartingCprogramandlinkercommandfile,itistimetomakeaprojectfileandbuildtheexecutableoutputfile.Performthefollowingtasks:1.ThefirsttimeyouuseCodeComposerStudioyouneedtosaveyourWorkspaceinaplacewhereyouhavewritepermission.Todothis,startCCS,clickonFile,thenWorkspace,andthenSaveWorkspaceAs...andgiveitavalidnameinyourprivateworkspace.2.TostartaprojectinCCS,clickonProject,selectNew,andfillouttheboxesasfollows:ProjectName:giveitanameLocation:adirectoryinyourprivateworkspaceProjecttype:Executable(.out)TargetTMS320C67xx3.CopyC:c6713dskdskstart32.ctoyourworkspaceandaddthecopiedCsourcefiletotheproject.4.NextsetthebuildoptionsforCodeComposerStudio.ClickonProjectandselectBuildOptions.Enterthefollowingoptions: 2.1GettingStartedwithaSimpleAudioLoopThroughProgram37Compiler->BasicTargetVersion:671x(-mv6710)GenerateDebugInfo:FullSymbolicDebug(-g)OptSpeedvsSize:SpeedMostCritical(noms)OptLevel:NoneProgramLevelOpt:NoneCompiler->PreprocessorIncludeSearchPath(-i):.;c:c6713dskdsk6713bsl32includeDefineSymbols(-d):CHIP_6713Preprocessing:NoneCompiler->FilesAsmDirectory:"adirectoryinyourworkspace"ObjDirectory:"adirectoryinyourworkspace"Linker->BasicOutputFilename(-o):dskstart32.out(Youcanchangethis.)MapFilename(-m):dskstart32.map(optional)AutoinitModel:Run-timeautoinitializationLibrarySearchPath:5.Addtotheprojectthelinkercommandfilec:c6713dskdsk6713.cmdandthelibraryc:c6713dskdsk6713bsl32libdsk6713bsl32.lib2.1.4Experiment2.1:BuildingandTestingdskstart32.cTheprogram,dskstart32.c,simplyloopstheinputADCsamplesbacktotheoutputDAC.Tocheckthatyourprojectbuildsandrunscorrectly,dothefollowing:1.PlugastereocableintotheDSKLineInputandconnectbothchannelstothesamesignalgeneratoroutput.Theprogramdskstart32shouldsetthecodectosampleat16000Hz,sosetthesignalgeneratortooutputasinewaveoflessthan8000Hz.2.PlugastereocableintotheDSKLineOutput.Connecttheleftandrightoutputstotwodifferentoscilloscopechannels.Youshouldusechannels1and4ontheHPoscilloscopes.NOTE:Therightchannelisthewhiteplugandtheleftchannelistheredplug.3.Makesurethesamplingrateissetto16000Hzindskstart32.c.4.Afteryourprojectoptionshavebeenset,buildtheexecutablemodulebyclickingontheRebuildAlliconorProject→RebuildAll.5.LoadtheprogramusingFile→LoadProgram 38LearningtoUsetheHardwareandSoftwareTools6.Starttheprogramrunningandcheckthatthesinewavesappearonthescope.Makesuretheinputlevelissmallenoughsothatthereisnoclipping.7.Increasetheinputsignalleveluntiltheclippingoccursandtheoutputisdistortedsoyoucanrecognizethisprobleminfutureexperiments.Thenreducethelevelagainsothereisnoclipping.8.Varythesinewavefrequency.Whathappenswhenitismorethan8000Hz?Why?9.Measuretheamplituderesponseofthesystembyvaryingtheinputfrequencyanddi-vidingtheoutputamplitudebytheinputamplitude.Plottheamplituderesponse.Useenoughfrequenciestogetasmoothcurve,particularlyinregionswheretheamplituderesponsechangesquickly.YouramplituderesponseresultswillbeneededforChapter3experiments.2.2MoreDetailsontheMcBSPSerialPortsandCodecsYouwillusetheMcBSP1serialportwheneveryousendasignalsampletoorgetasamplefromthecodec.ForcompleteMcBSPdetailssee[I.10].AsimplifiedblockdiagramofaMcBSPisshowninFigure2.1.Thesignalsshowninthediagramare:DX/DRSerialtransmit/receivedataFSX/FSRTransmit/receiveframesyncCLKX/CLKRTransmit/receiveserialshiftclockXINT/RINTTransmit/receiveinterrupttoCPUXEVT/REVTTransmit/receiveinterrupttoDMACLKSExternalclockforSampleRateGeneratorTheSampleRateGenerator(SRG)canbeusedtogeneratetheframesyncsandshiftclocksfromandinternalorexternalclock.TheSRGisnotusedwiththecodecsbecausethecodecssupplytheframesyncsandshiftclocks.TheEvents/InterruptsblockcansendinterruptrequeststotheCPUandeventnotifica-tionstotheEDMAwhenwordsarereceivedortransmittedbytheserialport.2.2.1BasicMcBSPTransmitterandReceiverOperationAmoredetaileddiagramoftheMcBSPtransmitterisshowninFigure2.2.Thetransmitteroperatesasfollows:•TheCPUorDMAwritesa32-bitwordinparallelintotheDataTransmitRegister(DXR)whichisa32-bitmemory-mappedregister.TheXRDYflagisclearedwheneverdataiswrittentotheDXR.•Whenthetransmitframelynch(FSX)goeshigh,awordoftheconfigurednumberofbitsisseriallyshiftedoutoftheTransmitShiftRegister(XSR).AfterawordisshiftedoutoftheXSR,aparalleltransferoftheDXRintotheXSRisperformed.TheXRDY 2.2MoreDetailsontheMcBSPSerialPortsandCodecs39'C6000McBSPDXCLKXTransmitterFSXDRCLKRReceiverFSRCPUclkFSGSampleCLKSRateGen.CLKGXEVTXINTEvents/REVTInterruptsRINTToDMAToCPUFigure2.1:McBSPBlockDiagramflagissetwhenthetransferoccurs.TheCPUcantesttheXRDYflagtoseeiftheDXRisemptyandanotherwordcanbewrittentoit.McBSP1shouldbeconfiguredtotransmit32-bitwordstothecodeconboardtheDSK.•Theserialporttransmittersendsaninterruptrequest(XINT)totheCPUwhentheXRDYflagmakesatransitionfrom0to1ifXINTM=00bintheSerialPortControlRegister(SPCR).ItalsosendsaTransmitEventNotice(XEVT)totheDMA.AMcBSPreceiverblockdiagramisshowninFigure2.3.Thereceiveroperationisessentiallythereverseofthetransmitteroperation.Itworksasfollows:•Whenthereceiveframesynch(FSR)goeshigh,thereceivedbitsareshiftedseriallyintotheReceiveShiftRegister(RSR).•Whenanelementwiththeconfigurednumberofbitsisreceived,the32-bitRSRistransferredinparalleltotheReceiveBufferRegister(RBR)ifitisempty.•TheRBRisthencopiedtotheDataReceiveRegister(DRR)ifitisempty.Itisuptotheprogrammertoselecttheelementwiththeconfigurednumberofbitsfromthe32-bitDRRword.McBSP1shouldbeconfiguredtoreceive32-bitelements. 40LearningtoUsetheHardwareandSoftwareTools32DataTransmitRegisterDXR(018C0004h)32TransmitShift1XSRTransmitDataRegisterDXpinSerialPortControlRegister(018C0008h)XINTMXEMPTYXRDYXRSTRJUSTRINTMRFULLRRDYRRST2120181716141354210Note:AddressesareforMcBSP0Figure2.2:McBSPTransmitterBlockDiagram32DataReceiveRegisterDRR(018C0000h)32ReceiveBufferRBRRegister32ReceiveShift1RSRReceiveDataRegisterDRpinNote:AddressesareforMcBSP0Figure2.3:McBSPReceiverBlockDiagram 2.2MoreDetailsontheMcBSPSerialPortsandCodecs41•TheRRDYbitintheSPCRissetto1whentheRBRismovedtotheDRR,anditisclearedwhentheDRRisread.•WhenRRDYtransitionsfrom0to1,theMcBSPgeneratesaCPUinterruptrequest(RINT)ifRINTM=00bintheSPCR.Areceiveevent(REVT)isalsosenttotheEDMAcontroller.TheTIchipsupportlibrary(CSL)[I.6]containsamodulewithCfunctionsandmacrosthatsupportseveryfeatureoftheMcBSPserialports.2.2.2ExampleCCodeforReadingfromandWritingtotheCodecThefollowingCcodesegmentsshowonewayofinterfacingwiththeAIC23stereocodec.ItisassumedthatearlierintheprogramtheMcBSP1transmitterandreceiverareconfiguredforaone-phaseframecontainingone32-bitword.Themostsignificant16-bitsofeach32-bitwordaretheleftchannelsampleandtheleastsignificant16-bitsaretherightchannelsampleeachin2’scomplementformat.ThefollowingcodesegmentshowshowtogetaleftandrightchannelsamplefromthecodecADC.Thesamplingfrequencyiscontrolledbytheframesyncsgeneratedbythecodec.TheprogramsitsinawhilelooppollingtheRRDYflaguntilasamplearrivesusingtheBSLfunctionDSK6713_AIC23_read(hCodec,&sample_pair)describedonpage35.WhentheRRDYflagbecomestrue,thewordintheDRRisread,storedinsample_pair,andtheRRDYflagiscleared.Therightandleftchannelsamplesarethenextractedfromsample_pair.Firstsample_pairiscastintoasignedint.Theresultisarithmeticallyshiftedright16bits,sotherightchannelsamplefallsofftherightendofthewordleavingtheleftchannelsampleinthelower16bitswithitssignextendedthroughtheupper16bits.Theresultisconvertedtoafloatwhenitisputinthefloat,left.Therightchannelsampleisextractedbyagaincastingsample_pairintoasignedint,shiftingitleft16bitstoknockoffthe16leftchannelbitsandputtherightchannelsamplesignbitinbit31whichisthe32-bitintegersignbit,andthenarithmeticallyshiftingtheresultright16bitstoextendthesignthroughtheupper16bitsandleavetherightchannelsampleinthelower16bits.Theresultisconvertedtoafloatbysettingitequaltothefloat,right.Program2.3ExampleCCodeforStereoReadDSK6713_AIC23_CodecHandlehCodec;Uint32sample_pair=0;floatleft,right;.../*PollRRDY.WhenTRUE,readDRR*/while(!DSK6713_AIC23_read(hCodec,&sample_pair));/*Extractleftchannelsample,signextend,converttofloat*/ 42LearningtoUsetheHardwareandSoftwareToolsleft=((int)sample_pair)>>16;/*Extractrightchannelsample,signextend,converttofloat*/right=((int)sample_pair)<<16>>16;SendingapairofsampletotheDACinvolvestheoppositeoperations.Thefollowingprogramsegmentassumesthesamplesareinitiallyinfloating-pointformat.Thefirststepistoconvertthemtotheintegerwordsileftandiright.Caremustbetakensothatthesamplesfitin16-bitintegers.Nexttheleftsampleisor-edintotheupper16-bitsoftheoutput32-bitintegerword,sample,andtherightchannelsampleintothelower16bits.Noticethattheupper16bitsoftherightchannelhavebeenmaskedto0.Thentheprogramsitsinawhileloopuntilthetransmitreadybit(XRDY)intheSPCRbecomestrue.WhenXRDYbecomestrue,theDataTransmitRegister(DXR)hasbecomeemptyandthenewpairofsamplesiswrittentoit.TheselaststepsareperformedbythefunctionDSK6713_AIC23_write(hCodec,sample)describedonpage34.Program2.4ExampleCCodeforStereoWriteDSK6713_AIC23_CodecHandlehCodec;floatleft,right;intileft,iright,sample;.../*Convertleftandrightvaluestointegers*/ileft=(int)left;iright=(int)right;/*CombineL/Rsamplesintoa32-bitword*/sample=(ileft<<16)|(iright&0x0000FFFF);/*PollXRDYbituntiltrue,thenwritetoDXR*/while(!DSK6713_AIC23_write(hCodec,sample));ThemethodofsendingorreceivingawordbywaitingfortheXRDYorRRDYbitstobecometrueiscalledpolling.2.3The’C6000TimersTheTMS320C6713hastwo32-bitgeneralpurposetimers.Theycanbeusedtotimeevents,countevents,generatepulses,interrupttheCPU,andsendsynchronizationeventstotheEDMA.Thetimerscanbeclockedbyaninternalorexternalsignal.Theyhaveaninputpin(TINP)andanoutputpin(TOUT)whichcanalsobeconfiguredasgeneralpurposeI/Opins.See[I.10]forallthedetailsaboutthetimers.Theinternalclockfrequencyforthe’C6713timersistheCPUclockfrequencydividedbyfour.Therefore,theDSKtimerclockfrequencyis225Mhz/4=56.25MHz.Youwill 2.4GeneratingaSineWavebyPollingXRDY43usetheexternalclockoutputasanexternalinputtotheMcBSP1serialportSampleRateGenerator(SRG)tocreateabitclockforabit-errorratetesterintheRS232experimentsofChapter10.Whentheexternalinputpin,TINP,isselectedasthetimerclocksource,thetimercancountinputpulsesandinterrupttheCPUwhenapresetnumberisreached.EachtimerhasthethreeregistersshowninTable2.2.TheCSLlibrary[I.6]hasCfunctionsandmacrosforconfiguringandinterfacingwiththetimers.Whenthe’C6713timersaredrivenbytheinternalclocksource,thefrequencyofthesignalontheTOUTpinisCPUclockfrequencyfout=(2.1)N×PeriodRegistervaluewhereN=4forpulsemodeandN=8forclockmode.Table2.2:TimerRegistersNameandAbbreviationDescriptionTimerControl(CTL)Setstheoperatingmodeofthetimer,monitorsthetimerstatus,andcontrolsthefunctionoftheTOUTpin.TimerPeriod(PRD)ContainsthenumberofinputclockcyclestocountordeterminestheperiodoftheTOUTsignalTimerCounter(CNT)A32-bitregisterholdingthecurrentvalueoftheincrementingcounter.2.4GeneratingaSineWavebyPollingXRDYInthenextthreesections,youwillusethesimpletaskofgeneratingasinewavebythreedifferentmethodstolearnaboutvariousaspectsoftheDSPandDSK.Inthissectionyouwillusethepollingmethoddescribedbrieflyabove.Thegoalistogeneratethecontinuous-timesinewaves(t)=sin2πf0twithfrequencyf0atthecodec’slineoutputjack.Letfs=1/TbethedesiredsamplingratewhereTisthesamplingperiod.Thentherequiredsignalsamplesaref0s(nT)=sin2πf0nT=sin2πn=sinn∆(2.2)fswhere∆=2πf0/fsisthechangeintheangle,θ(t)=2πf0t,betweensuccessivesamples.Therequiredsequenceofanglescanbegeneratedrecursively.Letθ[n]=n∆(2.3) 44LearningtoUsetheHardwareandSoftwareToolsThenθ[n+1]=(n+1)∆=n∆+∆=θ[n]+∆(2.4)andthedesiredsinewavesamplesaresinθ[n].Thisalgorithmwillbeusedtogeneratesinusoidalcarriersformodulatorsanddemodulatorsinsomeofthefollowingchapters.Insomeapplicationsitisefficienttostoreanarrayofsamplesofonecycleofasinewavetakenatasequenceofanglessufficientlyclosetogethertomeettheaccuracyrequirementsoftheapplicationanduseθ[n]asanindexintothearraytogetthesinevalues.Inthissection,theCsin()functionwillbeusedtogeneratethevalues.AsampleprogramsegmentforgeneratingasinewavebypollingisshowninProgramProgram2.5.Theinitializationcodeisnotshown.Duringinitialization,thecodecmustbeconfiguredforthedesiredsamplingrate.Twoimportantitemsshouldbenotedintheprogram:1.Thecodecuses16-bittwo’scomplementintegerswhichareintherange±215=±32,768.Also|sinx|≤1soifitisconvertedtoaninteger,itbecomeszeroalmosteverywhere.Therefore,sin(angle)whichisafloatismultipliedbythefloat15,000.0beforeitisconvertedtoanintegertousealargeportionofthedynamicrangeoftheDAC.2.Iftheangleθiscontinuallyincrementedby∆itwillgrowwithoutboundandeven-tuallyoverflow.Also,someCimplementationsofsinxdonotbehavewellforlargex.Therefore,theprogramcheckstoseeifθbecomeslargerthan2πandsubtracts2πwhenitdoes.Thisworksbecausesin(x)=sin(x−2π).Program2.5SampleProgramSegmentforPolling#include#definepi3.141592653589intsample=0;floatfs=16000.;floatf0=1000.;floatdelta=2.*pi*f0/fs;floattwopi=2.0*pi;floatangle=0;floatleft;for(;;){/*Infiniteloop*/left=15000.0*sin(angle);/*ScaleforDAC*/sample=((int)left)<<16;/*Putintophalf*//*PollXRDYbituntiltrue,thenwritetoDXR*/while(!DSK6713_AIC23_write(hCodec,sample));angle+=delta;/*Incrementsinewaveangle*/ 2.4GeneratingaSineWavebyPollingXRDY45if(angle>=twopi)angle-=twopi;/*Keepanglefromoverflowing*/}2.4.1Experiment2.2:InstructionsforthePollingExperimentFirst,notethefollowingimportantinformation:•Remembertoincludemath.hinyourCprogram.•TheDSKhasstereoLINEINandLINEOUTjacks.ThelabhascablestoconvertfromtheDSKstereoplugtoanRCAmonoconnectorfortheleftchannelandanRCAmonoconnectorfortherightchannel.TheRCAconnectorsarepluggedintoRCAtoBNCadapterssotheycanbeconnectedtotheoscillatorsandoscilloscopes.•CableColorScheme–LeftChannel:Redplug–RightChannel:WhiteplugForthepollingexperimentdothefollowing:1.Setthesamplingrateto16kHz.2.Generatea1kHzsinewaveontheleftchannelanda2kHzsinewaveontherightchannel.Rememberthat|sin(x)|≤1andthatfloatslessthan1become0whenconvertedtoints.Therefore,scaleyourfloatingpointsinewavesamplestomakethemgreaterthan1andfillreasonablepartoftheDACdynamicrangebeforeconvertingthemtoints.3.Combinetheleftandrightchannelintegersamplesintoa32-bitintegerandwritetheresultingwordtotheMcBSP1DXRusingpollingoftheXRDYflag.4.Observetheleftandrightchanneloutputsontwooscilloscopechannels.5.Verifythatthesinewavefrequenciesobservedonthescopearethedesiredvaluesbymeasuringtheirperiods.6.Usethesignalgeneratortomeasurethefrequencies.TheHPoscilloscopesalsocanmeasurethefrequencies.7.Whenyouhaveverifiedthatyourprogramisworking,changetheleftchannelfrequencyto15kHzandtherightchannelfrequencyto14kHz.MeasuretheDACoutputfrequencies.Explainyourresultsbymathematicalanalysis.Thatis,giveequationstoshowwhyyougotwhatyoudid.(Hint:Lookup“aliasing”inanyreferenceondigitalsignalprocessing.) 46LearningtoUsetheHardwareandSoftwareTools2.5GeneratingaSineWaveUsingInterruptsNearlyallthetimeinthepollingmethodisspentsittinginaloopwaitingfortheXRDYflagtogetsetandtheDSPisdoingalmostnothing.Inareal-worldapplicationtheDSPwouldbeperformingmanyothertaskslikerunningaCELPspeechcodec,modulatinganddemodulatingdataforamodem,ordecodingaturbocode.AmuchmoreefficientapproachistolettheDSPperformthesedesiredtasksinthebackgroundandhavetheserialportinterruptthebackgroundtaskswhenitneedsasampletotransmitorasamplehasbeenreceived.Theinterruptserviceroutineiscalledaforegroundtask.SeetheTMS320C6000CPUandInstructionSetReferenceGuide[I.7]andTMS320C6713BFloating-PointDigitalSignalProcessor[I.12]forcompletedetailsontheinterruptcontroller.2.5.1TheCPUInterruptPrioritiesandSourcesTMS320C6713DSPhasavectoredpriorityinterruptcontrollerthathandles16differentCPUinterrupts.ThehighestpriorityinterruptisRESETwhichcannotbemasked.ThenextpriorityinterruptistheNon-MaskableInterrupt(NMI)whichisusedtoalerttheDSPofaserioushardwareproblem.Therearetworeservedinterruptsand12additionalmaskableCPUinterrupts.Theperipherals,suchas,thetimers,McBSPandMcASPserialports,EDMAcontroller,plusexternalinterruptpinssourcedfromtheGPIOmodulepresentasetofmanyinterruptsources.The16CPUinterruptsandtheirdefaultsourcesareshowninTable2.3.INT00hasthehighestpriorityandINT15thelowest.TheinterruptsystemincludesamultiplexertoselecttheCPUinterruptsourcesandmapthemtothe12maskableprioritizedCPUinterrupts.ThecompletelistofC6713interruptsourcesisshownintheTable2.4alongwiththerequiredInterruptSelectorvalues.TheGPIOmodulecanselectexternalpinsasinterruptsources.ThemappingisshowninTable2.5.2.5.2InterruptControlRegistersTheinterruptcontrolregistersandtheirpurposesareshowninTable2.6.CompletedetailsaboutthelayoutoftheregistersarepresentedintheTMS320C6000CPUandInstructionSetReferenceGuide[I.7].TheCSLlibraryprovidesfunctionsforinterfacingwiththeseregisters.TheUniversityofMarylandmodifieddsk6713bsl32libraryalsocontainsavarietyofmacrosandfunctionsforinterfacingwiththeseregistersandsettingupaninterruptsystemwithaninterruptserviceroutinejumptablethatallowsinterruptserviceroutinestobehookedtoorunhookedfromCPUinterruptsinaCprogram.AlistofthesefunctionsisshowninTable2.7.TheControlStatusRegister(CSR)bit0istheGlobalInterruptEnable(GIE)bit.AllmaskableinterruptsaredisabledIfGIE=0,andmaskableinterruptscanbeenabledifGIE=1.Bit1isthePreviousGIE(PGIE)whichsavesthevalueofGIEwhenaninterruptistaken.Bits0through15oftheInterruptEnableRegister(IER)correspondtothe16CPUinterrupts.Aninterruptisenabledbysettingitsbitto1anddisabledbyclearingitsbit 2.5GeneratingaSineWaveUsingInterrupts47Table2.3:DefaultCPUInterruptSourcesINTERRUPTDEFAULTCPUBYTESELECTORSELECTORDEFAULTINTERRUPTOFFSETCONTROLVALUEINTERRUPTNUMBERINISTREGISTER(BINARY)EVENTINT00000h--RESETINT01020h--NMIINT02040h--ReservedINT03060h--ReservedINT04080hMUXL[4:0]00100GPINT4INT050A0hMUXL[9:5]00101GPINT5INT060C0hMUXL[14:10]00110GPINT6INT070E0hMUXL[20:16]00111GPINT7INT08100hMUXL[25:21]01000EDMAINTINT09120hMUXL30:26]01001EMUDTDMAINT10140hMUXH[4:0]00011SDINTINT11160hMUXH[9:5]01010EMURTDXRXINT12180hMUXH[14:10]01011EMURTDXTXINT131A0hMUXH[20:16]00000DSPINTINT141C0hMUXH[25:21]00001TINT0INT151E0hMUXH[30:26]00010TINT1to0.Bit1istheNonmaskableInterruptEnable(NMIE)bit.NMIEmustbeset,thatis,NMIE=1,forthemaskableinterrupts4through15togetserviced.IfNMIE=0,noneofthemaskableinterruptsgetserviced.Whenaninterruptoccurs,thecorrespondingbitgetssetintheInterruptFlagsRegister(IFR).Thishappenswhetherornottheinterruptisenabledandallowspendinginterruptstobeservicedatalatertimeiftheyarenotcurrentlyenabled.Interruptsareservicedintheorderoftheirprioritywithalowernumberinterrupthavinghigherpriority.AbitintheIFRcanbemanuallysetbywritinga1tothecorrespondingbitintheInter-ruptSetRegister(ISR)..AbitintheIFRcanbeclearedbywritinga1tothecorrespondingbitintheInterruptClearRegister(ICR).Whenaninterruptisserviced,theprogramjumpstotheinterruptserviceroutine.ItmustknowwheretoreturntoaftertheISRiscompleted.TheInterruptReturnPointer(IRP)savesthereturnaddress.TheNonmaskableInterruptReturnPointer(NRP)servesthesamepurposefornonmaskableinterrupts.TheInterruptServiceTablePointer(ISTP)holdstheaddressoftheInterruptServicetable.WhentheDSPispoweredup,thedefaultaddressisinitializedtobeaddress0atthestartofmemory. 48LearningtoUsetheHardwareandSoftwareToolsTable2.4:InterruptSourcesINTERRUPTSELECTORINTERRUPTMODULEVALUEEVENT(BINARY)00000DSPINTHPI00001TINT0Timer000010TINT1Timer100011SDINTEMIF00100GPINT4GPIO00101GPINT5GPIO00110GPINT6GPIO00111GPINT7GPIO01000EDMAINTEDMA01001EMUDTDMAEmulation01010EMURTDXRXEmulation01011EMURTDXTXEmulation01100XINT0McBSP001101RINT0McBSP001110XINT1McBSP101111RINT1McBSP110000GPINT0GPIO10001Reserved-10010Reserved-10011Reserved-10100Reserved-10101Reserved-10110I2CINT0I2C010111I2CINT1I2C111000Reserved-11001Reserved-11010Reserved-11011Reserved-11100AXINT0McASP011101ARINT0McASP011110AXINT1McASP111111ARINT1McASP1 2.5GeneratingaSineWaveUsingInterrupts49Table2.5:ExternalInterruptSourcesPININTERRUPTMODULENAMEEVENTGP[15]GPINT0GPIOGP[14]GPINT0GPIOGP[13]GPINT0GPIOGP[12]GPINT0GPIOGP[11]GPINT0GPIOGP[10]GPINT0GPIOGP[9]GPINT0GPIOGP[8]GPINT0GPIOGP[7]GPINT0orGPINT7GPIOGP[6]GPINT0orGPINT6GPIOGP[5]GPINT0orGPINT5GPIOGP[4]GPINT0orGPINT4GPIOGP[3]GPINT0GPIOGP[2]GPINT0GPIOGP[1]GPINT0GPIOGP[0]GPINT0GPIOTable2.6:InterruptControlRegistersNameDescriptionCSRControlStatusRegisterGloballysetordisableinterruptsIERInterruptEnableRegisterEnableinterrupts.BitncorrespondstoINTnIFRInterruptFlagsRegisterShowsstatusofinterrupts.Bitncorre-spondstoINTnISRInterruptSetRegisterManuallysetflagsinIFRICRInterruptClearRegisterManuallyclearflagsinIFRISTPInterruptServiceTablePointertothebeginningoftheinterruptPointerservicetableNRPNonmaskableInterruptRe-ReturnaddressusedonreturnfromaturnPointernonmaskableinterruptIRPInterruptReturnPointerReturnaddressusedonreturnfromamaskableinterrupt 50LearningtoUsetheHardwareandSoftwareTools2.5.3WhatHappensWhenanInterruptOccursInorderforamaskableinterrupttooccur,thefollowingconditionsmustbetrue:•Theglobalinterruptenablebit(GIE)whichisbit0inthecontrolstatusregister(CSR)issetto1.WhenGIE=0,nomaskableinterruptcanoccur.•Thenonmaskableinterruptenablebit(NMIE)intheinterruptenableregister(IER)issetto1.NomaskableinterruptcanoccurifNMIE=0.•Thebitcorrespondingtothedesiredinterruptissetto1intheIER.•Thedesiredinterruptoccurs,whichsetsthecorrespondingbitintheinterruptflagsregister(IFR)to1andnohigherpriorityinterruptflagsare1intheIFRWhenCPUinterruptnoccurs,programexecutionjumpstobyteoffset4×8×n=32ninaninterruptservicetable(IST).TheISTcontains16interruptservicefetchpackets(ISFP),eachconsistingofeight32-bitinstructionwords.AnISFPmaycontainanentireinterruptserviceroutineormaybranchtoalargerserviceroutine.AnexampleofanISFPforRESETforCprogramsisshownbelow.TheCcompilergeneratestheCinitializationcodestartingataddress_c_init00,sotheRESETISFPsimplybranchestothisaddress._RESET:mvk_c_int00,b0;loadlower16bitsof_c_init00mvkh_c_int00,b0;loadupper16bitsof_c_init00b.s2b0;branchtoCinitializationnop5;do5NOP’sforbranchlatency5nop;addfourwordstofetchpacketnop;tomakeatotalof8wordsnopnopWewillnormallystarttheinterruptservicetable(IST)atlocation0.ItcanberelocatedandtheInterruptServiceTablePointerregister(ISTP)pointstoitsstartingaddresswhichmustbeamultipleof256words.TheorganizationoftheISTisshowninTable2.3.TheDSPtakesthefollowingactionswhenaninterruptoccurs:•Thecorrespondingflagintheinterruptflagsregister(IFR)issetto1.•IfGIE=NMIE=1andnohigherpriorityinterruptsarepending,theinterruptisserviced:–GIEiscopiedtoPGIE(previousglobalinterruptenablebit)andGIEisclearedtoprecludeotherinterrupts.GIEcanbemanuallysettoallowtheinterruptserviceroutinetobeinterrupteditself.–TheflagbitintheIFRisclearedtoshowthattheinterrupthasbeenserviced.–Thereturnaddressisputintheinterruptreturnpointer(IRP). 2.5GeneratingaSineWaveUsingInterrupts51–Executionjumpstothecorrespondingfetchpacketintheinterruptservicetable(IST).–TheserviceroutinemustsavetheCPUstateonentryandrestoreitonexit.–AreturnfromamaskableinterruptisaccomplishedbytheassemblyinstructionsBIRP;return,movesPGIEtoGIENOP5;delayslotsforbranch2.5.4TIExtensionstoStandardCInterruptServiceRoutinesTheTexasInstrumentscompilerincludesextensionstostandardCforinterruptserviceroutines.TomakethecompilerusetheseextensionswhenwritinganinterruptserviceroutineinC,declarethefunctiontobeanISRbyusingtheinterruptkeyword.Forexample,declareyour_isr_name()tobeanISRbythestatementinterruptvoidyour_isr_name(){...}wherethedotswithinthebracesrepresentyoursourcecode.Youcanalsousetheinterruptpragmaasshownonthefollowingline:#pragmaINTERRUPT(your_isr_name)TheCcompilerwillthenautomaticallygeneratecodeto:1.SavetheCPUregistersusedbytheISRonthestack.IftheISRcallsanotherfunction,allregistersaresaved.2.RestoretheregistersbeforereturningwithaBIRPinstruction.Youcannotpassparametersto,orreturnvaluesfromaninterruptserviceroutine12.5.5Usingthedsk6713bsl32LibraryforInterruptsAlistofCfunctionsandmacrosforinterfacingwiththeinterruptsystemisshowninTable2.7.TowriteandbuildprogramsusingtheTICinterruptextensionsandthedsk6713bsl32interruptfunctions:•AddthelinkercommandfileC:c6713dskdsk6713.cmdtoyourproject.•IncludetheheaderfileC:c6713dskdsk6713bsl32includeintr.hinyourpro-gram.Youshouldsetthe“IncludeSearchPath”inyourproject,soitisonlynecessarytousetheline“includeintr.h”inyourCprogram.•Besuretoaddthelibrarydsk6713bsl32.libtoyourproject.Theinterruptservicetablewillbegeneratedinasectioncalled.vec.Thesamplebeginninglinkercommandfiledsk6713.cmdloadsthe.vecsectionstartingatabsoluteaddress0.1WhenusingtheChipSupportLibrary(CSL)andDSP/BIOStheconventionsforISR’saredifferent.TheinterruptkeywordshouldnotbeusedandtheISR’scanpassarguments.See[I.8]fordetails. 52LearningtoUsetheHardwareandSoftwareToolsTable2.7:InterruptFunctionsProvidedbyintr.handintr.cindsk6713bsl32MACROFUNCTIONSINTR_GLOBAL_ENABLE()SetsGIEbitinCSRINTR_GLOBAL_DISABLE()ClearsGIEbitinCSRINTR_ENABLE(bit)SetsbitinIERINTR_DISABLE(bit)ClearsbitinIERINTR_CHECK_FLAG(bit)ReturnsvalueofbitinIFRINTR_SET_FLAG(bit)SetinterruptbywritingtoISRbitINTR_CLR_FLAG(bit)Clearsint.flagbywriting1toICRbitINTR_SET_MAP(cpu_intr,src,sel)MapinterruptsourcetoCPUinterruptINTR_GET_ISN(cpu_intr,sel))GetISNofselectedinterruptINTR_MAP_RESET()ResetinterruptmultiplexermaptodefaultsINTR_EXT_POLARITY(bit,val)Assignexternalinterrupt’spolarityFUNCTIONSintr_hook(*fp,cpu_intr)PlacefunctionpointerintoISRjumptableatlocationforcpu_intrintr_init()InitializeISTPwithbaseaddressoftheinterruptservicetable(IST).Usingthisfunctioncausesdefaultinterruptservicefetchpackets(ISFP)tobeloadedintotheInterruptServiceTable(IST)andadefaultinterruptserviceroutinejumptabletobecreated.intr_map(cpu_intr,isn)Mapsinterruptsourceisntothecpu_intrintr_isn(cpu_intr)ReturnsinterruptsourcenumberforCPUint.intr_reset()Resetinterruptregisterstodefaultvaluesintr_get_cpu_intr(isn)ReturnCPUinterruptassignedtoISN.Ifisnnotmapped,return-1 2.5GeneratingaSineWaveUsingInterrupts53InstallingaCInterruptServiceRoutineThefollowinglistshowsthestepsthatshouldbetakento“install”aCinterruptserviceroutineforCPUinterrupt15asanexample.1.Useintr_reset()tosettheinterruptcontrolregisterstotheirdefaultvalues.ItinitializestheISTPandcausestheinterruptservicetableandinterruptserviceroutinejumptabletobeinstalled.2.MaptheinterruptsourcenumbertoaCPUinterruptnumber.intr_map(CPU_INT15,ISN_XINT0);3.Cleartheinterruptflagtomakesurenoneispending.INTR_CLR_FLAG(CPU_INT15);4.HooktheISRtotheCPUinterrupt.LettheISRbemy_isr().intr_hook(my_isr,CPU_INT15);5.EnabletheNMIinterrupt.INTR_ENABLE(CPU_INT_NMI);6.EnabletheCPUinterruptintheIEregister.INTR_ENABLE(CPU_INT15);7.SettheGIEbitintheCSR.INTR_GLOBAL_ENABLE();AnexampleofusingthesefunctionsisshowninProgram2.6onpage54.2.5.6Experiment2.3:GeneratingSineWavesbyUsingInterruptsRepeattheinstructionsforgeneratingasinewavebypollinginSection2.4.1butnowuseaCinterruptserviceroutinetogeneratethesinewavesamplesandwritethemtotheMcBSP1datatransmitregister(DXR1).NopollingoftheXRDY1flagisneededbecausesamplesaretransmittedonlywheninterruptsoccuratthecodec’ssamplingrateandcauseexecutiontojumpintoyourinterruptserviceroutine.Themain()functionshould:•initializeMcBSP0,McBSP1,andthecodecwitha16kHzsamplingrate,•mapCPUINT15toMcBSP1XINT1,Note:ThechoiceofINT15wasarbitrary.AnyofINT4–INT15canbeused.•hookCPUINT15toyourISR,•enableinterrupts,•andgointoaninfiniteinterruptibleloop. 54LearningtoUsetheHardwareandSoftwareToolsApartialCcodesegmentforaccomplishingthesetasksisshowninthefollowingprogramlisting.Animportantpointistonoticethatangle_leftandangle_rightintheISRmustretaintheirvaluesbetweenISRcalls.ThisisdoneintheISRintheprogramsegmentbydeclaringthemtobestatic.Theycouldalsohavebeenmadeglobalvariables.Also,youshouldnotusethepollingMcBSPwritefunctionsincetheprogramjumpstotheISRwhentheXRDY1flaggoesfromFALSEtoTRUE.UsetheCSLnon-pollingwritefunctionMCBSP_write()asshownintheprogramsegment.Program2.6SampleCCodeforGeneratingaSineWavebyInterrupts#include#include#include#include#include...#definesampling_rate16000.#definefreq_left1000.#definefreq_right2000.#definescale10000.0#definePI3.141592653589floattwopi=2.*PI;/*phaseincrementleftforsinewave*/floatdelta_left=2.0*PI*freq_left/sampling_rate;/*phaseincrementforrightsinewave*/floatdelta_right=2.0*PI*freq_right/sampling_rate;interruptvoidtx_isr(void);/*prototypetheISR*/voidmain(void){DSK6713_AIC23_CodecHandlehCodec;/**********************************************************************//*Initializeinterruptsystemwithintr_reset()*//**//*Thedefaultinterruptserviceroutinesaresetupbycallingthe*//*functionintr_reset()intheUMDaddedfileintr.c.Thisclears*//*GIEandPGIE,disablesallinterruptsexceptRESETinIER,clears*/ 2.5GeneratingaSineWaveUsingInterrupts55/*theflagsintheIFRforthethemaskableinterruptsINT4-INT15,*//*resetstheinterruptmultiplexers,initializestheinterrupt*//*servicetablepointer(ISTP),andcausestheInterruptService*//*TableandInterruptServiceRoutineJumpTabletobeloaded.*//**********************************************************************/intr_reset();/*dsk6713_init()mustbecalledbeforeotherBSLfunctions*/DSK6713_init();/*IntheBSLlibrary*//*Startthecodec.McBSP1uses32-bitwords*/hCodec=DSK6713_AIC23_openCodec(0,&config);/*Changethesamplingrateto16kHz*/DSK6713_AIC23_setFreq(hCodec,DSK6713_AIC23_FREQ_16KHZ);/*SelectMcBSP1transmitintforINT15*/intr_map(CPU_INT15,ISN_XINT1);/*HookourISRtoINT15*/intr_hook(tx_isr,CPU_INT15);/*Clearoldinterrupts*/INTR_CLR_FLAG(CPU_INT15);/*Enableinterrupts*//*NMImustbeenabledforotherintstooccur*/INTR_ENABLE(CPU_INT_NMI);/*SetINT15bitinIER*/INTR_ENABLE(CPU_INT15);/*Turnonenabledints*/INTR_GLOBAL_ENABLE();/*WriteawordtostarttransmissionusingCSLfunction*/MCBSP_write(DSK6713_AIC23_DATAHANDLE,0);for(;;);/*infiniteinterruptibleloop*/}interruptvoidtx_isr(void){floatx_left,x_right;/**********************************************************************/ 56LearningtoUsetheHardwareandSoftwareTools/*Note:angle_leftandangle_rightmustretaintheirvaluesbetween*//*ISRcalls.Dothisbymakingthemstaticasbeloworglobal.*//**********************************************************************/staticfloatangle_left=0.;staticfloatangle_right=0.;intoutput,ileft,iright;/*Putyourcodeheretodothefollowing:1.Generatescaledleftandrightchannelsinesamples.Convertthemtointegersandcombinethemintoa32-bitoutputword.2.Incrementphaseanglesofsinesmodulo2*pi.3.ThereisnoneedtopollXRDY1sinceitstransitionfromfalsetotruecausesajumptothisISR.DSK6713_AIC23_DATAHANDLEisdeclaredasaglobalvariableinDSK6713_aic23_opencodec.c.JustwritetheoutputsampletoMcBSP1bytheCSLlibraryfunctionMCBSP_write()asshownbelow.*/MCBSP_write(DSK6713_AIC23_DATAHANDLE,output);}2.6GeneratingaSineWavewiththeEDMAandaTableInthepollingandinterruptexperiments,thesinewavesamplevalueswerenumericallycomputedusingthesin(·)functionandthisconsumesCPUcycles.Inmanyreal-timeapplications,asetoftasksisrepeatedperiodicallysotheDSPhasalimitedamountoftimetoperformeachtaskandcomputationalefficiencyiscritical.Anefficientmethodforgeneratingasinewavecarriersignalincommunicationsystemsistoreadthesamplevaluesoutofaprecomputedtable.Inthisexperiment,youwilllearnhowtoreadthesamplesfromatableandloadthemintotheMcBSP1DataTransmitRegister(DXR1)fortransmissiontothecodecbyusingtheEnhancedDirectMemoryAccess(EDMA)controller.TheEDMAcontrollerisanotherimportantinternalTMS320C6713peripheral.TheEDMAcontrollerhandlesalldatatransfersbetweentheL2cache/memorycontrollerandperipheralsinthe’C621x/’C671x/’C64xfamilyofDSP’sindependentlyoftheCPUoperations.Earlier’C6xseriesDSP’slikethe’C6201and’C6701haveasimplerperipheralcalledtheDMAcontroller.ThearchitectureoftheEDMAcontrollerisquitedifferentthanthatoftheDMAcontroller.EnhancementsoftheEDMAinclude16channelsforthe’C6713withprogrammablepriority,andtheabilitytolinkandchaindatatransfers.2.6.1EDMAOverviewTheEnhancedDirectMemoryAccessController(EDMA)handlesalldatatransfersbetweentheL2cache/memorycontrollerandtheperipherals.Theseincludecacheservicing,non- 2.6GeneratingaSineWavewiththeEDMAandaTable57cacheablememoryaccess,user-programmeddatatransfers,andhostaccess.TheEDMAcanmovedatatoandfromanyaddressablememoryspacesincludinginternalmemory(L2SRAM),peripherals,andexternalmemory.TheEDMAisquitecomplexandwewillonlytouchonitsoperation.SeetheTMS320C6000PeripheralsReferenceGuide[I.10,Chapter6]andTMS320C6713BFloating-PointDigitalSignalProcessor[I.12]forcompletedetails.SomeoftheEDMAfeaturesare:•TheEDMAcontrollerincludeseventandinterruptprocessingregisters,aneventen-coder,aparameterRAM,andaddressgenerationhardware.•TheEDMAhas16independentchannelsandtheycanbeassignedpriorities.•DatatransferscanbeinitiatedbytheCPUorevents.•Whenaneventoccurs,itstransferparametersarereadfromtheParameterRAM(PaRAM).Theseparametersaresenttoaddressgenerationhardware.•TheEDMAcantransferelementsthatare8-bitbytes,16-bithalfwords,or32-bitwords.•Verysophisticatedblocktransferscanbeprogrammed.TheEDMAcantransfer1-dimensionaland2-dimensionaldatablocksconsistingofmultipleframes.See[I.10,Section6.8]fordetails.•Afteranelementtransfer,sourceand/ordestinationelementaddressescanstaythesame,beincrementedordecrementedbyoneelement,orincrementedordecrementedbythevalueintheindexregisterELEIDXforthechannel.ArraysareoffsetbyFRMIDXforthechannel.•Afteraprogrammedtransferiscompleted,theEDMAcancontinuedatatransfersbylinkingtoanothertransferprogrammedintheParameterRAMforthechannelorbychainingtoatransferforanotherchannel.•TheEDMAcangeneratetransfercompletioninterruptstotheCPUalongwithaprogramabletransfercompletecode.TheCPUcanthentakesomedesiredactionbasedonthetransfercompletecode.•TheEDMAhasaquickDMAmode(QDMA)thatcanbeusedforquick,one-timetransfers.2.6.2EDMAEventSelectionThe’C6713EDMAsupportsupto16EDMAchannels.Channels8through11arereservedforchaining,leaving12channelstoserviceperipheraldevices.DatatransferscanbeinitiatedbytheCPUorevents.ThedefaultmappingofeventstochannelsisshowninTable2.8.Theusercanchangethemappingofeventstochannels.TheEDMAselectorregistersESEL0,ESEL1,andESEL2controlthismapping.Table2.9showstheeventsandselectorcodes. 58LearningtoUsetheHardwareandSoftwareToolsTable2.8:TMS320C6713DefaultEDMAEventsEDMADEFAULTEDMASELECTORSELECTORDEFAULTCHAN.CONTROLCODEEDMAREGISTER(BINARY)EVENT0ESEL0[5:0]000000DSPINT1ESEL0[13:8]000001TINT02ESEL0[21:16]000010TINT13ESEL0[29:24]000011SDINT4ESEL1[5:0]000100GPINT45ESEL1[13:8]000101GPINT56ESEL1[21:16]000110GPINT67ESEL1[29:24]000111GPINT78--TCC8(Chaining)9--TCC9(Chaining)10--TCC10(Chaining)11--TCC11(Chaining)12ESEL3[5:0]001100XEVT013ESEL3[13:8]001101REVT014ESEL3[21:16]001110XEVT115ESEL3[29:24]001111REVT12.6.3RegistersforEventProcessingTheEDMAcontrollercontainsfourregistersforeventprocessing.Theyaredescribedinthefollowinglist.EventRegister(ER)Wheneventnoccurs,bitnissetintheER.EventEnableRegister(EER)SettingbitnoftheEERenablesprocessingofthatevent.Clearingbitnto0disablesprocessingofeventn.TheoccurrenceofeventnislatchedintheERevenifitisdisabled.EventClearRegister(ECR)IfaneventisenabledintheEERandgetspostedintheER,theERbitisautomaticallyclearedwhentheEDMAprocessesthetransferfortheevent.Iftheeventisdisabled,theCPUcancleartheeventflagbitintheERbywritinga1tothecorrespondingbitintheECR.Writinga0hasnoeffect.EventSetRegister(ESR)Writinga1toabitintheESRcausesthecorrespondingbitintheeventregister(ER) 2.6GeneratingaSineWavewiththeEDMAandaTable59togetset.ThisallowstheCPUtosubmiteventrequestsandcanbeusedasagooddebuggingtool.Table2.9:EDMAEventSelectionEDMAEDMASELECTOREDMAMODULESELECTOREDMAMODULECODEEVENTCODEEVENT(binary)(binary)000000DSPINTHPI100100AREVTOMcASP0000001TINT0Timer0100101AREVT0McASP0000010TINT1Timer1100110AXEVTE1McASP1000011SDINTEMIF100111AXEVTO1McASP1000100GPINT4GPIO101000AXEVT1McASP1000101GPINT5GPIO101001AREVTE1McASP1000110GPINT6GPIO101010AREVTO1McASP1000111GPINT7GPIO101011AREVT1McASP1001000GPINT0GPIO101100I2CREVT0I2C0001001GPINT1GPIO101101I2CXEVT0I2C0001010GPINT2GPIO101110I2CREVT1I2C1001011GPINT3GPIO101111I2CXEVT1I2C1001100XEVT0McBSP0110000GPINT8GPIO001101REVT0McBSP0110001GPINT9GPIO001110XEVT1McBSP1110010GPINT10GPIO001111REVT1McBSP1110011GPINT11GPIO010000–Reserved110100GPINT12GPIO011111110101GPINT13GPIO100000AXEVTE0McASP0110110GPINT14GPIO100001AXEVTO0McASP0110111GPINT15GPIO100010AXEVT0McASP0111000–Reserved100011AREVTE0McASP01111112.6.4TheParameterRAM(PaRAM)ThetransferparametertablefortheEDMAchannelsandlinkinformationisstoredintheParameterRAM(PaRAM)whichisa2K-byteRAMblocklocatedwithintheEDMA.Thetableconsistsofsix-wordparametersetsforatotalof85sets.Eachsetuses6×4=24bytesandcontainstheparametersforatransfershownintheTable2.10.TheOPTFieldinthe(PaRAM)ThemeaningsofallthefieldsinatransfersetarefairlyobviousexceptforOPTwhichcontainsfieldstosettheprioritytoHighorLow;settheelementsizeto8,16,or32bits; 60LearningtoUsetheHardwareandSoftwareToolsdefinethesourceanddestinationas1or2-dimensional;setthesourceanddestinationaddressupdatemodes;enableordisablethetransfercompleteinterrupt;definethetransfercompletecode;enableordisablelinking;andsettheframesynchronizationmode.Table2.10:FormatofaTransferParameterSetRecord3116150Options(OPT)Word0SourceAddress(SRC)Word1Array/framecountElementcountWord2(FRMCNT)(ELECNT)DestinationAddress(DST)Word3Array/frameindexElementindexWord4(FRMIDX)(ELEIDX)ElementcountlinkaddressWord5reload(ELERLD)(LINK)ContentsofthePaRAMThePaRAMisorganizedasfollows:•Thefirst16parametersetsareforthe16EDMAevents.Eachsetcontains24bytes.•Theremainingparametersetsareusedforlinkingtransfers.Eachsetis24bytes.•Theremaining8bytesofunusedRAMcanbeusedasascratchpadarea.ApartofortheentirePaRAMcanbeusedasascratchpadRAMwhentheeventscorrespondingtothisregionaredisabled.Whenaneventmappedtoaparticularchanneloccurs,saychannelnwithn∈{0,1,...,15},itsparametersarereadfromparametersetninthePaRAMandsenttotheaddressgenera-tionhardware.2.6.5SynchronizationofEDMATransfersTheEDMAcanmake1or2-dimensionaltransfers.Wewillonlyconsiderthe1-Dcase.A1-DblocktransferconsistsofFRMCNT+1frames.EachframeconsistsofthenumberofelementsspecifiedbythefieldELECNTintheparameterset.Thefollowingtwotypesof1-Dsynchronizedtransfersarepossible:1.ElementSynchronized1-DTransfer(FS=0inOPT)Whenachannelsynceventoccurs,forexample,atransitionofaMcBSPXRDYflag 2.6GeneratingaSineWavewiththeEDMAandaTable61fromfalsetotrue,anelementinaframeistransferredfromitssourcetodestination,thesourceanddestinationaddressesareupdatedintheparametersetaftertheelementistransferred,andtheelementcount(ELECNT)isdecrementedintheparameterset.WhenELCNT=1,indicatingthefinalelementintheframe,andasynceventoccurs,theelementistransferred.ThentheelementcountisreloadedwiththevalueofELERLDintheparametersetandtheframecount(FRMCNT)isdecrementedby1.TheEDMAcontinuestransfersatsynceventsforanewframeifonestillremainstobetransferred.2.FrameSynchronized1-DTransfers(FS=1inOPT)Asynceventcausesalltheelementsinaframetobetransferredasrapidlyaspossible.Eachneweventcausesanotherframetobetransferredasrapidlyaspossibleuntiltherequestednumberofframeshasbeentransferred.2.6.6LinkingandChainingEDMATransfersLinkingEDMATransfersWhentheLINKfield,bit1,inoptionsparameterOPTissetto0,theEDMAstopsafteratransferiscompleted.WhenLINK=1andtherequestedtransferiscompleted,thetransferparametersarereloadedwiththeparametersetpointedtobythe16-bitlinkaddress,andtheEDMAcontinuestransferswiththisnewset.TheentireparameterRAMislocatedinthememoryarea01A0xxxxh,soa16-bitlinkaddressissufficient.Thelinkaddressmustbelocatedona24-byteboundary.Thereisnolimittothenumberoftransfersthatcanbelinked.However,thefinaltransfershouldlinktoaNULLparametersetwhichisonewithallitsentriessetto0(24zerobytes).AtransfercanbelinkedtoitselftosimulatetheautoinitializationfeatureoftheTMS320C6201andTMS320C6701DMA.Thisisusefulforcircularbufferingandrepetitivetransfers.Toeliminatetimingproblemsresultingfromtheparameterreloadtime,theeventregister(ER)isnotcheckedwhiletheparametersarebeingreloaded.However,neweventsareregisteredintheER.AnyrecordinthePaRAMcanbeusedforlinking.However,asetinthefirst16shouldbeusedonlyifthecorrespondingeventisdisabled.ChainingEDMAChannelsTheEDMAchainingcapabilityallowsthecompletionofanEDMAchanneltransfertotriggeranotherEDMAchanneltransfer.EDMAchainingdoesnotmodifyanychannelparameters.Itjustgivesasynchronizationeventtothechainedchannel.Linkingandchainingaredifferent.Linkingreloadsthecurrentchannelparameterswiththelinkedparametersandtransferscontinueonthesamechannelwiththelinkedparameters.Chainingdoesnotmodifyorupdateanychainedparameters.Itsimplygivesasynchronizationeventtothechainedchannel.Channels8,9,10,and11arereservedforchaining.Chainingisenabledbysettingbit8,9,10,or11inthechannelchainenableregister(CCER).Thefour-bitfield,transfercompletecode(TCC),inOPTforachannelmustalsobesettooneofthesefourvaluestocausechainingtooccurattheendofthetransfer. 62LearningtoUsetheHardwareandSoftwareTools2.6.7EDMAInterruptstotheCPUWhentheTCINTbitissetto1inOPTforanEDMAchannelandtheeventmappedtothechanneloccurs,theEDMAsetsabitinthechannelinterruptpendingregister(CIPR)determinedbythetransfercompletecodeprogrammedinOPT.Then,ifthebitcorrespondingtothechannelissetinthechannelinterruptenableregister(CIER),theEDMAgeneratestheinterruptEDMAINTtotheCPU.IftheCPUinterruptEDMAINT(defaultCPUINT8)isenabledintheCPUIER,programexecutionjumpstothevectoredinterruptserviceroutine(ISR).TheISRcanreadtheCIPRtocheckwhichEDMAeventshavebeenregisteredascompletedandtaketheappropriateaction.2.6.8Experiment2.4:GeneratingaSineWaveUsingtheEDMAControllerTolearnhowtousetheEDMAcontroller,writeaprogramtodothefollowing:1.ConfiguretheMcBSP’sandcodecasinthepollingandinterruptexperimentsandagainusea16kHzsamplingrate.2.Generatea512wordintegerarray,table[512],wheretheupper16bitsarethesamplesfor32cyclesofa1kHzsinewavefortheleftchannel,andthelower16bitsarethesamplesfor64cyclesofa2kHzsinewavefortherightchannel.Ofcourse,theleftandrightchannelsinewavesamplesmustbescaledtousealargepartoftheDAC’sdynamicrangeandmustbeconvertedto16-bitintegersbeforebeingcombinedinto32-bitwords.3.ConfiguretheEDMAcontrollertotransfertheentirearrayof512samplestotheDataTransmitRegister(DXR)ofMcBSP1whichwillsendthemtothecodec.SynchronizethetransferswiththeXRDY1eventtogetthe16kHzsamplingrate.4.Linkthechannelparametersetbacktoitselfsothesinewavesarecontinuouslysent.TestyourprogrambyrunningitandobservingthecodecleftandrightchanneloutputsontheoscilloscopeVerifythattheyaresinewaveswiththedesiredfrequencies.Thefollowingexampleprogramsegmentdoesmostoftheworkforyou.ItisonthePC’sharddriveasC:c6713dskedma_sines.candontheclasswebsite.ItusesTI’sChipSupportLibrary(CSL)toconfiguretheEDMA.DetailedinformationabouttheCSLcanbefoundintheTMS320C6000ChipSupportLibraryAPIReferenceGuide[I.6].YoucanalsoconvenientlyfindCSLdocumentationbybringingupCodeComposerandfollowingthepath:Help→Contents→ChipSupportLibrary→EDMAModule.TheprogramconfigurestheEDMAtouseelementsyncbytheeventXEVT1whichhappenswhenXRDY1makesatransitionfrom0to1ThedefaultmappingofthiseventtoEDMAchannel14isused.TheEDMAissettotransfersingleframescontaining512elementswith 2.6GeneratingaSineWavewiththeEDMAandaTable63theelementsbeing32-bitwords.Thesame512-wordsinewavesampleframeistransmittedrepeatedlybylinkingbacktothesameparametersetattheendofeachframetransfer.ThetwolinesEDMA_link(hEdmaXmt,hEdmaReloadXmt);EDMA_link(hEdmaReloadXmt,hEdmaReloadXmt);requiresomeclarification.ThefunctionEDMA_link()setstheLINKparameterinthepa-rametersetrecord.InthestructuregEdmaConfigXmt,theLINKparameterissettoNULL.Inthefirstcodelineabove,theNULLforLINKissetinthePaRAMchannelrecordtopointtothereloadrecord.ThiscompletesthechannelparametersetfortheXEVT1event.Whenthelastwordintheframeistransmittedandalinkoccurs,thereloadparametersetiscopiedtothechannelparameterset.Torepeatthesametransfer,thereloadedparametersetshouldbeidenticaltotheinitialset.Therefore,thesecondlineabovereplacestheNULLforLINKinthereloadparametersettoitsownaddress,thatis,theaddressofthatreloadparameterset.Thismakesthereloadparametersetthesameasthechannelparameterset.Program2.7ProgramforGeneratingSineWavesUsingtheEDMA#include#include#include#include#include#include#include#definesampling_rate16000#defineSZ_TABLE512#definef_left1000.#definef_right2000.#definescale15000.#definepi3.141592653589inttable[512];/*CodecConfigurationSettingsSeedsk6713_aic23.handtheTLV320AIC23StereoAudioCODECDataManualforadetaileddescriptionofthebitsineachofthe10AIC23controlregistersinthefollowingconfigurationstructure.*/DSK6713_AIC23_Configconfig={x0017,/*0DSK6713_AIC23_LEFTINVOLLeftlineinputchannelvolume*/x0017,/*1DSK6713_AIC23_RIGHTINVOLRightlineinputchannelvolume*/x00d8,/*2DSK6713_AIC23_LEFTHPVOL 64LearningtoUsetheHardwareandSoftwareToolsLeftchannelheadphonevolume*/x00d8,/*3DSK6713_AIC23_RIGHTHPVOLRightchannelheadphonevolume*/x0011,/*4DSK6713_AIC23_ANAPATHAnalogaudiopathcontrol*/x0000,/*5DSK6713_AIC23_DIGPATHDigitalaudiopathcontrol*/x0000,/*6DSK6713_AIC23_POWERDOWNPowerdowncontrol*/x0043,/*7DSK6713_AIC23_DIGIFDigitalaudiointerfaceformat*/x0081,/*8DSK6713_AIC23_SAMPLERATESampleratecontrol(48kHz)*/x0001/*9DSK6713_AIC23_DIGACTDigitalinterfaceactivation*/};EDMA_HandlehEdmaXmt;//EDMAchannelhandlesEDMA_HandlehEdmaReloadXmt;Int16gXmtChan;//TCCcode(seeinitEDMA())/*TransmitsideEDMAconfiguration*/EDMA_ConfiggEdmaConfigXmt={EDMA_FMKS(OPT,PRI,HIGH)|//PriorityEDMA_FMKS(OPT,ESIZE,32BIT)|//ElementsizeEDMA_FMKS(OPT,2DS,NO)|//1dimensionalsourceEDMA_FMKS(OPT,SUM,INC)|//SrcupdatemodeEDMA_FMKS(OPT,2DD,NO)|//1dimensionaldestEDMA_FMKS(OPT,DUM,NONE)|//DestupdatemodeEDMA_FMKS(OPT,TCINT,NO)|//NoEDMAinterruptEDMA_FMKS(OPT,TCC,OF(0))|//Trans.compl.codeEDMA_FMKS(OPT,LINK,YES)|//EnablelinkingEDMA_FMKS(OPT,FS,NO),//Useframesync?(Uint32)table,//SrcaddressEDMA_FMK(CNT,FRMCNT,NULL)|//FramecountEDMA_FMK(CNT,ELECNT,SZ_TABLE),//ElementcntEDMA_FMKS(DST,DST,OF(0)),//DestaddressEDMA_FMKS(IDX,FRMIDX,DEFAULT)|//FrameindexEDMA_FMKS(IDX,ELEIDX,DEFAULT),//ElementindexEDMA_FMK(RLD,ELERLD,NULL)|//Reloadelement 2.6GeneratingaSineWavewiththeEDMAandaTable65EDMA_FMK(RLD,LINK,NULL)//Reloadlink};/*FunctionPrototypes*/voidinitEdma(void);voidcreate_table(void);voidmain(void){DSK6713_AIC23_CodecHandlehCodec;intr_reset();/*Initializeinterruptsystem*//*dsk6713_init()mustbecalledbeforeotherBSLfunctions*/DSK6713_init();/*IntheBSLlibrary*//*Startthecodec.McBSP1uses32-bitwords,1phase,1wordframe*/hCodec=DSK6713_AIC23_openCodec(0,&config);/*Changethesamplingrateto16kHz*/DSK6713_AIC23_setFreq(hCodec,DSK6713_AIC23_FREQ_16KHZ);create_table();/*Youmustwritethisfunction.*/initEdma();/*InitializetheEDMAcontroller(Seebelow)*/while(1);/*infiniteloop*/}/*endofmain()*//**************************************************//*Createatablewhereupper16-bitsaresamples*//*ofasinewavewithfrequencyf_left,andthe*//*lower16bitsaresamplesofasinewavewith*//*frequencyf_right.*//**************************************************/voidcreate_table(void){PUTYOURCODETOGENERATETHESINETABLEHERE.}/*************************************************//*initEdma()-InitializetheEDMAcontroller.*//*Uselinkedtransferstoautomaticallyrestart*//*atbeginningofsinetable.*//*************************************************/voidinitEdma(void) 66LearningtoUsetheHardwareandSoftwareTools{/*Configuretransmitchannel*//*GethEdmaXmthandle,SetchanneleventtoXEVT1*/hEdmaXmt=EDMA_open(EDMA_CHA_XEVT1,EDMA_OPEN_RESET);/*Gethandleforreloadtable.Thisfunctionreservesspacefora6-wordlinkparametersetinthePaRAM.The"-1"argumenttellsthefunctiontochooseanunusedset.*/hEdmaReloadXmt=EDMA_allocTable(-1);/*GettheaddressofDXRforMcBSP1andputitinthechannelparameterconfigurationstructure.*/gEdmaConfigXmt.dst=MCBSP_getXmtAddr(DSK6713_AIC23_DATAHANDLE);/*ThenconfiguretheXmttable.(LINKissettoNULLfromstructuregEdmaConfigXmt)*/EDMA_config(hEdmaXmt,&gEdmaConfigXmt);/*ConfiguretheXmtreloadtabletobethesameastheXmttable(LinkissettoNULLfromstructuregEdmaConfigXmt)*/EDMA_config(hEdmaReloadXmt,&gEdmaConfigXmt);/*Linkbacktotablestart*//*SetLINKinchannelparametersettopointtothereloadparameterset*/EDMA_link(hEdmaXmt,hEdmaReloadXmt);/*SetLINKinthereloadparametersettopointtothereloadparameterset*/EDMA_link(hEdmaReloadXmt,hEdmaReloadXmt);/*EnableEDMAchannel*/EDMA_enableChannel(hEdmaXmt);/*DoadummywritetogeneratethefirstMcBSPtransmitevent*/MCBSP_write(DSK6713_AIC23_DATAHANDLE,0);} Chapter3DigitalFiltersThemajorgoalofthischapteristolearnhowtoimplementdiscrete-timefiltersusingaDSPandininreal-time.Discrete-timefiltersareoftencalleddigitalfilters.ThetheoryisusuallypresentedinatypicalrequiredElectricalEngineeringundergraduatecourseonsignalsandsystemsandaSeniorelectivecourseondigitalsignalprocessing.HavingtowriteaDSPprogramandgettingeverydetailcorrect,andseeingfiltersworkwithlivesignalsleadstoadeeperunderstandingofdigitalfiltering.Intheprocess,youwilllearnmoreabouttheTMS320C6713DSPandtheTMS320C6713DSK.3.1Discrete-TimeConvolutionandFrequencyResponsesTheoutputy[n]ofalinear,time-invariant,discrete-timesystem(LTI)canbecomputedbyconvolvingitsinputx[n]withitsunitpulseresponseh[n].Theequationforthisdiscrete-timeconvolutionis∞∞y[n]=x[k]h[n−k]=h[k]x[n−k](3.1)k=−∞k=−∞Thez-transformofthediscrete-timeconvolutionoftwosignalsistheproductofthetwotransforms,thatis,∞−nY(z)=y[n]z=X(z)H(z)(3.2)n=−∞where∞∞−n−nH(z)=h[n]zandX(z)=x[n]z(3.3)n=−∞n=−∞TheresponseofanLTIsystemtoasinusoidafterthetransientshavebecomenegligibleiscalleditssinusoidalsteady-stateresponse.Todeterminethisresponse,lettheinputbethesampledcomplexsinusoidjωnTx[n]=Ce67 68DigitalFiltersAccordingto(3.1),theoutputis∞∞jω(n−k)TjωnT−jωkTy[n]=h[k]Ce=Ceh[k]e=x[n]H(z)|z=ejωT(3.4)k=−∞k=−∞Thus,theoutputisasinusoidatthesamefrequencyastheinputbutwithitsamplitudescaledbythecomplexnumber∗H(ω)=H(z)|z=ejωT(3.5)ThefunctionH∗(ω)iscalledthefrequencyresponseofthesystem.ThefunctionA(ω)=|H∗(ω)|iscalledtheamplituderesponseofthesystemandtheangleθ(ω)=argH∗(ω)iscalleditsphaseresponse.Noticethatalloftheseresponsesareperiodicasfunctionsofωwithperiodequaltothesamplingrateωs=2π/T.Inpolarform∗jθ(ω)H(ω)=A(ω)e(3.6)so,accordingto(3.4),theoutputcanbeexpressedasj[ωnT+θ(ω)]y[n]=CA(ω)e(3.7)WhentheinputistherealsinusoidjφjωnTx[n]=Ccos(ωnT+φ)=e{Cee}theoutputis∗jφjωnTy[n]=e{H(ω)Cee}=CA(ω)cos[ωnT+θ(ω)+φ]Inotherwords,thesystemscalesthemagnitudeofthesinusoidalinputbytheamplituderesponseandshiftsitsphasebythephaseresponse.Thisisthebasisfordigitalfiltering.3.2FiniteDurationImpulseResponse(FIR)Filters3.2.1BlockDiagramforMostCommonRealizationIftheunitpulseresponseisidenticallyzerooutsidethesetofintegers{0,1,···,N−1},theconvolution(3.1)becomesN−1ny[n]=h[k]x[n−k]=x[k]h[n−k](3.8)k=0k=n−N+1AfilterofthistypeiscalledanN-tapfinitedurationimpulseresponse(FIR)filter,non-recursivefilter,transversalfilter,ormovingaveragefilter.AblockdiagramforthemostcommonmethodofimplementingFIRfiltersisshowninFig.3.1onpage69.Itconsistsofadelaylinerepresentedbythechainofblockslabeledz−1andasetoftapsintothedelaylinewithweightsequaltotheunitpulseresponsesamples. 3.2FiniteDurationImpulseResponse(FIR)Filters69x[n]h[0]y[n]+z−1h[1]+z−1h[2]+h[N−2]+z−1h[N−1]Figure3.1:Type1DirectFormRealizationTheblockdiagramofanFIRfiltershowninFig.3.1couldrepresentthephysicallayoutofahardwareimplementationorjustthestructureofasoftwarealgorithm.Inasoftwareimplementation,thedelaylinewouldjustbeanarrayinmemory.Enteringanewsampleintoanarraybyshiftingtheentirearrayisinefficient.Intheexercisesdescribedbelow,youwilllearnhowtoimplementthe“shiftregister”byformingacirculararrayorbufferinCandalsobyusingthehardwarecircularaddressingcapabilitiesoftheTMS320C6xDSP’s.3.2.2TwoMethodsforFindingtheFilterCoefficientstoAchieveaDesiredFrequencyResponseTwoprogramsfordesigningdigitalfiltersareincludedinthedirectoryC:DIGFIL.BothmethodsdesignfilterswithexactlylinearphasewhichisareasonFIRfiltersaresometimespreferredoverIIRfilters.Historically,thefirstmethodfordesigningdigitalfilterswastheFourierseriesandwin-dowfunctionmethod.See[II.C.17,Chapter8]forthetheory.Theprogramwindow.exeimplementsthismethod.ItwastakenfromtheIEEEPressbook,ProgramsforDigitalSignalProcessing[II.C.7]andmodifiedtomakeitmoreuserfriendly.Theprogrampresentsaselectionofsevendifferentwindowtypes.TheHammingwindow(3)andKaiserwindow(6)aretheonesyouwillmostlikelyfindbest.Sixdifferentfiltertypesareavailable:(1)lowpass,(2)highpass,(3)bandpass,(4)bandstop,(5)bandpassHilberttransform,and(6)bandpassdifferentiator.Tousethisprogram,firstcopyittoyourworkingdirectoryand 70DigitalFiltersthentypewindow.Asanexampleofhowtousetheprogram,supposethesamplingrateis8kHz,anda21tapbandpassfilterwithalowercutofffrequencyof1kHzandanuppercutofffrequencyof3kHzisdesiredusingtheHammingwindow.Theprogramscreenoutputandtypicalresponsesareshownbelow.Thetextwrittenbytheprogramisincapitallettersandtheuserresponsesareshowninlowercaselettersbuttheycanbeenteredaseithercapitalorlowercaseletters.Thelowercasefunctionsafterwindowtypes3,4,and5aredisplayedbytheprogram.ENTERNAMEOFLISTINGFILE:junk.lstENTERFILENAMEFORCOEFFICIENTS:junk.cofENTERSAMPLINGFREQUENCYINHZ:8000WINDOWTYPES1RECTANGULARWINDOW2TRIANGULARWINDOW3HAMMINGWINDOW0.54+0.46cos(theta)4GENERALIZEDHAMMINGWINDOWalpha+(1-alpha)cos(theta)5HANNINGWINDOW0.5+0.5cos(theta)6KAISER(I0-SINH)WINDOW7CHEBYSHEVWINDOWFILTERTYPES1LOWPASSFILTER2HIGHPASSFILTER3BANDPASSFILTER4BANDSTOPFILTER5BANDPASSHILBERTTRANSFORM6BANDPASSDIFFERENTIATORENTERFILTERLENGTH,WINDOWTYPE,FILTERTYPE:21,3,3SPECIFYLOWER,UPPERCUTOFFINHZ:1000,3000CREATE(FREQUENCY,RESPONSE)FILE(YORN)?yENTERFILENAME:junk.datLINEAR(L)ORDB(D)SCALE?:dTheLISTINGFILEiswherethenumberoftaps,filtertype,windowtype,samplingfrequency,andfiltercoefficientsarewritten.TheFILENAMEFORCOEFFICIENTShasoneentryperline.Thefirstlineisthenumberofcoefficients.Theremaininglinesarethecoefficientsinorderofincreasingindexandinfloatingpointformat.Thisfileisusefulforusingthecoefficientsinanotherprogram.The(FREQ,RESPONSE)fileisalistingoftheamplituderesponseofthefilteronalinearordBscale.Eachlinecontainsapairofnumbersconsistingofthefrequencyandcorrespondingamplituderesponse.Thefrequencyincrementisautomaticallyselectedtoshowtheripplesintheamplituderesponse.Thesecondprogramfordesigningdigitalfiltersisremez87.exe.ItisamodifiedversionoftheprogramintheIEEEbook,ProgramsforDigitalSignalProcessing[II.C.7].Theprogram 3.2FiniteDurationImpulseResponse(FIR)Filters71wasdevelopedbyJ.McClellanandT.ParkswhowereatRiceUniversityatthetime.ItusestheRemezexchangealgorithmtodesignfiltersthatareoptimumintheChebyshevsense,thatis,themaximumabsoluteerrorisminimizedandcausestheerrortobeequalripple.Theprogramcandesign(1)multiplepassband/stopbandfilters,(2)differentiators,and(3)Hilberttransformfilters.Useofremez87.exewillbedemonstratedbyanexample.Supposethesamplingrateis8kHzanda21tapbandpassfilterwithapassbandextendingfrom1000to3000Hzisdesired.Usingtheconventionsofthisprogram,threebandsmustbespecified.Theyare:(1)alowerstopband,(2)thepassband,and(3)anupperstopband.Letthelowerstopbandedgesextendfrom0to500Hz,thepassbandedgesextendfrom1000to3000Hz,andtheupperstopbandedgesextendfrom3500to4000Hz.Valuesmustbespecifiedfortheamplitudeineachofthebands.Letthevaluesinthetwostopbandsbe0andthevalueinthepassbandbe1.Also,weightsforeachbandmustbespecified.Theweightvaluesscaletheerrorineachband.Sincethealgorithmgeneratesanequalrippleweightederror,largerweightsresultinbandswithsmallerunweightedripple.Forthisexampleletthebandsbeequallyweightedwiththevalue1.Theprogramremez87usesavariableGRIDDENSITYtodeterminethefrequencyincre-mentforcomputingthefrequencyresponseerrorwithlargernumberscorrespondingtocloserspacedfrequencies.Valuesintherangeof16to32seemtoworkwellwithlittledifferenceobservedintheresults.Thesmallernumberrequireslesscomputationandusessmallerarrays.Theprogramcomputesthefrequencyresponseoftheresultingfilterandaskstheusertoenterthelowerandupperfrequencylimitstousefortheresponse.Programscreenpromptsareincapitalletters.Userresponsescanbeineitherupperorlowercase.Thepromptsandresponsesforthisexampleareshownbelow.ENTERLISTINGFILENAME:junk.lstENTERCOEFFICIENTSTORAGEFILENAME:junk.cofLINEARORDBAMPLITUDESCALEFORPLOTS?(LORD):dENTERSAMPLINGFREQUENCY(HZ):8000ENTERSTARTANDSTOPFREQUENCIESINHZFORRESPONSECALCULATION(FSTART,FSTOP):0,4000FILTERTYPESAVAILABLE:1MULTIPLEPASSBAND/STOPBANDFILTER2DIFFERENTIATOR3HILBERTTRANSFORMENTER:FILTERLENGTH,TYPE,NO.OFBANDS,GRIDDENSITY:21,1,3,32ENTERTHEBANDEDGES(FREQUENCIESINHERTZ)0,500,1000,3000,3500,4000SPECIALUSERDEFINEDAMPLITUDERESPONSE(Y/N)?nSPECIALUSERDEFINEDWEIGHTINGFUNCTION(Y/N)?nENTER(SEPARATEDBYCOMMAS):1.VALUEFOREACHBANDFORMULTIPLEPASS/STOPBANDFILTERS 72DigitalFilters2.SLOPESFORDIFFERENTIATOR(GAIN=Ki*f->SLOPE=KiWHEREKi=SLOPEOFi-THBAND,fINHERTZ)3.MAGNITUDEOFDESIREDVALUEFORHILBERTTRANSFORM0,1,0ENTERWEIGHTFOREACHBAND.(FORADIFFERENTIATORTHEWEIGHTFUNCTIONGENERATEDBYTHEPROGRAMFORTHEithBANDISWT(i)/fWHEREWT(i)ISTHEENTEREDBANDWEIGHTANDfISINHERTZ.)1,1,1STARTINGREMEZITERATIONSDEVIATION=.159436E-03...CALCULATINGIMPULSERESPONSECALCULATINGFREQUENCYRESPONSECREATE(FREQ,RESPONSE)FILE(YORN)?yENTERFILENAME:junk.datThefilesrequestedbyremez87areessentiallythesameasforwindow.However,theLISTINGfilecontainsmoreinformation,suchas,thefrequencieswherethepeakerrorsoccur,afrequencyresponselistinginlinearanddBform,andacrudeplotoftheresponseusedinthedayswhenonlylineprinterswithoutgraphicscapabilitieswereavailable.Theprogramremez87asksifyouwantaSPECIALUSERDEFINEDAMPLITUDERESPONSEoraSPECIALUSERDEFINEDWEIGHTINGFUNCTION.Youcanwriteyourownspecialsubroutinesforaspecialdesiredamplituderesponseand/orweightingfunctionandlinkthemintothemainprogram.Nospecialfunctionsareincludedinthisversionoftheprogram.SimilarfilterdesignprogramscanbefoundintheMATLABsignalprocessingpackage.3.3UsingCircularBufferstoImplementFIRFiltersinCForanN-tapFIRfilterwithcoefficientsnonzeroonlyforindicesintheset{0,...,N−1},theconvolutionsum(3.1)becomesN−1y[n]=h[k]x[n−k]=h[0]x[n]+h[1]x[n−1]+···+h[N−1]x[n−N+1](3.9)k=0Noticethattheoldestinputsamplex[n−(N−1)]ismultipliedbytheimpulseresponsesampleh[N−1]withthelargestindexandthenewestsamplex[n]ismultipliedbythe 3.3UsingCircularBufferstoImplementFIRFiltersinC73impulseresponsesampleh[0]withthesmallestindex.ThisequationisshownschematicallyinFigure3.1wheretheNrequiredsignalsamplesareshownstoredinadelayline.Inasoftwareimplementation,thedelaylinerepresentsanarrayinmemory.Enteringthenewestsampleintothe“delayline”byshiftingtheelementsintheentirearrayisinefficientforasoftwareimplementationandabetterapproachistousecircularbuffers.CircularbufferscanbeimplementedinC.Also,the’C6000DSP’shavehardwaresupportthatcanbeaccessedbyassemblyinstructionstoimplementcircularbuffersevenmoreefficiently.TheconceptofacircularbufferisillustratedinFigure3.2.ThefiltercoefficientsarestoredintheNelementarrayh[].Avariable,newest,pointstothelocationintheArrayIndexFilterCoefficientCircularBufferArrayh[]Arrayxcirc[]0h[0]x[n−newest]1h[1]x[n−newest+1].........x[n−1]newestx[n]oldestx[n−N+1]x[n−N+2].........N−2h[N−2]x[n−newest−2]N−1h[N−1]x[n−newest−1]Figure3.2:ContentsofCoefficientArrayandCircularBuffercircularbufferarraythatcontainsthemostrecentlyenteredsample.Whenanewsampleisreceivedattimen,itiswrittenoverthesampleatlocationoldest=newest+1moduloNandnewestisincrementedmoduloN.Inaphysicalimplementationusingashiftregister,theoverwrittensamplewouldbeshiftedoutoftheendoftheshiftregisterwhenthenewoneisshiftedin.NoticethatwhennewestinitiallyhasthevalueN−1,itbecomes0whenincrementedmoduloN.Thus,datasamplesarewrittenintothearrayinacircularfashionmovingdownthearrayoneelementatatimetothebottomatlocationN−1andthenjumpingbackuptothetopofthearrayatlocation0.Finally,thefilteroutputcanbecalculatedasN−1y[n]=h[k]xcirc[mod(newest−k,N)](3.10)k=0wheremod(newest−k,N)istheintegerintheset{0,...,N−1}formedbyaddingmultiplesofNtonewest−kuntilitfallsinthisset.AsegmentofaCprogramforimplementingtheFIRfilterwithacircularbufferisshown 74DigitalFiltersbelow.Program3.1CProgramSegmentforanFIRFilterwithCircularBuffermain(){intx_index=0;floaty,xcirc[N];.../*--------------------------------------------*//*circularlyincrementnewest*/++newest;if(newest==N)newest=0;/*-------------------------------------------*//*Putnewsampleindelayline.*/xcirc[newest]=newsample;/*-------------------------------------------*//*Doconvolutionsum*/y=0;x_index=newestfor(k=0;kx_valueLDW*h_addr++,h_value;h[k]->h_valueMPYSPx_value,h_value,prod;h[k]*x[n-k]ADDSPprod,sum,sum;sumofproducts[Nh]SUBNh,1,Nh;Decrementcountby1tap[Nh]Bloop;Continueuntilalltapscomputed.returnsum;ByCconvention,putsuminA4 84DigitalFilters.endprocProgram3.3PartofAssemblyOptimizerOutputforNoOptimization.asgA15,FP.asgB14,DP.asgB15,SP.global_convolve.sect".text";******************************************************************************;*FUNCTIONNAME:_convolve*;**;*RegsModified:A0,A3,A4,B0,B4,B5,B6*;*RegsUsed:A0,A3,A4,A6,A8,B0,B3,B4,B5,B6*;******************************************************************************_convolve:;.regsum,prod,x_value,h_valueMV.S2XA8,B5;|47|MV.S2XA4,B4;|47|||MV.S1XB4,A0;|47|MV.S2XA6,B0;|47|.line10ADDAW.D2B4,B5,B4;|56|&x[newest].line17SHL.S2B6,0x10,B6;|63|ShiftNblocktoBK0field.line31SET.S2B6,0x8,0x8,B6;|77|Setmodecircular,BK0,B4.line33MVC.S2B6,AMR;|79|loadmodeintoAMRNOP1.line38ZERO.D1A4;|84|.line42loop:.line43LDW.D2T2*B4--,B5;|89|x[newest-k]->x_valueNOP4.line44LDW.D1T1*A0++,A3;|90|h[k]->h_valueNOP4.line45MPYSP.M1XB5,A3,A3;|91|h[k]*x[n-k] 3.6LinearAssemblyCodeandtheAssemblyOptimizer85NOP3.line46ADDSP.L1A3,A4,A4;|92|sumofproductsNOP3.line48[B0]ADD.D20xffffffff,B0,B0;|94|Decrementcountby1tap.line49[B0]B.S1loop;|95|ContinueuntildoneNOP5;BRANCHOCCURS;|95|;**--------------------------------------------------------------------------*.line51.line52B.S2B3;|98|NOP5;BRANCHOCCURS;|98|.endfunc98,000000000h,0Program3.4PartofAssemblyOptimizerOutputfor-o3Optimization.asgA15,FP.asgB14,DP.asgB15,SP.global_convolve.sect‘‘.text’’;******************************************************************************;*FUNCTIONNAME:_convolve*;**;*RegsModified:A0,A1,A2,A3,A4,A5,B0,B4,B5*;*RegsUsed:A0,A1,A2,A3,A4,A5,A6,A8,B0,B3,B4,B5,B6*;******************************************************************************_convolve:;*----------------------------------------------------------------------------*;*SOFTWAREPIPELINEINFORMATION;*;*Looplabel:loop;*KnownMinimumTripCount:8;*KnownMaximumTripCount:500;*KnownMaxTripCountFactor:1;*LoopCarriedDependencyBound():4;*UnpartitionedResourceBound:1;*PartitionedResourceBound(*):1;*ResourcePartition:;*A-sideB-side;*.Lunits1*0;*.Sunits01* 86DigitalFilters;*.Dunits1*1*;*.Munits1*0;*.Xcrosspaths1*0;*.Taddresspaths1*1*;*Longreadpaths00;*Longwritepaths00;*Logicalops(.LS)00(.Lor.Sunit);*Additionops(.LSD)01(.Lor.Sor.Dunit);*Bound(.L.S.LS)1*1*;*Bound(.L.S.D.LS.LSD)1*1*;*;*Searchingforsoftwarepipelinescheduleat...;*ii=4Schedulefoundwith4iterationsinparallel;*done;*;*Epilognotentirelyremoved;*Collapsedepilogstages:2;*;*Prolognotentirelyremoved;*Collapsedprologstages:2;*;*Minimumrequiredmemorypad:0bytes;*;*Forfurtherimprovementonthisloop,tryoption-mh8;*;*Minimumsafetripcount:1;*----------------------------------------------------------------------------*L1:;PIPEDLOOPPROLOGNOP1MV.S2XA6,B0MV.S2XA8,B5MV.S2XA4,B4||MV.S1XB4,A4.line10ADDAW.D2B4,B5,B5;|56|&x[newest].line17SHL.S2B6,0x10,B4;|63|ShiftNblocktoBK0field.line31SET.S2B4,0x8,0x8,B4;|77|Setmodecircular,BK0,B4.line33MVC.S2B4,AMR;|79|loadmodeintoAMR.line38NOP1ZERO.D1A3;|84|.line42 3.6LinearAssemblyCodeandtheAssemblyOptimizer87MV.D2B5,B4||B.S2loop;(P)|95|ContinueuntildoneSUB.L1XB0,1,A1||MVK.S10x2,A2;initprologcollapsepredicate||LDW.D2T2*B4--,B5;(P)|89|x[newest-k]->x_value||LDW.D1T1*A4++,A5;(P)|90|h[k]->h_value;**--------------------------------------------------------------------------*loop:;PIPEDLOOPKERNEL[!A2]ADDSP.L1A0,A3,A3;|92|sumofproducts||MPYSP.M1XB5,A5,A0;@|91|h[k]*x[n-k][B0]ADD.D20xffffffff,B0,B0;@|94|Decrementcountby1tap[A2]SUB.D1A2,1,A2;||[B0]B.S2loop;@|95|Continueuntildone[A1]SUB.S1A1,1,A1;||[A1]LDW.D2T2*B4--,B5;@@@|89|x[newest-k]->x_value||[A1]LDW.D1T1*A4++,A5;@@@|90|h[k]->h_value;**--------------------------------------------------------------------------*L3:;PIPEDLOOPEPILOGADDSP.L1A0,A3,A3;(E)@@@|92|sumofproducts.line52.line51B.S2B3;|98|NOP2MV.D1A3,A4;|97|NOP2;BRANCHOCCURS;|98|.endfunc98,000000000h,0SegmentofaCProgramforCallingthe.asmConvolutionFunctionAsegmentofamainCfunctionforcallingtheassemblyfunctionconvolve()isshowninProgram3.5.SupposewewanttodoanNh=25tapfilter.Thecircularbuffermustbe32wordsorBUFLEN=4×32=128bytes.SinceBUFLEN=2Nblock+1,weneedNblock=6.NoticethattheprogramusestheDATA_ALIGNpragmatoalignthecircularbufferonamultipleoftheblocklength.Also,thecircularmodificationofthebufferinputpointer,newest,isperformedinthemainroutineratherthanintheconvolutionfunctionsinceitoccursonlyonceforeachnewinputsample. 88DigitalFiltersProgram3.5CProgramtoCallconvolve()...#defineNh25/*numberoffiltertaps*/#defineNblock6/*lengthfieldinAMR*/#defineBUF_LEN1<<(Nblock+1)/*circularbuffer*//*sizeinbytes*/#defineBUF_LEN_WORDS1<<(Nblock-1)/*BUF_LEN/4*//***NOTE:x[]mustbeaglobalarray*******/floatx[BUF_LEN_WORDS];/*circularbuffer*//*Aligncirc.buf.onmultipleofblocklength*/#pragmaDATA_ALIGN(x,BUF_LEN)...main(){...Uint32sample_pair=0;intnewest=0;/*Inputpointerforbuffer*/floaty=0;/*filteroutputsample*/intiy=0;/*intoutputforcodec*/intix;/*newinputsample*/floath[Nh]={Putyourfiltercoefficientshereseparatedbycommas};/*Prototypetheconvolutionfunction.*/externfloatconvolve(floatx[],floath[],intN_taps,intN_block,intnewest);/*ConfigureMcBSP’sandcodec*/...for(;;){/*Sendlastfilteroutputtocodec.*/while(!DSK6713_AIC23_write(hCodec,iy));/*NOTE:DSK6713_AIC23_read()returnsunsignedint.*//*Convertreturnedvaluetoan‘‘int’’before*//*shiftingrighttoextendsign.*//*Getanewsamplepair*/while(!DSK6713_AIC23_read(hCodec,&sample_pair));ix=((int)sample_pair)>>16;/*Extendsign.Eliminaterightchannel(16LSB’s).*/newest++;/*Incrementinputpointermodulobuffersize*/if(newest==BUF_LEN_WORDS)newest=0; 3.7InfiniteDurationImpulseResponse(IIR)Filters89x[newest]=ix;/*Putnewsampleinbuffer*/y=convolve(x,h,Nh,Nblock,newest);/*Computenewoutput*/iy=((int)y)<<16;/*Converttointandputinleftchannel*/}3.7InfiniteDurationImpulseResponse(IIR)FiltersAfilterwithanimpulseresponse,h(n),thathasinfinitedurationisknownasanIIRfilter.Whenh(n)isthesumofdampedexponentials,itsz-transform,H(z),whichisalsocalleditstransferfunction,isarationalfunctionofz.Thatis,itistheratiooftwofinitedegreepolynomials.Wewillusearationalfunctionoftheformb+bz−1+bz−2+···+bz−NB(z)012NH(z)==(3.11)1+a1z−1+a2z−2+···+aMz−MA(z)3.7.1RealizationsforIIRFiltersRationaltransferfunctionscanberealizedinmanyways.Threecommonrealizationswillbedescribedbelow.Thefirstrealizationwillbecalledatype0directform.Theratioofthez-transformsofthefilteroutputandinputisY(z)B(z)=H(z)=(3.12)X(z)A(z)CrossmultiplyinggivesMN−k−kY(z)A(z)=X(z)B(z)orY(z)1+akz=X(z)bkz(3.13)k=1k=0TakingallexcepttheY(z)termtotherighthandsideyieldsNM−k−kY(z)=bkX(z)z−akY(z)z(3.14)k=0k=1ThetimedomainequivalentisthedifferenceequationNMy[n]=bkx[n−k]−aky[n−k](3.15)k=0k=1ThisequationshowshowtocomputethecurrentfilteroutputfromthecurrentandNpastinputsandMpastoutputs.Afilterimplementedinthiswayisalsocalledarecursivefiltersincepastoutputsareusedtocalculatethecurrentoutput.Itiscalledadirectformbecausethecoefficientsinthetransferfunctionappeardirectlyinthedifferenceequation. 90DigitalFiltersAnotherrealizationwhichwewillcallatype1directformisbasedonobservingthat(3.12)canberearrangedintothecascadeformX(z)Y(z)=B(z)=V(z)B(z)(3.16)A(z)where1V(z)=X(z)(3.17)A(z)ThisisillustratedinFigure3.3.Theintermediatesignalv[n]canbecomputedusingtheX(z)V(z)Y(z)1B(z)A(z)Figure3.3:FirstStepinFindingType1DirectFormRealizationdirectform0realizationMv[n]=x[n]−akv[n−k](3.18)k=1Then,theoutputcanbecomputedasNy[n]=bkv[n−k](3.19)k=0AblockdiagramfortheseequationsisshowninFigure3.4whereitisassumedthatM=N.Thisformrequireslessstoragethanthetype0directform.Thecontentsofthedelayelements,s1[n],...,sN[n],arestatevariablesforthefilter.Thecurrentoutputandnextstatecanbecomputedfromthecurrentinputandstate.Thefol-lowingsequenceofstepscanbeusedtocomputethefilteroutputsandstates:Step1:Computev[n]Nv[n]=x[n]−aksk[n]k=1Step2:Computetheoutputy[n]Ny[n]=b0v[n]+bksk[n]k=1Step3:UpdatethestatevariablessN[n+1]=sN−1[n]sN−1[n+1]=sN−2[n]...s2[n+1]=s1[n]s1[n+1]=v[n] 3.7InfiniteDurationImpulseResponse(IIR)Filters91x[n]v[n]b0y[n]++z−1−a1s[n]b11++z−1−a2s[n]b22++...−aN−1bN−1++sN−1[n]z−1−aNsN[n]bNFigure3.4:Type1DirectFormRealizationAnotherrealizationcalledthetype2directformcanbefoundbyrearranging(3.13).Forsimplicity,letM=N.ThenN−kY(z)=b0X(z)+[bkX(z)−akY(z)]z(3.20)k=1AblockdiagramforthisrealizationisshowninFigure3.5.Itrequiresessentiallythesamestorageandarithmeticasatype1directform.Thesequenceofstepsforcomputingtheoutputofthetype2directformandupdatingitsstateis:Step1:Computetheoutputy[n]y[n]=b0x[n]+s1[n]Step2:Updatethestatevariabless1[n+1]=b1x[n]−a1y[n]+s2[n]s2[n+1]=b2x[n]−a2y[n]+s3[n]...sN−1[n+1]=bN−1x[n]−aN−1y[n]+sN[n]sN[n+1]=bNx[n]−aNy[n] 92DigitalFiltersx[n]b0y[n]+s1[n]z−1b1−a1+s2[n]z−1b2−a2+sN[n]z−1bN−aN+Figure3.5:Type2DirectFormRealization3.7.2AProgramforDesigningIIRFiltersTheprogram,C:digfiliiriir.exe,designsIIRfiltersbyusingthebilineartransfor-mation[II.C.17,pp.212-219]withaButterworth,Chebyshev,inverseChebyshev,orellipticanalogprototypefilter.Itcandesignlowpass,highpass,bandpass,orbandstopanaloganddigitalfilters.Theformoftheresultingfilterisacascade(product)ofsections,eachwithasecondordernumeratoranddenominatorwiththeleadingconstanttermsnormalizedto1,possiblyafirstordersectionnormalizedinthesameway,andanoverallscalefactor.Thesesecondordersectionsarealsoknowasbiquads.ThesectionscanberealizedbyanyofthethreedirectformsdescribedaboveorotherstructuresthatcanbefoundinDSPbooks.MATLABhasasimilarIIRfilterdesignpackage.Caremustbetakentopreventoverflowsandunderflowswhendigitalfiltersareimple-mentedwithfixedpointDSP’s.ThisproblemissignificantlyreducedwithfloatingpointDSP’s.Sometimestheoverallscalefactorgeneratedbyiir.exeisquitesmallandtomain-tainnumericalaccuracyitshouldbesplitamongthedifferentsections. 3.7InfiniteDurationImpulseResponse(IIR)Filters93Anexampleofhowtouseiir.exeisshownbelow.Theprogrampromptsareshowninuppercaselettersandtheuserresponsesinlowercaselettersornumbers.Inthisexample,abandpassfilterisdesignedbasedonanellipticanalogprototypefilter.Thenominallowerstopbandextendsfrom0to600Hz,thepassbandextendsfrom1000to2000Hz,andtheupperstopbandextendsfrom3000to4000Hz.Thequestionsandanswersareexplainedmorefullyafterthedialog.SAVERESULTSINAFILE(YORN):yENTERLISTINGFILENAME:junk.lstENTER1FORANALOG,2FORDIGITAL:2ENTERSAMPLINGRATEINHZ:8000ENTERNUMBEROFFREQSTODISPLAY:100ENTERSTARTINGFREQUENCYINHZ:0ENTERSTOPPINGFREQUENCYINHZ:4000ENTER1FORBW,2FORCHEBY,3FORICHEBY,4FORELLIPTIC:4ENTER1FORLOWPASS,2FORHP,3FORBP,OR4FORBR:3ENTERF1,F2,F3,F4FORBPORBRFREQS:600,1000,2000,3000ENTERPASSBANDRIPPLEANDSTOPBANDATTENUATIONIN+DB:0.2,40ELLIPTICFILTERORDER=4CREATEFREQ,LINEARGAINFILE(Y,N)?nCREATEFREQ,DBGAINFILE(Y,N)?YENTERFILENAME:junkdb.datCREATEFREQ,PHASEFILE(Y,N)?nCREATEFREQ,DELAYFILE(Y,N)?yENTERFILENAME:JUNKDEL.DATThefirstlineofthedialogasksifyouwanttosavetheresultsininadiskfile.IftheanswerisYory,youarepromptedforthenameofafile.IftheanswerisNorn,theresultsappearonthescreen(usuallytoofasttoberead).Theprogramcomputesthefrequencyresponseofthedesignedfilteratthenumberofpointsspecifiedwhichareequallyspacedovertherangeoffrequenciesselected.Youarethenpromptedforthetypeofanalogprototypefilterdesiredandthefrequencyselectivitytypeofthedigitalfilter.Inthecaseofabandpass(BP)filter,fourcriticalfrequencies,F1externvoidfft();main(){complexX[16];/*Declareinputarray*/inti;/*loopindex*/intM=4;/*log2(16)*/floatpi=3.141592653589;intN=16;/*NumberofFFTpoints*//*-------------------------------------------------------------*//*Initializeinputarray*//*Generatespectrallinesatk=5and11ofheight8.*/for(i=0;i/*Definitionsformathlibrary*/voidfft(complex*X,intM)/*XisanarrayofN=2**Mcomplexpoints.*/{complextemp1;/*temporarystoragecomplexvariable*/complexW;/*e**(-j2pi/N)*/complexU;/*TwiddlefactorW**k*/inti,j,k;/*loopindexes*/intid;/*Indexoflowerpointinbutterfly*/intN=1<0*//*andN-1->N-1underbit-reversal,thesetworeversalsare*//*skipped.*/j=0;for(i=1;i<(N-1);i++){/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*//*Incrementbit-reversedcounterforjbyadding1tomsband*//*propagatingcarriesfromlefttoright.*/k=N2;/*kis1inmsb,0elsewhere*//*--------------------------------------------------------------*//*Propagatecarryfromlefttoright*/while(k<=j)/*Propagatecarryifbitis1*/{j=j-k;/*Bittestedis1,soclearit.*/k=k/2;/*Setup1fornextbittoright.*/}j=j+k;/*Change1st0fromleftto1*//*--------------------------------------------------------------*//*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*//*Swapsamplesatlocationsiandjifnotpreviouslyswapped.*/if(i1.Ingeneral,theAMsignalissaidtobeovermodulatedwhen1+kam(t)isnegativesomeofthetimeandthenm(t)cannotbedeterminedfromtheenvelopewithoutdistortion.Usingthetrigonometricidentityfortheproductofcosines,thetransmittedsignalcanbeexpressedass(t)=Accosωct+0.5Acµcos(ωc+ωm)t+0.5Acµcos(ωc−ωm)t(5.10)Thefirsttermisasinusoidatthecarrierfrequencyandcarriesnomessageinformation.Theothertwotermsarecalledsidebandsandcarrytheinformationinm(t).Thetotalpowerins(t)is222Ps=0.5Ac+0.25Acµ(5.11)whilethepowerinthesidebandsduetothemessageis22Pm=0.25Acµ(5.12)andtheirratioisPµ2mη==(5.13)Ps2+µ2Thisratioincreasesmonotonicallyfrom0to1/3asµincreasesfrom0to1.Sincethecarriercomponentcarriesnomessageinformation,themodulationismostefficientfor100%modulation.5.1.3TheSpectrumofanAMSignalSupposethebasebandmessagem(t)hasaFouriertransformM(ω)andM(ω)=0for|ω|≥W.ThemessageissaidtobealowpassbandlimitedsignalwithcutofffrequencyW.TheFouriertransformofthetransmittedsignal,s(t),isAcAcS(ω)=Acπδ(ω+ωc)+Acπδ(ω−ωc)+kaM(ω+ωc)+kaM(ω−ωc)(5.14)22AnexampleisshowninFigure5.2.Noticethatthemodulationaddsaspectrallineatthecarrierfrequencyandtranslatesthebasebandspectrumsothatitiscenteredaboutthecarrierfrequency.5.2DemodulatinganAMSignalbyEnvelopeDetec-tionCommercialradiosuseasimple,inexpensive,analogcircuitknownasanenvelopedetectortodemodulateAMsignals.Thiscircuitemploysadiode,capacitor,andresistorstofollowthepositivepeaksoftheAMwavewiththeassumptionthatthesignalislessthan100%modulated.Twomethodsforenvelopedetectionthatareparticularlysuitedtodigitalsignal 124AmplitudeModulationM(ω)ω−W0W(a)FourierTransformofBasebandSignalS(ω)AckM(ω+ω)AckM(ω−ω)2ac2acπAcπAcω−ωc−W−ωc−ωc+W0ωc−Wωcωc+W(b)FourierTransformofTransmittedAMSignalFigure5.2:SpectrumofanAMSignalprocessingwillbestudiedinthischapter.Thefirstmethodiscalledsquare-lawdetectionandthesecondmethodusestheHilberttransformtocreatesomethingcalledthecomplexenvelope.Asadesigner,youshouldalwaysevaluatewhethertheanalogenvelopedetectororDSPimplementationisthemostcosteffectivemethodforaccomplishingyourtask.5.2.1Square-LawDemodulationofAMSignalsTheblockdiagramofasquare-lawenvelopedetectorisshowninFigure5.3.Theinputs(t)hastheformoftheAMsignalgivenby(5.1).Itwillbeassumedthatthebasebandmessagem(t)isalowpasssignalwithcutofffrequencyW.Thefirstblockinthedetectorsquarestheinputresultinginthesignal22222222s(t)=Ac[1+kam(t)]cosωct=0.5Ac[1+kam(t)]+0.5Ac[1+kam(t)]cos2ωct(5.15)Thefirsttermontheright-handsideof(5.15)isalowpasssignalexceptthatthecutofffrequencyhasbeenincreasedto2Wbythesquaringoperation.Thesecondtermhasaspectrumcenteredabout±2ωc.Forpositivefrequencies,thisspectrumisconfinedtotheinterval(2ωc−2W,2ωc+2W).Forthesquare-lawdetectortoworkproperly,thespectraforthesetwotermsmustnotoverlap.Thisrequirementismetif2W<2ωc−2Worωc>2W(5.16) 5.2DemodulatinganAMSignalbyEnvelopeDetection125Thesamplingraterequiredtoimplementthesquare-lawdetectorbydigitalsignalpro-cessingtechniqueswillnowbeexamined.WesawinthepreviousparagraphthatthesquaredAMsignalisbandlimitedwithuppercutofffrequency2(ωc+W).Therefore,theinputs(t)mustbesampledatarateofatleast4(ωc+W)topreventaliasingandthelowpassfilterH(ω)mustoperateonsamplesofs2(t)takenatthisrate.TheoutputofthelowpassfilterisbandlimitedintheNyquistbandwithacutoffof2W.Thus,ifH(ω)isimplementedbyanFIRfilterwithtapspacingcorrespondingtotherequiredfastinputsamplingrate,computationcanbereducedbycomputingtheoutputonlyattimesresultinginanoutputsamplingrateofatleast4W.Thistechniqueiscalledskipsamplingordecimation.LowpassFilters(t)y(t)(·)2H(ω)(·)Figure5.3:Square-LawEnvelopeDetectorThefilterH(ω)isanideallowpassfilterwithcutofffrequency2Wsothatitsoutputis0.5A2[1+km(t)]2.Thefinalboxinthedetectortakesasquare-rootresultinginanoutputcasignalthatisproportionaltom(t)withaDCoffset.Inmanycases,thebasebandmessagehasnospectralcomponentsaroundzerofrequencyandtheDCoffsetcanberemovedbyasimplehighpassfilter.5.2.2HilbertTransformsandtheComplexEnvelopeAnothertypeofenvelopedetectorisbasedontheHilberttransform.Thesetransformsareusedextensivelyforanalysisandsignalprocessinginpassbandcommunicationsystems.Letx(t)beasignalwithFouriertransformX(ω).TheHilberttransformofx(t)willbedenotedbyˆx(t)anditsFouriertransformbyXˆ(ω).Inthetime-domain,theHilberttransformisdefinedbytheintegral11∞x(τ)xˆ(t)=x(t)∗=dτ(5.17)πtπ−∞t−τwhere∗representsconvolution.Thus,theHilberttransformofasignalisobtainedbypassingitthroughafilterwiththeimpulseresponse1h(t)=(5.18)πtItcanbeshownthat⎧⎪⎨−jforω>0H(ω)=−jsignω=0forω=0(5.19)⎪⎩jforω<0 126AmplitudeModulationTheHilberttransformfilterisanideal90◦phaseshifter.Therefore,inthefrequencydomainXˆ(ω)=H(ω)X(ω)=(−jsignω)X(ω)(5.20)ThefollowingHilberttransformpairswillbeuseful:Hcosωct=⇒sinωct(5.21)Hsinωct=⇒−cosωct(5.22)Hπcos(ωct+θ)=⇒cosωct+θ−(5.23)2Letm(t)bealowpasssignalwithcutofffrequencyW1andc(t)ahighpasssignalwithlowercutofffrequencyW2>W1.ThenHm(t)c(t)=⇒m(t)ˆc(t)(5.24)Theanalyticsignalorpre-envelopeassociatedwithx(t)isdefinedtobex+(t)=x(t)+jxˆ(t)(5.25)Asanexample,theanalyticsignalassociatedwithx(t)=cosωctisjωctx+(t)=cosωct+jsinωct=e(5.26)Asanotherexample,letm(t)bealowpasssignalwithcutofffrequencyWlessthanthecarrierfrequencyωc.Using(5.24),theanalyticsignalassociatedwithx(t)=m(t)cosωctcanbeshowntobejωctx+(t)=m(t)cosωct+jm(t)sinωct=m(t)e(5.27)Using(5.20),itcanbeshownthattheFouriertransformoftheanalyticsignalis⎧⎪⎨2X(ω)forω>0X+(ω)=2X(ω)u(ω)=X(0)forω=0(5.28)⎪⎩0forω<0Thus,theanalyticsignalhasaone-sidedspectrum,thatis,itsFouriertransformis0fornegativeω.Thecomplexenvelopeofasignalx(t)withrespecttocarrierfrequencyωcisdefinedtobe−jωctx˜(t)=x+(t)e(5.29)andhastheFouriertransformX˜(ω)=X+(ω+ωc)=2X(ω+ωc)u(ω+ωc)(5.30) 5.3LaboratoryExperimentsforAMModulationandDemodulation127Whenthesedefinitionsareused,x(t)isusuallyabandpasssignalandωcisafrequencyinthepassband.Then˜x(t)isalowpasssignal.Asanexample,considertheAMsignals(t)givenby(5.1).Itspre-envelopeisjωcts+(t)=Ac[1+kam(t)]e(5.31)anditscomplexenvelopeiss˜(t)=Ac[1+kam(t)](5.32)Motivatedbytheexampleinthepreviousparagraph,wewilldefinetherealenvelopeofabandpasssignalx(t)tobee(t)=|x˜(t)|(5.33)Anotherequivalentformulafortherealenvelopeis1/222e(t)=|x+(t)|=x(t)+ˆx(t)(5.34)Theblockdiagramofanenvelopedetectorbasedon(5.34)isshowninFigure5.4.Therequiredsamplingrateswillnowbeinvestigatedwhenthedetectorisimplementedbydigitalsignalprocessingtechniques.Iftheinputsignals(t)isastandardAMsignalandthebase-bandmessagem(t)isbandlimitedwithcutofffrequencyW,thens(t)isbandlimitedwithcutofffrequencyW+ωc.Thus,theinputtotheHilberttransformfiltermustbesampledatarateofatleast2(W+ωc)topreventaliasing.Thesquaredenvelopeisbandlimitedwithcutofffrequency2Wsothedecimationtechniquedescribedforthesquare-lawenvelopedetectorlowpassfiltercanbeappliedtotheHilberttransformfilterwhenitisanFIRfil-ter.Also,theboundrelatingωcandWforthesquare-lawdetectorisnotrequiredforthisdetector.sˆ(t)ˆs2(t)−jsignω(·)2s(t)e(t)+(·)(·)2s2(t)Figure5.4:EnvelopeDetectorUsingtheHilbertTransform5.3LaboratoryExperimentsforAMModulationandDemodulationInthefollowingexperiments,youwillusetheTMS320C6713DSKtomodulateanddemodu-lateAMsignals.Thisshouldreinforceyourtheoreticalknowledge.Foreachoftheexercises,initializetheDSKandtheTMS320C6713DSPasinChapters2and3. 128AmplitudeModulation5.3.1Experiment5.1:MakinganAMModulator1.InitializeMcBSP0,McBSP1,andthecodecasinChapters2and3,andusetheleftchannel.2.Readsamplesm(nT)fromthecodecata16kHzrate.Convertthesamplesinto32-bitintegersbyshiftingthemarithmeticallyrightby16bits.Theresultingintegerslieintherange±215.3.AMmodulatetheinputsamplestoformthesequences(nT)=Ac[1+kam(nT)]cos2πfcnTwherethecarrierfrequencyisfc=3kHzandAcisaconstantchosentogiveareasonablesizeoutput.•Converttheinputsamplestofloatingpointnumbersanddothemodulationusingfloatingpointarithmetic.•Sincetheinputsampleslieintherange±215,youmustchoosekorscalethe1inatheAMequationsothatthesignalisnotovermodulated.4.Sends(nT)totheDAC.•ConvertthemodulatedsamplesbackintoappropriatelyscaledintegersandsendthemtotheleftchanneloftheDACusingpolling.ObservingYourModulatorOutput•AttachthesignalgeneratortotheDSKleftchannellineinputandtheleftchannellineoutputtotheoscilloscope.•Setthesignalgeneratortooutputa320Hzsine-wavewithanamplitudethatcreateslessthan100%modulation.CalculateandsketchthespectrumoftheAMsignal.•Synctheoscilloscopetothesignalgeneratorsinewaveandsketchthesignalyouobserveontheoscilloscope.Betteryet,useCodeComposerStudiotocapturetheoutputsamplesandwritethemtoaPCfileasdescribedinthefollowingsubsection.Thenplotthefile.•IncreasetheamplitudeoftheinputsignaluntiltheAMsignalisovermodulatedandplottheresultingwaveform.Whatistheeffectofovermodulationonthespectrum?•ConnectthelineoutputtothespeakersofthePCandvarythemodulatingfrequencyfm.Youshouldbeabletohearthetwosidebandsmoveupanddowninfrequencyasyousweepfm.•IfyoumadethespectrumanalyzerforChapter4,runyourAMmodulatorononeDSKandthespectrumanalyzeronanother.Connectthemodulatoroutputtotheanalyzerinputandobservethespectrumasyouchangetheinputmessagefrequency,fm.Youshouldseethesidebandsmoveasfmischanged. 5.3LaboratoryExperimentsforAMModulationandDemodulation1295.3.2HowtoCaptureDSKOutputSampleswithCCSforPlot-tingTheFileI/OfeatureofCodeComposerStudiocanbeusedtotransferblocksofwordsfromthe’C6713’smemorytoatextfileonthePC.Todothisusingthepollingmethod:•Includealoopinsidetheusualinfinitewhile(1)orfor(;;)loopthatwritestheintegeroutputsamplestoaglobalarray,forexample,output[].•Whenthisinnerloopexits,thearrayisfilledandreadytobecapturedbyCCS.•Immediatelyaftertheinnerloop,putadummystatementthatinvolvesoutput[]foraprobepoint,forexample,dummy=output[0];.Thefollowingcodesegmentillustratesthisapproach.CodeSegmenttoAllowCapture#defineBUFFER_SIZE256intoutput[BUFFER_SIZE];/*MustbeglobalsoCCScanseeit*/main(){/*InitializeDSK,etc.*/while(1){for(i=1;iW133 134DSBSCAmplitudeModulationandCoherentDetectionsothatthetwotermsontheright-handsideof(6.2)donotoverlapasshowninFigure6.2(b).Whentheyoverlapfoldoverissaidtohaveoccurredandperfectdemodulationcannotbeachieved.Whenm(t)isarealsignal,M(−ω)=M(ω)andS(ωc−ω)=S(ωc+ω)for0≤ω≤ωc(6.3)Thisequationshowsthatthecomponentatfrequencyωc+ωcontainsexactlythesameinformationasthecomponentatωc−ωsinceonecanbeuniquelydeterminedfromtheotherbytakingthecomplexconjugate.Theportionofthespectrumfor|ω|>ωciscalledtheuppersidebandandtheportionfor|ω|<ωciscalledthelowersideband.Thefactthatthemodulatedsignalcontainsbothportionsofthespectrumexplainswhytheterm,double-sideband,isused.6.2TheIdealCoherentReceiverTheblockdiagramforanidealcoherentreceiverisshowninFigure6.1.First,thereceivedsignalispassedthroughabandpassfiltercenteredatthecarrierfrequencythatpassestheDSBSCsignalandeliminatesout-of-bandnoise.Theoutputofthereceivebandpassfilteristhenmultipliedbyareplicaofthecarrierwave.Thisreplicaisgeneratedbyadevicecalledthelocaloscillator(LO)inthereceiver.Assumingnonoise,theproductis2s1(t)=2s(t)cosωct=2Acm(t)cosωct=Acm(t)+Acm(t)cos2ωct(6.4)Thedevicethatperformstheproductisoftencalledaproductmodulatororbalancedmixer.LocalOscillator2cosωcts(t)s1(t)m1(t)B(ω)×G(ω)MixerBandpassLowpassReceiveFilterPostDetectionFilterFigure6.1:BlockDiagramofanIdealCoherentReceiverTheFouriertransformoftheproductmodulatoroutputisS1(ω)=AcM(ω)+0.5AcM(ω+2ωc)+0.5AcM(ω−2ωc)(6.5)andisillustratedinFigure6.2(c).Thefirsttermontheright-handsideof(6.4)ispropor-tionaltothedesiredmessage.Thesecondtermhasspectralcomponentscenteredaround 6.2TheIdealCoherentReceiver135−2ωcand2ωc.ThecorrespondingtermscanbeseeninS1(ω).TheundesiredhighfrequencytermsareeliminatedbythefinallowpassfilterwhichhascutofffrequencyW.Thisisoftencalledapostdetectionfilter.M(ω)ω−W0W(a)FourierTransformofBasebandMessageS(ω)0.5AcM(ω+ωc)0.5AcM(ω−ωc)ω−ωc0ωc(b)FourierTransformofDSBSC-AMSignalS1(ω)AcM(ω)0.5AcM(ω+2ωc)0.5AcM(ω−2ωc)ω−2ωc02ωc(c)FourierTransformofMixerOutputFigure6.2:SpectrainaDSBSC-AMCommunicationSystemAnalternativemethodofdemodulationistofirstformthepre-envelopeofthereceivedsignal.Withnoadditivenoise,thisisjωcts+(t)=s(t)+jsˆ(t)=Acm(t)cosωct+jAcm(t)sinωct=Acm(t)e(6.6)Thebasebandmessageisthenrecoveredtowithinascalefactorbyformingthecomplexproduct−jωcts+(t)e=Acm(t)(6.7) 136DSBSCAmplitudeModulationandCoherentDetection6.3TheCostasLoopasaPracticalApproachtoCo-herentDemodulationAreceivermusthaveperfectknowledgeofthecarrierfrequencyandphaseofareceivedDSBSC-AMsignaltoperformexactcoherentdemodulation,andthisisalmostneverthecase.However,theseparameterscanbeestimatedandtrackedveryaccuratelyatthereceiverbydevicescalledphase-lockedloops(PLL’s)sothatnearlyoptimumcoherentdemodulationcanbeachieved.AmodificationofatypeofPLLcalledaCostasloopisshowninFigure6.3.ThisformisparticularlysuitedforDSPimplementationandthesignalsshowninthefigurearediscrete-timesignalswithsamplingperiodT.m1(nT)c(nT)=e{s(nT)e−j(ωcnT+θ2)}1+−jsignω××s(nT)sˆ(nT)c(nT)=m{s(nT)e−j(ωcnT+θ2)}2+e−jφ(nT)=e−j(ωcnT+θ2)q(nT)σ(nT)e−j(·)β1−z−1z−1++αφ(nT)ωcTFigure6.3:Second-OrderCostasLoopDemodulatorToaddsomegenerality,letthereceivedsignalafterithaspassedthroughabandpassreceivefilterhavetheforms(nT)=Acm(nT)cos(ωcnT+θ1)(6.8)whereωcisthenominalcarrierfrequencyandθ1isaconstantorslowlychangingphaseangle.WhenthereisafrequencyoffsetbetweenthenominalandactualcarrierfrequenciesduetoDopplershiftsormisalignmentofthetransmitterandreceiverlocaloscillators,θ1takestheformθ1=∆ωnT+γ(6.9)where∆ωisthefrequencyoffsetandγisaconstantphaseoffset.Thefirststepinthesystemistoformthecomplexenvelopej(ωcnT+θ1)s+(nT)=s(nT)+jsˆ(nT)=Acm(nT)e(6.10) 6.3TheCostasLoopasaPracticalApproachtoCoherentDemodulation137Theparallelsolidanddottedlinesinthefigurerepresentcomplexsignalswiththesolidlinecorrespondingtotherealpartanddottedlinetotheimaginarypart.Thesystemgeneratesanestimateφ(nT)oftheangleofthereceivedsignalthatcanexpressedasφ(nT)=ωcnT+θ2(nT)(6.11)Themethodforgeneratingthisanglewillbeexplainedshortly.Itispassedthroughthecomplexexponentialboxtogivethelocaloscillatorsignale−jφ(nT).Thelocaloscillatorsignalismultipliedbythecomplexenveloperesultinginthesignal−jφ(nT)j[θ1−θ2(nT)]c(nT)=s+(nT)e=Acm(nT)e(6.12)whichisseparatedintoitsrealpartc1(nT)=s(nT)cosφ(nT)+ˆs(nT)sinφ(nT)=Acm(nT)cos[θ1−θ2(nT)](6.13)andimaginarypartc2(nT)=ˆs(nT)cosφ(nT)−s(nT)sinφ(nT)=Acm(nT)sin[θ1−θ2(nT)](6.14)Theloopissaidtobeinlockwhenthephaseerrorθ1−θ2remainssmall.Whenthephaseerrorisexactlyzero,thedemodulatedmessageappearsatthepointlabeledc1(nT)=m1(nT)andc(nT)=0.Alockdetectionstrategyistolowpassfilterc2(nT)anddeclarethatthe22loopisinlockwhenthissignalfallsbelowathresholdforaperiodoftime.Therealandimaginarypartsaremultiplied,resultinginthesignal22q(nT)=c1(nT)c2(nT)=Acm(nT)cos[θ1−θ2(nT)]sin[θ1−θ2(nT)]22=0.5Acm(nT)sin{2[θ1−θ2(nT)]}(6.15)Noticethatwhenθ1andθ2differbylessthan90degrees,q(nT)hasthesamesignasthephaseerrorθ1−θ2,soitindicatesinwhichdirectionthelocalphaseestimateθ2shouldbechangedtoreducethephaseerrortozero.Whentheloopisinlock,thesmallangleapproximation,sinxx,canbeusedtoaccuratelyapproximateq(nT)by22q(nT)Acm(nT)[θ1−θ2(nT)]for|θ1−θ2(nT)| 1(6.16)Thelowerhalfoftheblockdiagramgeneratestheloop’sestimateofthephaseofthereceivedsignalbycomputingφ((n+1)T)=φ(nT)+ωcT+αq(nT)+σ(nT)(6.17)whereσ(nT)=βq(nT)+σ((n−1)T)(6.18)andαandβaresmallpositiveconstantswithβ<α/50,typically.Thebasicphilosophybehindtheseequationsisthatateachnewsamplinginstanttheloop’sphaseestimateis 138DSBSCAmplitudeModulationandCoherentDetectionincrementedbythenominalchangeincarrierphasebetweensamples,ωcT,plusasmallcorrectiontermαq(nT)roughlyproportionaltothephaseerror.Noticethatwhenq(nT)=0foralln,φ(nT)isthelinearrampφ(nT)=ωcnT+φ(0)(6.19)whichhasaslopeequaltothenominalcarrierfrequency.Theaccumulatorblockβ/(1−z−1)isincludedtoallowthelooptotrackacarrierinputphaseθ1(nT)thatisalinearrampwithzerosteady-stateerror.Theinputphasehasthisformwhenthereisafrequencyoffsetbetweenthereceivedandlocalcarrierfrequencies.Thisblockalongwiththerestofthelowerbranchintroducesasecond-orderpoleatz=1intheopenloopgainwhichisequivalenttoadoubleaccumulationinthetime-domain.Itiswellknowninautomaticcontroltheorythataloopwiththedoubleaccumulationcantrackafirst-orderinputpolynomial(linearramp)withzerosteady-stateerrorwhilewithasingleaccumulationitcannot.Theoutputσ(nT)oftheaccumulatorreachesthesteady-statevalue∆ωTwhichisthephasechangebetweensamplescausedbythefrequencyoffset∆ω.TheCostasloopisanonlinearandtime-varyingsystembecauseofthesin()andm2(nT)termsinq(nT).Therefore,itcannotbecharacterizedbyatransferfunction.However,whenm(nT)isastationaryprocessandtheloopisinlock,itcanbeaccuratelyapproximatedbyalinear,time-invariantsystembyusingthesmallangleapproximation(6.16)andreplacingm2(nT)byitsexpectedvalue.Replacingm2(nT)byitsexpectedvaluecanbejustifiedbythefactthattheloopfiltersactaslowpassfiltersonq(nT)resultinginatime-averagedestimateofitsstatisticalmean.Let22k1=AcE{m(nT)}(6.20)andfurtherapproximateq(nT)byq(nT)k1[θ1−θ2(nT)](6.21)TheseapproximateequationscanberepresentedbythelinearizedloopshowninFigure6.4.Thetransferfunctionforthelinearizedloopisk(α+β)1−αz−1z−1Θ2(z)1α+βH(z)==(6.22)Θ1(z)1−[2−k1(α+β)]z−1+(1−k1α)z−2Thefrequencyresponseisobtainedbylettingz=ejωTandhastheshapeofanarrowbandlowpassfilterforsmallαandβ.TheclosedloopgainatzerofrequencyisH(1)=1.6.4ExercisesandExperimentsfortheCostasLoopNowitistimeforyoutodesign,implement,andtestaCostasloopcoherentreceiver.Thecontinuous-timemodulatedinputsignalforyourreceivercanbegeneratedbythesignalgenerator.Thesignalgeneratorshouldbesettogenerateanoutputvoltageoftheforms(t)=Acm(t)cos2πfct(6.23) 6.4ExercisesandExperimentsfortheCostasLoop139θ1(nT)+k1−θ2(nT)β1−z−1z−1++αFigure6.4:LinearizedCostasLoopwhereAc=1m(t)=1+0.4cos2πfmtfc=4000Hzfm=400HzActually,s(t)isanAMsignalwithmodulationindexµ=0.4.However,itcanalsobeconsideredtobeaDSBSC-AMsignalwithm(t)containingaDCvalueandallthetheoryfortheCostasloopstillholds.6.4.1TheoreticalDesignExercisesIntheseexercisesyouwilldotheoreticalcomputationstoselecttheCostasloopparametersforareasonabledesign.Dothefollowingsteps:1.Computek1by(6.20).2.Choosesomesmallvaluesfortheloopfilterconstants,forexample,α=0.01andβ=0.0002.Youwillfindthatβshouldbesmallrelativetoα,perhaps,lessthanα/50,togetatransientresponsewithoutexcessripple.Recursivelycomputetheresponseofthelinearizedlooptoaunitstepinθ1(nT)usingthefollowingformulawhichisbasedon(6.22):θ2(nT)=k1[(α+β)θ1((n−1)T)−αθ1((n−2)T)]+[2−k1(α+β)]θ2((n−1)T)−(1−k1α)θ2((n−2)T)Continuethecomputationsuntilθ2(nT)getsclosetoitsfinalvalueandplottheresult.Repeatthisstepfordifferentvaluesofαandβuntilyoufindapairforwhichthestepresponsesettlestoitsfinalvalueinabout0.2seconds.3.ComputeandplottheclosedloopamplituderesponseA(f)=20log|H(ej2πf/fs)|for10thevaluesofαandβfinallyselectedinthepreviousstep. 140DSBSCAmplitudeModulationandCoherentDetection6.4.2HardwareExperimentsWriteaCprogramfortheTMS320C6713toperformthefollowingsteps.Keepinmindthattheinputsamplesare16-bittwo’scomplementintegersintherange±215sothatonceyouhaveconvertedthemtofloats,youwillhavetoscalethemappropriatelytomatchyourtheoreticaldesign.1.InitializetheDSKasinChapter2.2.ReadsamplesfromtheADCata16kHzsamplingrate.3.DemodulatetheinputsignalwithaCostasloop.RememberthattheVCOphaseangle,φ(nT),essentiallyincreaseslinearlybutcould,possibly,becomenegative.Makesuretoaddorsubtractmultiplesof2πtokeepφ(nT)intherange[0,2π)toeliminateanyoverflowproblems.4.SendthedemodulatedsignalsamplestotheDAC.TotestyourCostasloopdemodulator,dothefollowing:1.ConnectthesignalgeneratortothelineinputandsetittogeneratetheAMsignals(t)definedabove.ConnecttheDACoutputtotheoscilloscopeanddebugyourDSPprogramiftheoutputisnotm(t).2.Onceyourcoherentdemodulatorisworkingproperly,investigateitsperformanceinthepresenceofafrequencyoffset.Firstsetthesignalgeneratorcarrierfrequencytothenominal4kHzvalueandletyourloopachievelock.Thenslowlychangethecarrierfrequencytoaslightlydifferentvalueandseeiftheloopremainslocked.Youmayneedtoincreaseαandβtomaketheloopbandwidthlargeenoughsothattheloopcantrackatthespeedyouturnthefrequencyknob.TheloopshouldbeabletotrackfrequencyoffsetsuptothepointwheretheinputsignalspectrumfallsofftheedgesoftheHilberttransformfilter.UseCodeComposerStudiotowatchσ(nT)inyourDSPprogramandcheckthatithasthecorrectsteady-statevalueforthefrequencyoffsetyouareusing.3.Thelinearizedequationsdescribetheloopbehavioraccuratelywhenitisinlock.Whenthereisalargeinitialfrequencyoffset,thebehaviorisquitedifferent.Experimentallyinvestigatethisbehaviorbysettingthesignalgeneratorcarrierfrequencytoavaluethatdiffersby30Hzormorefromthenominal4kHzvalueandstartingtheCostasloop.Theloopmaytakeamuchlongertimethanyouexpectedtoachievelock.Thisiscalleditspullinbehavior.4.Experimentdemodulatingsignalscorruptedbyadditive,zeromean,Gaussiannoise.Usetheapproachdescribedonpage131ofChapter5.Inparticular,observethebehaviorofthecoherentdemodulatorasthesignal-to-noiseratioisdecreasedandmakearoughestimateoftheSNRatwhichthedemodulatornolongerworks.Ifyourloopwasdesignedproperly,itshouldworkatlowerSNR’sthantheenvelopedetectors. 6.5AdditionalReferences141ConnectthelineoutputtothePC’sspeakersandlistentothedemodulatedsignalastheSNRischanged.Comparethesoundwiththeenvelopedetectornoisyoutputs.5.Ifyouareinterestedindoingmoreandtimepermits,setupanarrayandwritethefirstfewhundredsamplesofq(nT)tothearray.Donotaddnoisetotheinputsamples.ThensendthearraytothePCandplottheresultingsignaltogetaclearerpictureofthelooptransientresponse.Youcanalsodothiswithothersignalsintheloop.6.5AdditionalReferencesFormorecompletepresentationsofDSBSC-AM,seeGibson[II.D.9,Chapter5]andHaykin[II.D.17,Chapter3].ForCostasloopdiscussionsseeGibson[II.D.9,Section8.8],Gitlin,Hayes,andWeinstein[II.D.11,Section6.3],andStiffler[II.D.34,Section8.5].Tomyknowl-edge,themodifiedCostasloopstructureshowninthisexperimentcannotbefoundinothertextbooks. Chapter7Single-SidebandModulationandFrequencyTranslationAMandDSBSC-AMmodulationdonotusethefrequencyspectrumefficiently.Theirspec-tralcomponentsequaldistancesaboveandbelowthecarrierfrequencycontainidenticalinformationbecausetheyarecomplexconjugatesofeachother.Theportionabovethecar-rierfrequencyiscalledtheuppersidebandandtheportionbelowthelowersideband.Inthisexperimentyouwillseehowabasebandmessagecanbetransmittedbyusingonlyoneofthesidebandsand,consequently,halfthebandwidthofAMorDSBSC-AM.Thistypeofmodulationiscalledsingle-sideband(SSB)modulation.Ithasbeenextensivelyusedinmanyradiotransmissionsystemsandinthetelephonenetwork.TranslatingthefrequencyspectrumofasignaliscloselyrelatedtoSSBmodulationandiscommonlyusedatvariouspointsincommunicationsystems.AtechniqueforfrequencytranslationparticularlysuitedtoDSPimplementationswillbedescribedinthisexperiment.NofrequencytranslationexperimentswillbeperformedsinceitisactuallythesameasuppersidebandSSBmodulation.7.1Single-SidebandModulatorsAnobvioustypeofSSBmodulatorisshowninFigure7.1.Asusual,wewillassumethatthebasebandmessagesignalm(t)isbandlimitedwithacutofffrequencyWwhichislessthanthecarrierfrequencyωc.ThefirststageofthismodulatorgeneratestheDSBSC-AMsignala(t)=Acm(t)cosωct(7.1)whichhastheFouriertransformA(ω)=0.5AcM(ω−ωc)+0.5AcM(ω+ωc)(7.2)andiscenteredaroundthecarrierfrequencyωc.TheDSBSC-AMsignalisthenpassedthroughthefilterH(ω)toselectthedesiredside-band.UppersidebandSSBmodulationiscreatedwiththeidealhighpassfilter1for|ω|>ωcHu(ω)=(7.3)0elsewhere143 144Single-SidebandModulationandFrequencyTranslationm(t)a(t)s(t)×H(ω)AccosωctFigure7.1:SSBModulationbyCombiningDSBSC-AMandFilteringandthelowersidebandSSBmodulationbytheideallowpassfilter1for|ω|<ωcH(ω)=(7.4)0elsewhereItwillnowbeshownthatanSSBsignalcanbeexpressedintermsofthebasebandmessagem(t)anditsHilberttransformˆm(t).Thepre-envelopeoftheSSBsignalhasthetransformS+(ω)=2S(ω)u(ω)=2A(ω)H(ω)u(ω)=AcM(ω−ωc)H(ω)(7.5)andthetransformofitscomplexenvelopeisS˜(ω)=S+(ω+ωc)=AcM(ω)H(ω+ωc)(7.6)Nowconsidertheuppersidebandcase.OnsubstitutingHu(ω)forH(ω)in(7.6),itcanbeseenafteralittlethoughtthatS˜(ω)=AcM(ω)u(ω)=0.5AcM(ω)(1+signω)=0.5AcM(ω)[1+j(−jsignω)]=0.5AcM(ω)+j0.5AcMˆ(ω)(7.7)So,thecomplexenvelopeiss˜(t)=0.5Ac[m(t)+jmˆ(t)](7.8)Therefore,theSSBsignalcanbeexpressedasjωcts(t)=e{s˜(t)e}=0.5Acm(t)cosωct−0.5Acmˆ(t)sinωct(7.9)Similarly,inthelowersidebandcase,itfollowsthatthetransformofthecomplexenvelopeisS˜(ω)=AcM(ω)u(−ω)=0.5AcM(ω)(1−signω)=0.5AcM(ω)[1−j(−jsignω)]=0.5AcM(ω)−j0.5AcMˆ(ω)(7.10)Therefore,thecomplexenvelopeiss˜(t)=0.5Ac[m(t)−jmˆ(t)](7.11)ThecorrespondingSSBsignalisjωcts(t)=e{s˜(t)e}=0.5Acm(t)cosωct+0.5Acmˆ(t)sinωct(7.12)Equations(7.9)and(7.12)suggesttheSSBmodulatorstructureshowninFigure7.2.Upperorlowersidebandselectionisaccomplishedbysimplychangingthesignoftheinputtothelowersideoftheoutputadder. 7.2CoherentDemodulationofSSBSignals145×0.5Accosωct+m(t)s(t)LO+−usb−90◦+lsb0.5Acsinωct−jsignω×Figure7.2:ASingle-SidebandModulatorUsingaHilbertTransform7.2CoherentDemodulationofSSBSignalsOneapproachtodemodulatingSSBsignalsistofirstmultiplythereceivedsignalbyalocallygeneratedreplicaofthecarriersignal.Multiplying(7.9)or(7.12)by2cosωctyields2b(t)=Acm(t)cosωct∓Acmˆ(t)sinωctcosωct=0.5Acm(t)+0.5Acm(t)cos2ωct∓0.5Acmˆ(t)sin2ωct(7.13)Thefirsttermontheright-handsideof(7.13)isproportionaltothedesiredmessage.Thesecondandthirdtermshavespectracenteredabout2ωcandcanberemovedbypassingb(t)throughalowpassfilterwithcutofffrequencyW.TheeffectinthefrequencydomainofmultiplyingbycosωctinthetimedomainistoshiftS(ω)totherightandleftbyωcandtakethesum.Thistranslatesthesidebandsaround±ωcdowntobasebandandformsM(ω)whichisthedesiredtermandalsotranslatesthemupto±2ωcwhicharethetermsremovedbythelowpassfilter.AblockdiagramforthisdemodulatorhasthesameformasFigure7.1exceptwiththeinputm(t)replacedbythereceivedsignals(t)andthefilterH(ω)byalowpassfilter.Inpractice,thissystemshouldbeprecededbyabandpassfilterthatpassess(t)andeliminatesout-of-bandnoise.AnotherSSBdemodulatorthatusesaHilberttransformandiswellsuitedtoDSPim-plementationwillnowbedescribed.ThefirststepistotaketheHilberttransformofthereceivedsignals(t)andformthepre-envelope.Using(7.8)and(7.11),thepre-envelopecanbeexpressedasjωctjωcts+(t)=s(t)+jsˆ(t)=˜s(t)e=0.5Ac[m(t)±jmˆ(t)]e(7.14)wheretheplussignisforuppersidebandandtheminussignisforlowersidebandmodulation.Multiplyingthepre-envelopebye−jωctgeneratesthecomplexenvelope−jωcts˜(t)=s+(t)e=0.5Ac[m(t)±jmˆ(t)](7.15) 146Single-SidebandModulationandFrequencyTranslationInthefrequencydomain,thistranslatesthetransformofthepre-envelopedowntobaseband.Takingtherealpartofthiscomplexsignalgives−jωct0.5Acm(t)=e{s+(t)e}=e{[s(t)+jsˆ(t)][cosωct−jsinωct]}=s(t)cosωct+ˆs(t)sinωct(7.16)whichisproportionaltothedesiredmessagesignal.ThisdemodulatorrequirestakingaHilberttransformbutdoesnotrequirefilteringouttermsattwicethecarrierfrequency.Figure7.2isalsoablockdiagramforademodulatorthatimplements(7.16)iftheinputm(t)isreplacedbythereceivedsignals(t),thecosineandsineamplitudesaresetto1,andtheplussignischosenattheoutputadder.Inpractice,thedemodulatorwouldbeprecededbyanbandpassfilterthatpassesthesignalcomponentsandrejectsout-of-bandnoise.Thesetwodemodulatorsassumethatthereceiverhasperfectknowledgeofthereceivedcarrierfrequencyandphase.Unfortunately,thisinformationcannotbederivedbyasystemliketheCostasloopbecausetheSSBsignalisthesumofaninphasecomponentm(t)cosωctandaquadraturecomponentˆm(t)sinωct.Itcanbeshownthatwhenthedemodulator’sfrequencyiscorrectbutthephaseisinerror,thedemodulatedoutputisaphaseshiftedver-sionofthetransmittedmessage.Sincethehumanearisrelativelyinsensitivetophase,thisdoesnotdegradevoiceormusic.However,thephaseoffsetcancauseunacceptabledegrada-tionwhentheshapeofthemessagemustbemaintainedlikeindigitaldatacommunicationsystems.Afrequencyerrorresultsinademodulatedsignalwhichhasallitsspectralcom-ponentsshiftedbythiserror.AstandardapproachtosolvingthisproblemistoaddasmallsinusoidalcomponentcalledapilottonewhosefrequencyisnotintheSSBsignalbandandhasaknownrelationshiptothecarrierfrequency.ThepilottonefrequencyisoftenchosentobethecarrierfrequencywhenthebasebandmessagesignalhasnoDCcomponents.Thereceivercanthengeneratealocalcarrierreferencebyusinganarrowbandwidthbandpassfiltertoselectthepilottoneandpossiblyfollowingthisfilterbyaphase-lockedloop.7.3FrequencyTranslationThespectrumofabandpasssignalmustoftenbetranslatedfromonecenterfrequencytoanotherincommunicationsystems.Onereasonistoplacethesignalspectruminanallocatedchannel.Severalmessagescanbemultiplexedtogetherbyshiftingthemtonon-overlappingadjacentspectralbandsandtransmittingthesumoftheresultingsignals.Thisiscalledfrequencydivisionmultiplexing(FDM).AnotherreasonistocorrectforcarrierfrequencyoffsetscausedbyoscillatorinaccuraciesorDopplershifts.Ofcourse,AM,DSBSC-AM,andSSBmodulatorstranslatesignalspectrafrombasebandtopassbandandthecoherentdemodulatorsdothereverse.AmethodforfrequencytranslationthatiswellsuitedtoDSPapplicationswillnowbedescribed.Lets(t)beabandpasssignalwiththefrequencyω0somewhereinitspassband.Theproblemistotranslatethespectrumsothatω0ismovedtoω1=ω0+∆ω.Thefirststepistoformthepre-envelopes+(t)=s(t)+jsˆ(t)(7.17) 7.4LaboratoryExperiments147ThecorrespondingFouriertransformisS+(ω)=2S(ω)u(ω)(7.18)Thenextstepistomultiplybyacomplexexponentialwithfrequency∆ωtogetj∆ωtr+(t)=s+(t)e=[s(t)+jsˆ(t)][cos∆ωt+jsin∆ωt](7.19)whichhasthetransformR+(ω)=S+(ω−∆ω)(7.20)Thistranslatestheoriginalspectrumtotherightby∆ωandmovesthevalueatω0tothefrequencyω1.Takingtherealpartofr+(t)givesthedesiredtranslatedsignalr(t)=s(t)cos∆ωt−sˆ(t)sin∆ωt(7.21)Therealpartofr+(t)canalsobeexpressedasr(t)=[r+(t)+¯r+(t)]/2(7.22)soitsFouriertransformisR(ω)=[R+(ω)+R¯+(−ω)]/2=S(ω−∆ω)u(ω−∆ω)+S¯(−ω−∆ω)u(−ω−∆ω)(7.23)Figure7.2isalsotheblockdiagramforafrequencytranslatoriftheinputm(t)isreplacedbythebandpasssignals(t),thefrequencyωcisreplacedby∆ω,0.5Acisreplacedby1,andthenegativesignisusedattheoutputadder.BecausefrequencytranslationisfunctionallythesameasuppersidebandSSBmodulationwiththeappropriatecarrierfrequency,notranslationexperimentswillbeperformed.Noticethat(7.21)canbeusedevenwhenthepassbandofthetranslatedsignaloverlapsthatoftheoriginalsignal.Todothisusingrealsignalswouldrequireadoubleconversionprocesswherethesignalisfirstshiftedtoanon-overlappingbandbymultiplyingbycosω3tandselectingtheuppersidebandwithahighpassfilterandthenrepeatingtheprocesstotranslatethespectrumbacktothedesiredfrequency.Thisisgenerallynotasconvenientas(7.21)forDSPapplications.7.4LaboratoryExperimentsInitializetheDSPandcodecasinChapter2forthefollowingSSBexperiments.Onceagain,youwillbeusingasamplingrateoffs=1/T=16kHz.TheDSPwillbeprogrammedtobothgenerateanddemodulateSSBsignalssincethelabdoesnothaveahardwareSSBsignalgenerator. 148Single-SidebandModulationandFrequencyTranslation7.4.1Experiment7.1:MakinganSSBModulatorPerformthefollowingtaskstomakeandtestanSSBmodulator:•InitializetheDSPandcodecfora16kHzsamplingrate.•WriteaprogramtoimplementtheSSBmodulatorshowninFigure7.2.Implementboththeupperandlowersidebandmodulators.Takethemessagesamplesm(nT)fromtheADC.SendthemodulatedsignalsamplestotheDAC.Usethecarrierfrequencyfc=4kHzandanamplitudeActhatscalestheoutputsamplesappropriatelyforthecodec.BesuretomatchthedelayintroducedbyyourHilberttransformfilter.•Attachthesignalgeneratortothelineinputandsetittogeneratea1200Hzsinewave.•DeterminethetheoreticalformulasforthetransmittedSSBsignalsforboththeupperandlowersidebandcaseswiththeinputm(t)=Amcos2π1200t.•Observethesignalsgeneratedbyyourmodulatoronthescopeforbothcasesandcomparethemwiththetheoreticalones.•Varythefrequencyofm(t)from0to4kHzandobserves(t)onthescope.Reportwhathappenstothefrequencyofs(t)forboththeupperandlowersidebandmodulators.•Nextaddapilottonep(t)=Apcos2πfcttotheSSBoutputsignaltoprovideacarrierreferenceforthedemodulatoryouwillmakenext.UseyourjudgmentinchoosingthevalueforAp.7.4.2Experiment7.2:CoherentDemodulationofanSSBSignalInthisexerciseyouwillmakeademodulatorfortheSSBsignalwiththeaddedpilottone.AblockdiagramofonepossibledemodulatorstructureisshowninFigure7.3.Theinputsignals(nT)ispassedthroughahighpassfilterG(ω)thatrejectsthepilottonebutpassestheSSBcomponentintheuppersidebandcase.G(ω)shouldbereplacedbyalowpassfilterthatpassestheSSBsignalandrejectsthepilottoneinthelowersidebandcase.Anotchfiltercouldalsobeusedtoeliminatethepilottone.TheresultingsignalispassedthroughaHilberttransformfiltertoformthepre-envelope.Theportionenclosedbydottedlinesisapairofbandpassfiltersthatextractreplicasofthepilottoneandits−90◦phaseshift.Thetransferfunctionsofthesetwofiltersare(1−r)(1−rz−1cosωT)cB1(z)=(7.24)1−2rz−1cosωcT+r2z−2and(1−r)rz−1sinωTcB2(z)=(7.25)1−2rz−1cosωcT+r2z−2Thedenominatorsofthesefiltershavethefactorization−12−2jωcT−1−jωcT−11−2rzcosωcT+rz=(1−rez)(1−rez)(7.26) 7.4LaboratoryExperiments149HighpassFilters(nT)a(nT)G(ω)−jsignω×e(·)−HilbertTransform1−r1−2rz−1cosωcT+r2z−2c1(nT)1−rz−1cosωTcInphaseCarrier−1c2(nT)rzsinωcTQuadratureCarrierBandpassCarrierRecoveryFiltersFigure7.3:UsingaPilotToneinSSBDemodulationThusthefilterpolesareatz=re±jωcT.Thequantityrisanumberslightlylessthan1andcontrolsthebandwidthofthefilters.Thecloseritisto1,thenarrowerthebandwidth.Thepre-envelopeisthendemodulatedbytherecoveredcomplexcarrierreferenceandtherealpartistakentogivetheoutputsignala(nT).Letthesignalinputtothemultiplierbev(nT)=v1(nT)+jv2(nT).Thena(nT)=e{v(nT)[c1(nT)−jc2(nT)]}=v1(nT)c1(nT)+v2(nT)c2(nT)(7.27)TheoreticalExerciseProvethatatthecarrierfrequencyωcandwhenrisverycloseto1,thetransferfunctionsofthepilottoneextractionfiltersareapproximatelyjωcTB1(e)0.5(7.28)andjωcTB2(e) −0.5j(7.29)Bytrialanderror,chooseavalueofrthatgivesroughlya50Hz3dBbandwidth.Avaluetoocloseto1cancausesignificantcomputationalproblemsbecauseofthehighinternalgainofthefilterwhichresultsinnumericaloverflowsand,possibly,instability.Atoosmallvaluewillmakethebandwidthtoolargeandthefilterwillnotsufficientlyattenuatetheunwantedsignalcomponents. 150Single-SidebandModulationandFrequencyTranslationExperimentalDemodulatorExercisesPerformthefollowingtaskstomakeandtestyourSSBdemodulator:1.WriteaprogramtoimplementthedemodulatordiscussedaboveandshowninFigure7.3.2.NowpipethesamplesgeneratedbyyourmodulatorprogramdirectlytoyourdemodulatorprograminternallywithintheDSP.WritethedemodulatoroutputsamplestotheDACandcheckthatitisworkingproperlybyobservingtheoutputontheoscilloscope.3.Varythemessagefrequencyandcheckthatyourmodulatoranddemodulatorareworkingcorrectly.4.Whenyourdemodulatorisworking,sendthemodulatorsamplestotheleftchannelDACoutput.Connecttheleftchannelanalogoutputtotheleftchannelinput.Demodulatetheleftchannelinputandwritethedemodulatedoutputsamplestotherightchanneloutput.Observethemodulatedsignal(leftchanneloutput)anddemodulatedsignal(rightchanneloutput)onthescope.7.5AdditionalReferencesFormorecompletediscussionsofSSBmodulationandageneralizationknownasvestigialsideband(VSB)modulationseeGibson[II.D.9,Sections5.4and5.5]andHaykin[II.D.17,Sections3.5–3.9]. Chapter8FrequencyModulationFrequencymodulation(FM)wasinventedandcommercializedafteramplitudemodulation.ItsmainadvantageisthatitismoreresistanttoadditivenoisethanAM.Inadditiontocommercialradio,itisusedasacomponentoftelevisionsignals,forsatelliteandmicrowavecommunications,andfordigitaldatatransmission.InthischapterthebasictheoryofFMmodulationanddemodulationwillbepresentedandyouwillimplementtwotypesofdemodulators,thefrequencydiscriminatorandthephase-lockedloop.8.1TheFMSignalandSomeofitsProperties8.1.1DefinitionofInstantaneousFrequencyandtheFMSignalAnFMsignalisgeneratedbyusingthebasebandmessagesignaltochangetheinstantaneousfrequencyofacarriersinusoidratherthanitsamplitude.Theinstantaneousfrequencyofasinusoidcosθ(t)isdefinedtobedω(t)=θ(t)(8.1)dtThisdefinitioncanbejustifiedbyobservingthatwhenθ(t)=ωct,itsderivativeisωcwhichisthefrequencyofcosωct.TheinstantaneousfrequencyofanFMwavewithcarrierfrequencyωcisrelatedtothebasebandmessagem(t)bytheequationω(t)=ωc+kωm(t)(8.2)wherekωisapositiveconstantcalledthefrequencysensitivity.Anoscillatorwhosefrequencyiscontrolledbyitsinputm(t)inthismanneriscalledavoltagecontrolledoscillator.TheangleoftheFMsignal,assumingthevalueis0att=0,istθ(t)=ω(τ)dτ=ωct+θm(t)(8.3)0wheretθm(t)=kωm(τ)dτ(8.4)0151 152FrequencyModulationisthecarrierphasedeviationcausedbym(t).TheFMsignalgeneratedbym(t)iss(t)=Accos[ωct+θm(t)](8.5)Adiscrete-timeapproximationtotheFMwavecanbeobtainedbyreplacingtheintegralbyasum.Theapproximatephaseangleisn−1θ(nT)=ω(kT)T=ωcnT+θm(nT)(8.6)k=0wheren−1θm(nT)=kωTm(kT)(8.7)k=0Thetotalcarrieranglecanbecomputedrecursivelybytheformulaθ(nT)=θ((n−1)T)+ωcT+kωTm((n−1)T)(8.8)TheresultingFMsignalsampleiss(nT)=Accosθ(nT)(8.9)8.1.2SingleToneFMModulationAsimpleformulafortheFouriertransformoftheFMwaveintermsofthetransformofthebasebandmessagelikethatfortheAMwavedoesnotexist.However,inthespecialcaseofthesinusoidalmessagem(t)=Amcosωmtinterestingresultscanbederived.ThisiscalledsingletoneFMmodulation.TheFMwavegeneratedbythismessageiskωAms(t)=Accosωct+sinωmt(8.10)ωmThemodulationindexforthisFMsignalisdefinedaskωAmpeakfrequencydeviationβ==(8.11)ωmmodulatingfrequencyAnexampleforβ=5,fm=100Hz,andfc=1kHzisshowninFigure8.1.Observehowtheoscillationsarefastestwhenm(t)isatitspositivepeakandslowestatitsnegativepeak.Itcanbeshown[II.D.17,p.163]thats(t)hastheseriesexpansion∞s(t)=AcJn(β)cos[(ωc+nωm)t](8.12)n=−∞whereJn(x)isthen-thorderBesselfunctionofthefirstkindandisthevalueofthefollowingintegral:1π−j(nτ−xsinτ)Jn(x)=edτ(8.13)2π−π 8.1TheFMSignalandSomeofitsProperties15310.50m(t)-0.5-10500100015002000TimeinSamples(a)MessageSignalm(t)10.5s(t)0-0.5-10500100015002000TimeinSamples(b)FMSignalform(t)Figure8.1:Exampleforfc=1kHz,fm=100Hz,fs=80kHz,β=5Thesefunctionscanbecomputedbytheseriesn+2m∞1xm2Jn(x)=(−1)(8.14)m!(n+m)!m=0MorepropertiesoftheBesselfunctionscanbefoundin[II.D.17,Appendix4]andplotsofthefirstfewfunctionsareshownonpage164ofthesamereference.Clearly,thespectrumoftheFMsignalismuchmorecomplexthanthatoftheAMsignal.Ithascomponentsattheinfinitesetoffrequencies{ωc+nωm;n=−∞,···,∞}.Plotsofthespectraforvariousβcanbefoundin[II.D.17]aswellasmostotherundergraduatecommunicationsystemstextbooks.ThesinusoidalcomponentatthecarrierfrequencyhasamplitudeJ0(β)andcanactuallybecomezeroforsomeβ. 154FrequencyModulation8.1.3NarrowBandFMModulationAnothercasewhereinterestingresultscanbederivedoccurswhen|θm(t)| 1foralltandiscallednarrowbandFM.Usingtheapproximationsthatcosx1andsinxxfor|x| 1,theFMsignalcanbeapproximatedasfollows:s(t)=Accos[ωct+θm(t)]=Accosωctcosθm(t)−Acsinωctsinθm(t)Accosωct−Acθm(t)sinωct(8.15)orincomplexnotationjωcts(t)Acee[1+jθm(t)](8.16)ThisissimilartotheAMsignalexceptthatthediscretecarriercomponentAcosωtis90◦ccoutofphasewiththesinusoidAcsinωctmultiplyingthephaseangleθm(t).ThespectrumofnarrowbandFMissimilartothatofAM.ThisnarrowbandapproximationissometimesusedinanalogFMmodulatorsalongwithafrequencymultiplier.However,withDSPimplementationsthereislittlereasonnottouse(8.9)togenerateatrueFMsignal.8.1.4TheBandwidthofanFMSignalIngeneral,anexactsimpleformulaforthebandwidthofanFMsignaldoesnotexist.Thebandwidthdependsontheformofthebasebandmessageandthepeakfrequencydeviation.Thefollowingformula,knownasCarson’srule,isoftenusedasanestimateofthebandwidth:BT=2(∆f+fm)Hz(8.17)where∆fisthepeakfrequencydeviationandfmisthemaximumfrequencyatwhichthebasebandmessagehasacomponent.Forexample,commercialFMsignalsuseapeakfrequencydeviationof∆f=75kHzandamaximumbasebandmessagefrequencyoffm=15kHz.Carson’sruleestimatestheFMsignalbandwidthasBT=2(75+15)=180kHzwhichissixtimesthe30kHzbandwidththatwouldberequiredforAMmodulation.8.2FMDemodulationbyaFrequencyDiscriminatorAfrequencydiscriminatorisadevicethatconvertsareceivedFMsignalintoavoltagethatisanestimateoftheinstantaneousfrequencyofitsinputwithoutusingalocaloscillatorand,consequently,inanoncoherentmanner.Typically,theconversionisperformedinanalogdiscriminatorsbyapplyingtheFMsignaltoabandpassfilterwitharelativelywidebandwidthandacenterfrequencythatisshiftedsomewhatfromtheFMcarrierfrequencysothattheinstantaneousfrequencyoftheinputsignalfallsinabandononesideofthefilter’samplitudepeakwheretheresponseismonotonicallyincreasingordecreasing.When 8.2FMDemodulationbyaFrequencyDiscriminator155theinstantaneousfrequencychangesslowlyrelativetothetime-constantsofthefilter,itsoutputisapproximatelyanFMsignalwiththesameinstantaneousfrequencybutwithanenvelopethatvariesaccordingtotheamplituderesponseofthefilterattheinstantaneousfrequency.Thisapproximationiscalledquasi-staticanalysis.TheamplitudevariationsarethendetectedwithanenvelopedetectorliketheonesusedforAMdemodulation.TheblockdiagramofaveryelementarydiscriminatorisshowninFigure8.2.Inamoreadvanceddiscriminator,theinputFMsignals(t)isappliedtoasecondbandpassfilterwithacenterfrequencyoff1=fc+∆sotheinstantaneousfrequencyofs(t)variestotheleftoff1andtheamplitudevariationsofthefilteroutputareintheoppositedirectionofthoseofthefirstfilter.Theenvelopeoftheoutputofthefirstfilterissubtractedfromthatofthesecondfiltertogetthediscriminatoroutput.Iftheamplituderesponseshavethesameshapesrelativetotheircenterfrequenciesandaresymmetricabouttheircenterfrequencies,thediscriminatoroutputwillbezerowhentheinputfrequencyisatthecarrierfrequency,positivewhenitisabove,andnegativewhenbelow.Thefilterscanbedesignedtoresultinadiscriminatoroutputthatisalmostlinearlyrelatedtothedeviationoftheinputfrequencyfromthecarrierfrequencyoveranadequatelywiderange.s(t)BandpassEnvelopem0(t)FilterDetectorf0=fc−∆|G(f)|fcff0Figure8.2:AnElementaryDiscriminator8.2.1AnFMDiscriminatorUsingthePre-EnvelopeRatherthanimplementingafilterandenvelopedetectorasshowninFigure8.2,abetterapproachforDSPapplicationsismakeadiscriminatorbasedonusingthepre-envelope.Whenθm(t)issufficientlysmallandband-limitedsothatcosθm(t)andsinθm(t)areessen-tiallyband-limitedsignalswithcutofffrequencieslessthanωc,itcanbeshownthatthe 156FrequencyModulationpre-envelopeoftheFMsignalisj[ωct+θm(t)]s+(t)=s(t)+jsˆ(t)=Ace(8.18)Theangleofthepre-envelopeisϕ(t)=arctan[ˆs(t)/s(t)]=ωct+θm(t)(8.19)Thederivativeofthephaseisdds(t)sˆ(t)−sˆ(t)s(t)ddtdtϕ(t)==ωc+kωm(t)(8.20)dts2(t)+ˆs2(t)whichisexactlytheinstantaneousfrequency.Thisequationcanbeapproximatedforadiscrete-timeimplementationbyusingFIRfilterstoformthederivativesandHilberttrans-form.NoticethatthedenominatoristhesquaredenvelopeoftheFMsignal.ThebandwidthofthisandotherFMdiscriminatorsmustbeatleastasgreatasthatofthereceivedFMsignal.Thus,therequiredbandwidthisusuallysignificantlygreaterthanthatofthebasebandmessage.Thislimitsthedegreeofnoisereductionthatcanbeachievedbyprecedingthediscriminatorbyabandpassreceivefilter.8.2.2ADiscriminatorUsingtheComplexEnvelopeAdiscriminatorusingthecomplexenvelopealsocanbederived.ThecomplexenvelopefortheFMsignalis−jωctjθm(t)s˜(t)=s+(t)e=sI(t)+jsQ(t)=AceTheangleofthecomplexenvelopeisϕ˜(t)=arctan[sQ(t)/sI(t)]=θm(t)andthederivativeofthephaseisdddsI(t)sQ(t)−sQ(t)sI(t)ϕ˜(t)=dtdt=kωm(t)dts2(t)+s2(t)IQwhichisproportionaltothemessagesignalandhasnoaddedconstantterm.AblockdiagramforimplementingthisdiscriminatorisshowninFigure8.3.Firstthepre-envelopeisformedanddemodulatedtogetthecomplexenvelopewhoserealpartistheinphasecomponentandimaginarypartisthequadraturecomponent.Theinphaseandquadraturecomponentsarebothlowpasssignals.Therefore,thefrequencyresponseofthedifferentiatorsmustapproximatejωoverabandcenteredaroundω=0outtothecut-offfrequencyfortheIandQcomponents.IfthedifferentiatorsareimplementedasFIRfilters,theiramplituderesponseswillautomaticallypassthrough0attheoriginandexcellentdesignscanbeachieved.NoticehowthedelaysthroughtheHilberttransformfilteranddifferentiationfilterarematchedbytakingsignalsoutofthecentertaps.Inthediscriminatorusingthepre-envelope,thedifferentiatorsmustbeapproximatejωoverapassbandcenteredaroundthecarrierfrequencyanditishardertomakethesebandpassdifferentiators. 8.3UsingaPhase-LockedLoopforFMDemodulation157sI(n−K−L)×sI(n−K)s˙Q(n−K−L)z−Lz−Le−jωcnTs(n−K)2L+1TapDifferentiator|s˜(n−K−L)|−2+s(n)m(n)z−Kz−K×d+×−2K+1TapHilbertTransform2L+1TapDifferentiatorsˆ(n−K)z−Lz−LsQ(n−K)s˙I(n−K−L)×sQ(n−K−L)Figure8.3:Discrete-TimeDiscriminatorRealizationUsingtheComplexEnvelope8.3UsingaPhase-LockedLoopforFMDemodulationAdevicecalledaphase-lockedloop(PLL)canbeusedtodemodulateanFMsignalwithbetterperformanceinanoisyenvironmentthanafrequencydiscriminator.Theblockdiagramofadiscrete-timeversionofaPLLisshowninFigure8.4.ItissimilartotheCostasloop.ThePLLinputshowninthefigureisthenoiselessFMsignals(nT)=Accos[ωcnT+θm(nT)](8.21)asdescribedby(8.6)through(8.9).ThisinputispassedthroughaHilberttransformfiltertoformthepre-envelopej[ωcnT+θm(nT)]s+(nT)=s(nT)+jsˆ(nT)=Ace(8.22)Thepre-envelopeismultipliedbytheoutputofthevoltagecontrolledoscillator(VCO)block.ThephaseoftheVCOonesampleintothefutureistheinputtothez−1blockwhichisdescribedbytheequationφ((n+1)T)=φ(nT)+ωcT+kvTy(nT)(8.23)Startingatn=0anditeratingtheequation,itfollowsthatφ(nT)=ωcnT+θ1(nT)(8.24)wheren−1θ1(nT)=θ(0)+kvTy(kT)(8.25)k=0 158FrequencyModulationLoopFilterH(z)βσ(nT)s(nT)=Accos(ωcnT+θm)1−z−1PhaseDetectory(nT)−jsignω×atan2(y,x)α+θm−θ1sˆ(nT)e−jφ(nT)=e−j(ωcnT+θ1)e−j(·)z−1+kvTφ(nT)ωcTVoltageControlledOscillator(VCO)Figure8.4:ADiscrete-TimePhase-LockedLoopTheVCOoutputis−jφ(nT)−j[ωcnT+θ1(nT)]v(nT)=e=e(8.26)Themultiplieroutputisj[θm(nT)−θ1(nT)]p(nT)=Ace(8.27)ThephaseerrorbetweentheangleoftheFMinputsignalandtheVCOoutputistheangleofthemultiplieroutputp(nT)andcanbecomputedasm{p(nT)}θm(nT)−θ1(nT)=arctan(8.28)e{p(nT)}ThisisshowninthefigureasbeingcomputedbytheClibraryfunctionatan2(y,x)whichisafourquadrantarctangentandgivesanglesbetween−πandπ.Theblockconsistingofthemultiplierandarctanfunctioniscalledaphasedetector.Alessaccurate,butcomputationallysimpler,estimateofthephaseerrorwhentheerrorissmallism{p(nT)}=ˆs(nT)cos[ωcnT+θ1(nT)]−s(nT)sin[ωcnT+θ1(nT)]=Acsin[θm(nT)−θ1(nT)]Ac[θm(nT)−θ1(nT)](8.29)Thephasedetectoroutputisappliedtotheloopfilterwhichhasatransferfunctionoftheform1−αz−1βα+βH(z)=α+=(α+β)(8.30)1−z−11−z−1 8.3UsingaPhase-LockedLoopforFMDemodulation159Theaccumulatorportionoftheloopfilterwhichhastheoutputσ(nT)enablesthelooptotrackcarrierfrequencyoffsetswithzeroerror.Itwillbeshownshortlythattheoutputy(nT)oftheloopfilterisanestimateofthetransmittedmessagem(nT).ThePLLisanonlinearsystembecauseofthecharacteristicsofthephasedetector.Ifthediscontinuitiesinthearctangentareignored,thePLLcanberepresentedbythelinearizedmodelshowninFigure8.5.ThetransferfunctionforthelinearizedPLLisY(z)H(z)L(z)==Θ(z)kTz−1mv1+H(z)1−z−1α+β−αz−1−1=(1−z)(8.31)1−[2−(α+β)kvT]z−1+(1−αkvT)z−2LoopFilterθm(nT)y(nT)+H(z)+−θ1(nT)−1kvTz−11−zVCOFigure8.5:LinearizedModelforthePhase-LockedLoopAtlowfrequencies,whichcorrespondstoz1,L(z)canbeapproximatedbyz−1L(z)(8.32)kvTThusz−1Y(z)Θm(z)(8.33)kvTandinthetime-domainθm((n+1)T)−θm(nT)y(nT)(8.34)kvTUsing(8.7)forθmgiveskωy(nT)m(nT)(8.35)kvThislastequationdemonstratesthatthePLLisanFMdemodulatorundertheappropriateconditions.Thefrequencyresponseofthelinearizedloophasthecharacteristicsofaband-limiteddifferentiator.Theloopparametersmustbechosentoprovidealoopbandwidththatis 160FrequencyModulationsufficienttopassthedesiredbasebandmessagesignalbutthebandwidthshouldalsobekeptassmallaspossibletosuppressout-of-bandnoise.ThePLLperformsbetterthanafrequencydiscriminatorwhentheFMsignaliscorruptedbyadditivenoise.ThereasonisthatthebandwidthofthefrequencydiscriminatormustbelargeenoughtopassthemodulatedFMsignalwhilethePLLbandwidthonlyhastobelargeenoughtopassthebasebandmessage.WithwidebandFM,thebandwidthofthemodulatedsignalcanbesignificantlylargerthanthatofthebasebandmessage.Therefore,thePLLcanrejectmoreout-of-bandnoisebecauseofitsnarrowerbandwidth.ThePLLdescribedinthisexperimentisverysimilartotheCostaslooppresentedinChapter6forcoherentdemodulationofDSBSC-AM.However,itshouldbenotedthatthereisasignificantdifferenceintheloopbandwidthsrequiredforthesetwosystems.ThebandwidthofthePLLusedforFMdemodulationmustbelargeenoughtopassthebasebandmessagesignal.Ontheotherhand,theCostasloopisusedtogenerateastablecarrierreferencesignalsoitsbandwidthshouldbeverysmallandjustwideenoughtotrackcarrierdriftsandallowareasonableacquisitiontime.8.4LaboratoryExperimentsforFrequencyModula-tionThefollowingexperimentsshouldgiveyouadeeperunderstandingofthetheoreticalconceptspresentedaboveforFMmodulationanddemodulation.Asusual,initializetheDSKasinChapter2andusea16kHzsamplingratefortheseexperiments..8.4.1Experiment8.1:MeasuringtheSpectrumofanFMSignalTheexperimentsdescribedinthissectionassumethataspectrumanalyzerisnotavailable.IfyourlabhasaspectrumanalyzeroryoumadethespectrumanalyzerforChapter4,youcanuseyourimaginationandexpandonthesuggestionsofthissubsectionandobserveawiderbandofspectrallines.ToinvestigatethespectralpropertiesofFM,performthefollowingtasks:1.SetthesignalgeneratortoFMmodulateanfc=4kHzsinusoidalcarrierwithanfm=150Hzsinewave.LookatthesignalgeneratormanualtoseehowtogetanFMsignalwiththedesiredcarrierfrequency,modulatingfrequencyandwaveform,andfrequencydeviation.2.ConnecttheFMoutputsignaltotheoscilloscopeandobservetheresultingwaveformsasyouvarythefrequencydeviation.3.WriteaprogramfortheDSPtoimplementanIIRbandpassfilterthatpassesthe4kHzcarriercomponentandstronglyattenuatestheotherFMspectralcomponents.SendthefilteroutputtotheDACsoitcanbeobservedontheoscilloscope. 8.4LaboratoryExperimentsforFrequencyModulation1614.Watchtheamplitudeofthe4kHzcarriercomponentonthescopeasthemodulationindexisincreasedfrom0.RememberthatthiscomponentshouldbeproportionaltoJ0(β).5.Increasethemodulationindexslowlyuntilthecarriercomponentbecomeszero.ComparethisexperimentallydeterminedvalueofβwiththetheoreticalvalueforthethefirstzeroofJ0(β).YoucangeneratevaluesoftheBesselfunctionbyusingtheseriesexpansiongivenby(8.14)onpage153orwithMATLAB.6.PlotthetheoreticalpowerspectrumofasinusoidallymodulatedFMsignalwithβ=2,5,and10.8.4.2Experiment8.2:FMDemodulationUsingaFrequencyDis-criminatorWriteaCprogramthatimplementsthefrequencydiscriminatorshowninFigure8.3.Assumethatthecarrierfrequencyis4kHz,thebasebandmessageisband-limitedwithacutofffrequencyof500Hz,anduseasamplingrateof16kHz.Synchronizethesampleprocessingloopwiththetransmitreadyflag(XRDY)ofMcBSP1.ReadsamplesfromtheADC,applythemtoyourdiscriminator,andwritetheoutputsamplestotheDAC.Useremez87.exe,window.exe,orMATLABtodesigntheFIRdifferentiationandHilberttransformfilters.UseenoughtapstoapproximatethedesiredHilberttransformfrequencyresponsewellfrom1200to6800Hz.Tryadifferentiatorbandwidthextendingfrom0to4000Hz.(Besuretomatchthedelaysofyourfiltersinyourimplementation.)Experimentallytestyourdiscriminatorbydoingthefollowing:1.UsethesignalgeneratortocreateasinusoidallymodulatedFMsignalasyoudidfortheFMspectrummeasurementexperiments.Attachthesignalgeneratortothelineinputandobserveyourdemodulatedsignalontheoscilloscopetocheckthattheprogramisworking.2.ModifyyourprogramtoaddGaussiannoisetotheinputsamplesandobservethedis-criminatoroutputasyouincreasethenoisevariance.Doestheperformancedegradegracefullyasthenoisegetslarge?3.AttachthelineoutputtothePC’sspeakersandlistentothenoisydemodulatoroutputasyouvarytheSNR.8.4.3Experiment8.3:UsingaPhase-LockedLoopforFMDe-modulationDesignandimplementaPLLliketheoneshowninFigure8.4todemodulateasinusoidallymodulatedFMsignalwiththesameparametersusedpreviouslyinthediscriminatorexper-iments.Letα=1andchooseβtobeafactorof100ormoresmallerthanα.Performthefollowingtheoreticalexercisestoselectyourloopparameters: 162FrequencyModulation1.Computeandplottheamplituderesponseofthelinearizedloopusing(8.31)fordifferentloopparametersuntilyoufindasetthatgivesareasonableresponse.2.Theoreticallycomputeandplotthetimeresponseofthelinearizedlooptoaunitstepinputforyourselectedsetofparametersbyiteratingadifferenceequationcorrespondingtothetransferfunction.WriteaCprogramfortheDSPtoimplementthePLL.Usea16kHzsamplingrate.RemembertotakeintoaccountthattheADCinputsamplesareintherange±215.TestyourPLLdemodulatorbythefollowingsteps:1.ConnectanFMsignalfromthesignalgeneratortotheDSKlineinputandobservetheDACoutputontheoscilloscope.2.SeeifyourPLLwilltrackcarrierfrequencyoffsetsbychangingthecarrierfrequencyonthesignalgeneratorslightlyandobservingtheoutput.Experimentandseehowlargeanoffsetyourloopwilltrack.Alsoobserveanydifferencesinbehaviorwhenyouchangethecarrierfrequencysmoothlyandslowlyormakestepchanges.3.ModifyyourprogramtoaddGaussiannoisetotheinputsamplesandobservethedemod-ulatedoutputasthenoisevarianceincreases.Howdoesthequalityofthedemodulatedoutputsignalcomparewiththatofthefrequencydiscriminatoratthesamesignal-to-noiseratio,particularlywhenthisratiogetssmall?YoushouldfindthatthePLLworksatalowerSNRthanthediscriminator.4.ConnectthelineoutputtothePC’sspeakerandlistentothedemodulatedoutputasyouvarytheSNR.Howdoesitsoundcomparedtothediscriminatoroutput?8.5AdditionalReferencesAlltheseniorleveltextbooksoncommunicationsystemscontainsectionsonfrequencymod-ulation.Forexample,seeGibson[II.D.9,Chapter6]andHaykin[II.D.17,Sections3.10–3.14].Seethereferencesjustcited,Gitlin[II.D.11,Section6.2],Gardner[II.D.8],andLeeandMesserschmitt[II.D.26,Chapter13]forfurtherdiscussionsofphase-lockedloops.Abriefdiscussionofdiscrete-timePLL’scanbefoundinLeeandMesserschmitt[II.D.26,Sec-tion13.2].Tomyknowledge,thePLLstructuredescribedinthisexperimentusingthepre-envelopecannotbefoundinothertextbooks. Chapter9Pseudo-RandomBinarySequencesandDataScramblersThischapterbeginsaseriesondigitalcommunications.DSPchipshavemadeadramaticimpactonthisfield,initiallyinnarrowbandsystemslikevoice-bandtelephonelinemodemsandcellulartelephones.In1970,aplain9600bpstelephonelinemodemwasthesizeofabigmicrowaveoven;containedmanyanalogchipsforfilters,delaylines,andadaptiveequalizercoefficientscalars;requiredafanbecauseofsignificantpowerconsumption;andcostatleast$15,000.Itwasbasicallyjustadatapumpwithnoextrafeatures.Afewyearslater,mediumscaleintegrated(MSI)digitalchipswereusedtomakeamicro-codeddigitalsignalprocessingunittoreplacetheanalogfunctions,butthemodemswerestilllargeandcostly.TheMSIchipsincludedcascadable4-bitwideALUslicesandanAMDmultiplierchip.AssoonasDSPchipswereintroducedintheearly1980’stheywereusedtofurtherreducethesizeandcostoftelephonelinemodems.Typically,severalDSP’swererequiredtoimplementatransmitterandreceiver.VLSItechnologyrapidlyimprovedandnowastate-of-the-artV.9256kbpsmodemcanbeboughtforlessthan$100andfitsinasmallboxoronasmallcard.Inaddition,thismodemhasmanyfeatureslikedatacompression,errordetectionandcorrection,trelliscodedmodulation,faxmodes,automaticdialing,networkmanagementfunctions,asecondarychannel,andtheabilitytofallbacktomostofthepastpopulartelephonelinemodemstandardsrangingfromspeedsof300bpsupto33,600bps.Itisnowpossibletoconcurrentlyrunatleast12fullduplexV.92modemsinasinglestate-of-the-artDSPcoreandchipswithmultiplecoresarecurrentlybeingsoldcommercially.Thesehigh-endchipsareusedinremoteaccessservers(RAS)byInternetserviceprovidersforvoiceoverIP(VOIP)andmodempools.BecauseoftheflexibilityofthesoftwareapproachtoimplementingsignalprocessingalgorithmswithDSP’s,newtheoreticaldevelopmentswerealmostinstantaneouslyincludedincommercialtelephonelinemodems.Thesetechniqueslaterfoundtheirwayintohigherspeedsystemsthatusegreaterchannelbandwidthslikehighspeeddigitalsubscriberlines(DSL),microwavesystems,satellitecommunications,andHDTV.BroadbanddatatransmissionviaDSL,cable,fiberopticlines,andwirelesssystemsisrapidlymakingvoicebandtelephonelinemodemsobsoletefordial-upaccess.However,theyarestillusedinthelargeFAXmachinemarket.NewgenerationsofDSP’slikeTI’s163 164Pseudo-RandomBinarySequencesandDataScramblersTMS320C6000seriesarebeingusedinthebroadbandsystems.DSP’swithspecialaccel-eratorunitsforFFT’s,turboandlowdensityparitycheckcodes,andencryptionarebeingproduced.TheDSPmanufacturersareworkinghardtobecompetitivewithFPGA’sforhighspeedsignalprocessingtasks.Inordertosimulateandtestdigitalcommunicationsystems,sequencesthatapproximateidealbinaryrandomsequencesarerequired.Inthischapter,youwillseehowtogeneratepseudo-randombinarysequencesusinglinearfeedbackshiftregisters.Thenyouwillseehowasimplevariationofthesecircuitscanbeusedtomakeaselfsynchronizingdigitaldatascrambleranddescrambler.Thesescramblersarerequiredtobreakuplongstringsof1’sor0’stoallowtrackingloopsinthereceivertomaintainlock,ratherthanforsecrecy.Atveryhighdatarates,thesescramblersanddescramblerscanbeimplementedbyverysimpleVLSIcircuits.Atmoderatedatarateslikefoundintelephonelinemodems,theywouldbeimplementedbyafewlinesofsimpleDSPcode.IncorporatingthisfunctionandasmanyothersaspossibleintotheDSPcodeeliminatesextrahardware.Thisimprovesreliabilityandreducesmanufacturingcost.Theabilitytomanufactureproductsatthelowestpossiblecostisextremelyimportanttocompaniesoperatinginthehighlycompetitivecommercialmarket.9.1UsingLinearFeedbackShiftRegisterstoGeneratePseudo-RandomBinarySequencesAnidealbinaryrandomsequenceisaninfinitesequenceofindependent,identicallydis-tributed,randomvariables,eachtakingonthevalues0or1withprobability0.5.Thesesequencesareoftenusedasamodelsforthedatastreamsgeneratedbybinarysources.Ex-cellentapproximationstobinaryrandomsequencescanbegeneratedbylinearfeedbackshiftregisters.Theresultingsequencesarecalledpseudo-random,pseudo-noise(PN),maximallength,ormsequences.Suggestionsforadditionalreferencesareincludedattheendofthischapter.9.1.1TheLinearFeedbackShiftRegisterSequenceGeneratorTheblockdiagramofalinearfeedbackshiftregistersequencegeneratorisshowninFigure9.1.ItiscommonindigitalsequentialcircuitanalysistorepresentadelayelementbythesymbolDratherthanz−1.TheDrepresentsasinglestageofashiftregisterwhenthecircuitisimplementedinhardwareoramemorylocationwhenitisimplementedbysoftware.Alltheaddersperformmodulo2additionwhichisequivalenttotheexclusive-orlogicalfunction.Additionandsubtractionareidenticalinmodulo2arithmetic.Theh’scanbe0or1,with0indicatingnoconnectiontotheadderand1indicatingaconnection.Theinputx(n)isabinarysequencewhichwillbeassumedtobeidentically0inthissection.Thez-transformofabinarysequencewithz−1replacedbyDiscalleditsHuffmantransform.ThecoefficientsofDinthetransformareinterpretedusingmodulo2arithmetic.TheHuffmantransformhasthesamebasicpropertiesasthez-transformsobinarysequences 9.1UsingShiftRegisterstoGeneratePseudo-RandomBinarySequences165+++···h1h2hm−1hmx(n)+DD···Dy(n−1)y(n−2)y(n−m)y(n)Figure9.1:LinearFeedbackShiftRegisterSequenceGeneratorandlinearsequentialcircuitscanbeanalyzedandrepresentedbythesetransformsinthesamewayascontinuous-amplitudediscrete-timesystems.Assumingthattheinputx(n)isidentically0,theoutputofthefeedbackshiftregistersequencegeneratorismy(n)=hky(n−k)(9.1)k=1wherethesummationrepresentsmodulo2additions.Equivalently,anyoutputsequencemustsatisfythehomogeneousdifferenceequationmy(n)+hky(n−k)=0(9.2)k=1Inthischapter,additionofbinaryquantitieswillalwaysbeunderstoodtobeperformedbymodulo2arithmetic.Letthestateoftheshiftregistergeneratorbedefinedtobethem-tuples(n)=[y(n−1),y(n−2),···,y(n−m)]=[s1(n),s2(n),···,sm(n)](9.3)Giventhestateatanytime,thepresentandallfutureoutputscanbeuniquelycomputedfrom(9.1).9.1.2TheConnectionPolynomialandSequencePeriodIftheinitialshiftregisterstateis0,thenthepresentandallfutureoutputsmustbe0andallfuturestatesremainat0.Thisisthetrivialsolutionto(9.2).Itcanbeshownthatiftheinitialstateisnot0,thefuturestatescanneverbecome0.However,them-componentstatevectorcantakeatmost2m−1nonzerovaluessoitmustrepeatatsometime.Thentheoutputandstatesequencewillrepeat,sotheshiftregisterwillgenerateaperiodicoutputsequencewithperiodnogreaterthan2m−1.Thepropertiesofashiftregistersequencearedeterminedbyitsconnectionpolynomialmkh(D)=1+hkD(9.4)k=1 166Pseudo-RandomBinarySequencesandDataScramblersForsimulatingbinaryrandomsequences,shiftregistersequenceswiththemaximumpossibleperiod2m−1areofprimaryinterestandtheseareoftencalledmaximallengthsequences.Itcanbeshownthatashiftregisterwillgenerateamaximallengthsequenceifandonlyifitsconnectionpolynomialisaspecialtypeknownasaprimitivepolynomial.Primitivepolynomialsofalldegreesexistandtablesofprimitivepolynomialsofdegreeupto34canbefoundinPetersonandWeldon[II.E.12].Anecessarybutnotsufficientconditionforapolynomialtobeprimitiveisthatitbeirreducible.Apolynomialwithbinarycoefficientsissaidtobeirreducibleoverthefieldofbinarynumbersifitcannotbefactoredintotheproductofpolynomialswithbinarycoefficientsanddegreesatleast1.Otherwiseitiscalledreducible.Averysimplepartialtestofwhetherapolynomialisirreducibleistocheckwhether0or1areroots.If0isaroot,Dmustbeafactor,andif1isaroot,D+1mustbeafactor.Noticethatif1isarootofh(D),thenh(1)=0andh(D)musthaveanevennumberof1coefficients.Thus,irreduciblepolynomialsoverthebinaryfieldmusthaveanoddnumberof1coefficients.Asanexample,considerthepolynomialh(D)=1+D+D2.Clearly,0and1arenotrootssoDandD+11arenotfactors.Sincetherearenootherfirstdegreefactors,h(D)mustbeirreducible.Ontheotherhand,h(D)=h2(D)doesnothave0or1asrootsbutitisreducible.21Theperiodofashiftregistersequencewithanirreducibleconnectionpolynomialh(D)ofdegreemcanbeshowntobethesmallestnonzerointegerNsuchthatDN−1isdivisiblebyh(D)usingmodulo2arithmeticforthecoefficients.TheperiodNiscalledtheexponentofh(D).Itcanbeshownthath(D)alwaysmustdivideD2m−1−1.However,Nmaybesmallerthan2m−1butmustdivideit.ThepolynomialisprimitivewhenN=2m−1.Forprimitiveconnectionpolynomials,theshiftregisterstategoesthroughall2m−1nonzerovaluesbeforerepeating.Thesituationismorecomplicatedwhentheconnectionpolynomialisreducible.SupposeLh(D)=fk(D)(9.5)k=1whereeachfactorisirreducibleandhasexponentnk.Inthiscase,theshiftregisterwillgeneratesequenceswithdifferentperiodsdependingonitsinitialstate.Eachperiodwillbetheproductofasubsetoftheexponents.9.1.3PropertiesofMaximalLengthSequencesMaximallengthsequenceshaveseveralpropertiesthatmakethemgoodapproximationstoidealbinaryrandomsequenceswhenN=2m−1islarge.DerivationsofthesepropertiescanbefoundinGolomb[II.E.8,pp.43-45].FrequencyofOccurrenceof1’sand0’sThenumberof1’sinoneperiodofamaximallengthsequenceis2m−1andthenumberof0’sis2m−1−1.Thus,eachperiodcontainsonemore1than0.ForlargeN,1’sand0’sessentiallyappearwithequallikelihood. 9.2SelfSynchronizingDataScramblers167FrequencyofRunsof1’sand0’sJustbecause1’sand0’sareessentiallyequallylikelyforlargeNdoesnotmeantheyarerandomlyarrangedintime.Allthe1’scouldbeclumpedtogether.However,thisisnotthecase.Arunofk1’sisdefinedtobeastringstartingwitha0,followedbyk1’s,andendingwitha0.Theprobabilityofthisstringoccurringinanidealbinaryrandomsequenceis2−(k+2).Similarly,arunofk0’sisastringstartingwitha1,followedbyk0’s,andendingwitha1andhasthesameprobability.Inoneperiodofamaximallengthsequence,thereisonerunofm1’s.Thereisnorunofm−11’s.For1≤k≤m−2,thereare2m−k−2runsofk1’s.Thereisnorunofm0’s,onerunofm−10’s,and2m−k−2runsofk0’sfor1≤k≤m−2.CorrelationPropertyIndiscussingcorrelationproperties,itwillbeconvenienttotransformsequencesof0’sand1’sintosequencesof+1’sand−1’s.Lety(n)beasequencewithperiodNthatcanhavethevalue0or1.Thetransformedsequenceis+1ify(n)=0yˇ(n)=(9.6)−1ify(n)=1Theperiodicautocorrelationfunctionisdefinedtobe1N−1R(n)=yˇ(k)ˇy(n+k)(9.7)Nk=0wherethesumisperformedusingordinaryaddition.Formaximallengthsequences,N=2m−1andtheperiodicautocorrelationfunctionis−1fornnotamultipleofNR(n)=N(9.8)1fornamultipleofNForidealbinaryrandomsequences,thestatisticalautocorrelationfunctionis1forn=0and0otherwise.9.2SelfSynchronizingDataScramblers9.2.1TheScramblerLongstringsof1’sor0’scanappearattheoutputofdevicesliketerminalsandcomputerserialportswhentheyareidle.Thesesignalsmustberandomizedbeforebeingappliedtothetransmitterinamodemorelsethesymbolclocktrackerandadaptiveequalizerintheremotereceiverwillnotworkproperly.Therandomizationisfrequentlyaccomplishedbyaselfsynchronizingscrambler.Figure9.1isalsotheblockdiagramforthiskindofscramblerwherex(n)isthescramblerinputandy(n)isitsoutput.Aprimitiveshiftregisterconnection 168Pseudo-RandomBinarySequencesandDataScramblerspolynomialisusuallyused.TwoprimitiveconnectionpolynomialsusedinallrecentITU-Tstandardmodemsare1823h1(D)=1+D+D(9.9)and52323−1h2(D)=1+D+D=Dh1(D)(9.10)Noticethatoneofthesepolynomialsisobtainedfromtheotherbyturningitscoefficientsaroundbackwards.Itcanbeshownthatthisalwaysturnsoneprimitivepolynomialintoanother.With0input,thescramblergeneratesamaximallengthsequenceofperiod223−1iftheinitialstateisnonzero.Thescramblerinputandoutputarerelatedbytheequationmy(n)=x(n)+hky(n−k)(9.11)k=1IntermsofthetransformnotationX(D)Y(D)=(9.12)h(D)whentheinitialstateis0.InITU-Tstandardsthescramblerisdefinedbysayingthattheoutputisgeneratedbydividingtheinputbyh(D).InsomeITU-Tmodemstandards,apseudo-randombinarysequenceisspecifiedtobegeneratedbymakingthescramblerinput1foraninitialtrainingperiod.Letyh(n)beasolutiontothehomogeneousequationformedbylettingtheinputx(n)beidentically0in(9.11).Thisisamaximallengthsequence.Aparticularsolutionto(9.11)forx(n)≡1isyp(n)=1foralln.Thiscanbeseenasfollows.Theconnectionpolynomialhasanoddnumberofnonzerocoefficients.Thusthefeedbacksumontheright-handsideof(9.11)hasanevennumberoftermswhichareall1andaddto0modulo2.Sincex(n)=1,thetotalsumontheright-handsidebecomes1whichmatchestheyp(n)=1ontheleft-handside.Thetotalscrambleroutputisy(n)=yh(n)+yp(n)=yh(n)+1=¯yh(n)(9.13)wheretheover-bardenoteslogicalcomplement.Thus,thescrambleroutputisthecomple-mentofamaximallengthsequencewhentheinputis1.Fromthepreviousparagraph,itcanbeseenthatwhentheinitialstateofthescramblerisall1’sandtheinputis1,theoutputisalways1andthestateremainsall1’s.Thisiscalledalock-upconditionofthescramblerandcaneasilybedetectedandcorrected.Itistheonlyinitialstatethatcauseslock-upwithanall1’sinput.Thissituationisthecomplementofhavinganidentically0inputandstartingintheall0’sstate.Adetailedanalysisofthelock-upphenomenonwithperiodicinputsispresentedinGitlin,Hayes,andWeinstein[II.D.11,pp.454–460]. 9.3TheoreticalandSimulationExercises1699.2.2TheDescramblerAtthereceiver,theinputisrecoveredfromthereceivedsequencey(n)byinverting(9.11).Theresultingdescramblingequationismx(n)=y(n)+hky(n−k)(9.14)k=1orintransformnotationX(D)=Y(D)h(D)(9.15)ThedescramblerisjustanFIRfilterwithm+1tapsthatusesmodulo2arithmetic.AblockdiagramofthedescramblerisshowninFigure9.2.Ify(n)iscorruptedbychannelerrors,thescrambleroutputwillalsocontainerrors.Ifh(D)hasKnonzerocoefficients,asingleisolatederroriny(n)willcauseKoutputerrorsasitpropagatesbythenonzerocoefficients.Therefore,aconnectionpolynomialwiththeleastnumberofnonzerocoefficientsshouldbechosen.x(n)+++···+h1h2hm−1hmDD···Dy(n)y(n−1)y(n−2)y(n−m)Figure9.2:SelfSynchronizingDescrambler9.3TheoreticalandSimulationExercisesforShiftReg-isterSequenceGeneratorsandScramblersThegoalofthischapteristointroducetheshiftregistersequencemethodforgeneratingpseudo-randombinarysequencessotheycanbeusedtosimulatebinarydatasourcesintheremainingchaptersondigitalcommunications.The“experiments”inthissectionarereallytheoreticalandcomputersimulationexercisestoreinforceyourunderstandingofshiftregistersequencegeneratorsandselfsynchronizingscramblers.Theprogramsyouwillwritecanserveasthebasisforonesyoumayneedinfutureexperiments.9.3.1ExercisesforaShiftRegisterSequenceGeneratorwithaPrimitiveConnectionPolynomialItcanbeshownthath(D)=1+D2+D5isaprimitivepolynomial.Performthefollowingexercises: 170Pseudo-RandomBinarySequencesandDataScramblers1.AssumetheinputtothescramblerinFigure9.1is0andthattheinitialstateisnot0.FindtheperiodNofthesequencetheshiftregistergenerates.2.WriteaCprogramtoimplementthescramblerincludinganinputx(n)whichissetto0.Storetheshiftregisterstateas5consecutivebitsinasingleintegervariable.Updatethestatebyor-ingeachnewoutputintotheappropriatebitinthisintegervariableandthenshiftingitwithoneoftheCshiftoperators.YoucanusetheCcompilerforthePCorDSP.3.Setthestateofyourshiftregistertoanonzerovalue.Generateandrecordenoughoutputstoverifyyourcalculationoftheperiod.4.Countthenumberof1’sand0’sinoneperiodofyoursequenceandcheckthattheresultsagreewiththetheory.5.Countthenumberofrunsof1’sand0’sofeachpossiblelengthinoneperiodofyoursequenceandmakeatableshowingtheresults.Makesuretheyagreewiththetheoreticalvalues.6.ComputethescaledperiodicautocorrelationfunctionNR(n)forn=0,1,...,N−1fromyoursequenceandcheckthatitagreeswiththetheoreticalresultgivenby(9.7).7.NowwriteaCprogramtoimplementthedescrambler.Again,storethedescramblershiftregisterasastringof5consecutivebitsinasingleCintegervariable.Lettheinputtothescramblerbex(n)=1.Generateascrambledsequence,putitthroughthedescrambler,andcheckthatthedescrambleroutputisall1’s.Noticethattheinitialstatesofthescrambleranddescramblerdonothavetobeidenticalifaninitialburstoferrorsisacceptableasthedescramblershiftregisterfillsupwithreceivedbits.9.3.2ExercisesforaShiftRegisterSequenceGeneratorwithanIrreduciblebutnotPrimitiveConnectionPolynomialLeth(D)=1+D+D2+D3+D4betheconnectionpolynomialforashiftregistersequencegenerator.Itcanbeshownthath(D)isirreduciblebutnotprimitive.Performthefollowingexercises:1.FindtheperiodNforthissequencegenerator.2.Thefourstageshiftregistercanhave24−1=15nonzerovalues.Lety(n)bethesequencegeneratedbyaparticularnonzerostate.Considery(n)andthesequencesobtainedbydelayingy(n)by1,2,...,N−1samplestobeanequivalenceclassofNsequences.Itcanbeshownthateachmemberoftheequivalenceclasscorrespondstoauniqueshiftregisterinitialstate.Thus,theremustbe(24−1)/Nequivalenceclasses.Findonememberofeachequivalenceclassanditscorrespondinginitialshiftregisterstate. 9.4AdditionalReferences1719.3.3ExercisesforaShiftRegisterSequenceGeneratorwithaReducibleConnectionPolynomialNowlettheconnectionpolynomialfortheshiftregistersequencegeneratorbe2345h(D)=(1+D+D)(1+D+D)=1+D+D(9.16)Performthefollowingexercises:1.Verifythattheproductiscorrect.2.Itcanbeshownthatbothfactorsareirreducible.Findtheexponentsforthetwofactors.3.Findinitialstatesthatresultinsequenceswithperiods3,7,and21.Recordthestatesandcorrespondingsequences.9.4AdditionalReferencesThemostcompletebookonbinarypseudo-randomsequencesisGolomb[II.E.8].OtherreferencesthatdiscussthemareGallager[II.E.7,Chapter6],Gibson[II.D.9,AppendixG],andGitlin,Hayes,andWeinstein[II.D.11,Section6.7].Adetailedanalysisofselfsynchronizingscramblersiscontainedinthislastreference. Chapter10IntroductiontotheRS-232CProtocolandaBit-ErrorRateTesterInthischapteryouwilllearnaboutacommercialinstrumentcalledabit-errorratetesterthatiscommonlyusedtoevaluatetheperformanceofdigitalcommunicationsystems.First,youwillbeintroducedtotheEIARS-232Cinterfaceprotocolwhichisaverycommonmethodforseriallytransmittingdigitaldatabetweennearbydevices.Thenyouwillconnectacommercialbit-errorratetestertotheTMS320C6713DSK,usetheDSPtoaddnoisetotheserialbitstream,runabit-errorratetest,andcomparemeasuredandtheoreticalresults.Seethelastsectionofthischapterforadditionalreferencesonthetheoryofoptimumsignaldetectionandbit-errorprobability.10.1TheEIARS-232CSerialInterfaceProtocolOneofthemostcommonmethodsforseriallytransmittingdigitaldatabetweendeviceshasbeentheEIARS-232Cinterfaceprotocol.EIAstandsforElectronicsIndustriesAssociationandRSforrecommendedstandard.Itistypicallyusedatdataratesbelow38.4kbpsandbetweendevicesthatarelessthan15metersapart.Itwasnotdesignedfordatatransmissionoverlongdistances.Afullimplementationofthestandardusesa25pinDconnectorwiththepinconnectionsshowninTable10.1.Often,onlyasmallsubsetofthesignalsisactuallyusedanda9pinconnectorisemployed.RS-232connectionshavebeenreplacedbyUSBandIEEE1394FirewireserialportsonmanyPC’sandotherdevices.However,manydeviceswithRS-232CconnectorsstillexistandyoucanbuyinexpensiveUSBtoRS-232Cadaptercables.Thischapterintroducestheconceptofbinaryantipodaldatatransmission,andthetheoryandmeasurementofbiterrorscausedbyadditiveGaussiannoise.Theseconceptsdonotdependontheexacttypeofserialtransmissionused.TheRS-232Cmethodprovidesasimpleexampleforexploringthetheory.Inthedatacommunicationsjargon,adataterminaliscalledadataterminalequipmentwhichisabbreviatedbythelettersDTE.ExamplesofaDTEareadumbterminalortheserialportinaPC.Totransmitdataoverlongdistancechannelslikeavoice-bandtelephonechannel,theDTEisconnectedtoamodemwithanRS-232Ccable.Themodemiscalled173 174TheRS-232CProtocolandaBit-ErrorRateTesteradatacommunicationsequipmentwhichisabbreviatedbyDCE.OthertypesofdevicescanalsobeconfiguredtoactasaDCE.TheRS-232Csignalsnominallyhavethevalues12and−12volts.Alogical0iscalledaspaceandisrepresentedbythe12voltlevel.Alogical1iscalledamarkandisrepresentedbythe−12voltlevel.Avoltageabove3voltsisoftenquantizedtoaspaceandavoltagebelow−3voltstoamark.Themostimportantconnectorsignalsaredescribedinthefollowingparagraphs.Pin6iscalledDataSetReady(DSR)andiscontrolledbytheDCE(modem).Ahighvoltage(12v)indicatesthattheDCEhasbeenturnedonandisreadytomakeaconnectionwitharemotemodem.Theterm“remote”isusedtomean“atthefarend”ofthecommunicationschannel.Pin20isnamedDataTerminalReady(DTR)andiscontrolledbytheDTE(dataterminal).Ahighvoltageonpin20indicatestotheDCEthattheDTEisturnedonandreadytoacceptdata.Pin8isnamedDataCarrierDetect(DCD)andiscontrolledbytheDCE.Ahighvoltageonpin8indicatestotheDTEthatthelocalmodemhasmadeaconnectionwiththeremotemodemandisreadytobegintransmittingdata.Theprocessofmakingaconnectionbetweentwomodemsisoftencalledhandshaking.Thesebasiccontrolsignalsmustusuallybehighbeforedatatransmissioncanproceed.Theactualdataissentandreceivedoverpins2and3.Pin2isthetransmitteddata(TD).ThisistheserialbinarydatastreamsentfromtheDTEtotheDCEfortransmissiontotheremoteDCE.Pin3isthereceiveddata(RD)senttothelocalDTEfromthelocalDCEwhichhasbeentransmittedbytheremoteDCEtothelocalDCE.Dataistypicallytransmittedandreceivedindependentlyandsimultaneouslyandthisiscalledfullduplexoperation.Whendataflowsinonedirectionatatimeoverthesamechannel,itiscalledhalfduplexoperation.Pin15isnamedTransmitterClock(TC)andisgeneratedbytheDCE.Inmanycases,themodem(DCE)controlsthedatatransmissionbyclockingbitsoutoftheDTEwithTC.Inafewcases,theDTEcancontrolthedatatransmissionbysupplyingasignalcalledSerialClockTransmitExternal(SCTE)tothemodemonpin24.Pin17isnamedReceiverClock(RC)andisgeneratedbythemodem.ItclocksreceiveddatafromthemodemintotheDTE.TheseclocksarephasedsothatthedataisclockedintotheDTEorDCEinthemiddleofabitwherethevoltagelevelisstable.OnceDTR,DSR,andDCDarehigh,theDTEaskstobegindatatransmissionbyraisingpin4whichisnamedRequesttoSend(RTS).WhentheDCEisreadytoreceivedatafromtheDTEandsendittothetheremoteDCE,theDCEreplysbyraisingpin5whichiscalledCleartoSend(CTS).TheDTEthenbeginssendingthedatatimedbythetransmitterclock.Thesignalsjustdescribedandpin7whichisSignalGround(SG)areusedinmostRS-232Ccables.TheRingIndicator(RI)signalonpin22isoftenincludedwhentheDCEisatelephonelinemodem.Thissignalisgeneratedbythemodemandindicatesthatthemodemhasdetectedaringingsignalfromaremotesiteinthedialnetworkthatistryingtomakeaconnection.ThecommunicationssoftwareintheDTEcanthensendacommandtothemodeminstructingittoconnecttothetelephonelineandanswerthecall.Theremainingsignalsareusedonlyinspecialsituations. 10.1TheEIARS-232CSerialInterfaceProtocol175PINNAMEFUNCTIONSOURCE1FGFrameGround–2TDTransmittedDataDTE3RDReceivedDataDCE4RTSRequesttoSendDTE5CTSCleartoSendDCE6DSRDataSetReadyDCE7SGSignalGround–8DCDDataCarrierDetectDCE9PositiveTestVoltageDCE10NegativeTestVoltageDCE11QMEqualizerModeDCE12SDCDSecondaryDataCarrierDetectDCE13SCTSSecondaryCleartoSendDCE14STDSecondaryTransmittedDataDTENSNewSyncDTE15TCTransmitterClockDCE16SRDSecondaryReceivedDataDCEDCTDividedClock,TransmitterDCE17RCReceiverClockDCE18DCRDividedClock,ReceiverDCE19SRTSSecondaryRequesttoSendDTE20DTRDataTerminalReadyDTE21SQSignalQualityDetectDCE22RIRingIndicatorDCE23DRSDataRateSelectorDCEDataRateSelectorDTE24SCTESerialClockTransmitExternalDTE25BUSYBusyDCETable10.1:RS-232CInterfaceTable 176TheRS-232CProtocolandaBit-ErrorRateTester10.2Bit-ErrorProbabilityforBinarySignalingontheAdditive,White,GaussianNoiseChannelTheperformanceofadigitalcommunicationsystemisoftenevaluatedbymeasuringitsbit-errorprobabilityasafunctionofthechannelsignal-to-noiseratio(SNR)andcomparingtheresultswiththeoreticalvalues.Themeasuredbit-errorprobabilityisoftencalledthebit-errorrate.Thetheoreticalbit-errorprobabilitydependsonthemodulationanddemodulationschemesusedtotransmitthedigitaldataoverananaloglinkaswellasthetypeofnoiseanddistortionthechannelintroduces.Inhighspeeddigitalcommunicationsystemslikesatellitesystems,anexcellentmodelforthechannelisthatitsimplyaddssignalindependent,white,Gaussiannoisetothetransmittedsignal.Thenoiseanddistortionintroducedbyotherkindsofchannelslikevoice-bandtelephonelinelinkscanbesignificantlymorecomplicatedbuttheadditiveGaussiannoisemodelisoftenusedasafirst-orderapproximation.Asasimpleexample,wewillanalyzethecaseofbinarytransmissionoveranadditiveGaussiannoisechannel.Letthetransmittedsignals(t)beabinarywaveformthatcanhavethevalueAor−AovereachbitperiodnT≤t<(n+1)TwhereTisthebitdurationandfb=1/Tisthebitordatarate.Ineachbitperiod,thevaluesAand−Aareequallylikelyandthevaluesindifferentbitperiodsareindependentrandomvariables.AssumethechanneladdswhiteGaussiannoisev(t)withtwo-sidedpowerspectraldensityN0/2tothesignals(t),sothereceivedsignalisr(t)=s(t)+v(t)(10.1)Itcanbeshownthatareceiverthatisoptimuminthesenseofminimizingthebit-errorprobabilityfirstcomputesthestatistic1(n+1)T1(n+1)Trn=r(t)dt=±A+v(t)dt=±A+vn(10.2)TnTTnTwhere1(n+1)Tvn=v(t)dt(10.3)TnTTheintegratorisoftencalledamatchedfilterorintegrateanddumpcircuit.ItcanbeshownthatvisaGaussianrandomvariablewithzeromeanandvarianceσ2=N/(2T).Then0receiverthendecidesthatAwastransmittedinthen-thbitperiodifvn>0and−Awastransmittedifvn≤0.Theprobabilityadecisionerrorismadegiventhat−AwastransmittedisvnAP(error|s(nT)=−A)=P(−A+vn>0)=P>(10.4)σσTherandomvariablevn/σisaGaussianrandomvariablewithzeromeanandvariance1.Therefore,∞21−vP(error|s(nT)=−A)=√e2dv=Q(A/σ)(10.5)A/σ2πwhere∞21−vQ(x)=√e2dv(10.6)x2π 10.3TheNavtelDatatest3BitErrorRateTester177Similarly,itcanbeshownthattheprobabilityofanerrorgiventhatAwastransmittedisthesamething.Therefore,theaverageprobabilityoferrorisP(error)=P(A)P(error|s(nT)=A)+P(−A)P(error|s(nT)=−A)=Q(A/σ)(10.7)ThesignalpowerintheintegratoroutputisA2andthenoisepowerisσ2,sotheoutputsignal-to-noiseratioisρ=A2/σ2.Therefore,thebit-errorprobabilityintermsoftheoutputsignal-to-noiseratiois√P(error)=Q(ρ)(10.8)Differentdigitalcommunicationschemescanbecomparedandrankedbyevaluatingtheirbit-errorprobabilitiesforagivendatarate,channelbandwidth,andchannelsignal-to-noiseratio.InmathematicstextsandMATLAB,thecomplementaryerrorfunctionisdefinedas2∞−t2erfc(x)=√edt(10.9)πxThetailprobabilityforastandardnormalrandomvariable(Gaussianwith0meanandvariance1)is1∞Q(x)=√e−u2/2du(10.10)2πx√Makingthesubstitutionu/2=tintheintegralforQ(x)gives1xQ(x)=erfc√(10.11)22soanotherformulafortheerrorprobabilityis1ρP(error)=erfc(10.12)22YoucanusethisresultinMATLABtocomputethetheoreticalbit-errorprobability.AnotherapproachtocomputingtheerrorprobabilityistousethefactthattheGaussiantailprobabilityQ(x)canbeaccuratelyapproximatedforxgreaterthan2by∞221−v1−xQ(x)=√e2dv√e2(10.13)x2πx2πThisisactuallyanupperboundforQ(x)andbecomesmoreaccurateasxincreases.10.3TheNavtelDatatest3BitErrorRateTesterTherearemanycommercialtestinstrumentsformeasuringbit-errorrates.Thesemeasure-mentsareoftencalledBERTtestsinthecommunicationsjargon.EachstationinthislabhasaNavtelbit-errorratetester.TheseinstrumentsaredesignedtooperateinthefullduplexmodeatdataratescommonlyusedwithRS-232Cconnections.Theseratesextend 178TheRS-232CProtocolandaBit-ErrorRateTesterfrom50to19200bpsinthenormalasync/syncmodeandincludetherates56,57.6,and64kbpsinthehigh-speedmode.TheNavteltestercanactasaDCEorDTE.TheNavteltesterperformsaBERTtestbytransmittingaspecifiedpatternandassumesthesamepatternistransmittedfromtheremoteend.Itsynchronizestothereceivedpatternandthencountserrors.ThetestpatternselectionincludesseveralASCIItextsequencesaswellaspseudo-randomshiftregistersequencesoflength63,511,2047,and4095.Thetestdurationcanbesettobeavarietyoffixedtimes,fixedofnumberbits,orcontinuous.Duringthetest,theNavtelcountsthenumberofbitsreceivedandthenumberoferrorsandcontinuallycomputesthebit-errorrateastheratioofthecurrentcumulativenumberoferrorsandthenumberofbitsreceived.Thisvaluecanbeobservedinthetester’sdisplaywhilethetestisinprogress.Someothervariablesthatcanbedisplayedarethenumberofbitsreceived,thenumberofbiterrors,thenumberofblocksreceived,thenumberofblockerrors,thenumberofsynchronizationlosses,andtheelapsedtime.SeetheNavtelmanualformoredetails.TheNavteltesteralsohasafullRS-232Cbreakoutbox.LEDindicatorsshowthestatusofthekeyRS-232Cinterfaceleads.Eachkeyleadhasaredandgreenmonitor.AnilluminatedredLEDindicatesanON,space,or12voltsignalwhileanilluminatedgreenLEDindicatesanOFF,mark,or-12voltsignal.NeitherLEDisilluminatedifthelevelisbetween-3and3volts.ThetestercanbeconnectedbetweenaDTEandDCEtomonitortheleads.SincetheNavteltesterusesRS-232Clevelsignals,itcannotbedirectlyconnectedtotheDSPwhichusesthe0and5vTTLlevels.EachstationhasahomemadeTTLtoRS-232CconverterdaughtercardforconnectingthetestertoMcBSP0.DetailsoftheconvertercardcanbefoundinAppendixB.McBSP0isconnectedtothecontrolportandMcBSP1tothedataportoftheAIC23codecbydefault.However,theycanindependentlyberoutedtotheperipheralexpansionconnectorontheDSKinsteadoftotheMcBSP’sbywritingtheappropriatewordtotheMISCregisteroftheCPLD.McBSP0waschosenfortheconvertercardsoMcBSP1canbeconnectedtothecodec’sdataport.ThisallowsanexternaldeviceliketheNavteltestertobeusedasadataterminalandtheDSPtobeprogrammedtoactasamodem,sendingandreceivinganalogchannelsignalsthroughthecodec.10.4Bit-ErrorRateTestExperimentInthisexperiment,youwilllearnhowtousetheNavtelbit-errorratetester.SincethelabdoesnothaveGaussiannoisegenerators,thedatapatternfromthetesterwillbesenttotheDSPwhichwillintroducebiterrorsaccordingtotheadditiveGaussiannoisechannelmodel.ThecorruptedbitpatternwillthenbesentbacktotheNavteltester.Youwillgenerateagraphofthebit-errorratevs.SNRandcompareitwiththeoreticalresults.Performthefollowingexercises:1.ConnectoneendoftheRS-232CcabletotheDCEsocketontheNavteltesterandtheotherendtotheDB25RS-232CconnectorforthedaughtercardontherearofthePC.2.TurnontheNavteltesterandpresstherightandleftarrowsuntilBERTblinks.ThenpressSETUP/CLEAR.NowsettheNavtelparametersasfollows: 10.4Bit-ErrorRateTestExperiment179(a)PresstherightarrowtomaketheentryunderMESSAGEblinkandthenpressSETUP.Usethearrowstoselect4095andpressSETUPagain.Thisselectstheshiftregistersequenceoflength4095.(b)Similarly,setthemessagelengthtoCont(continuous).(c)SetCLOCKtoExt(external).TheclockswillbegeneratedbytheDSP’sserialportMcBSP0andconvertedtoRS-232Clevelsbythedaughtercard.(d)SettheMODEtoDTEsotheNavtellookslikeaterminal(DTE).(e)SettheLEVELto8andPARITYtoNo.Thismeansthatintheasyncmodeeachcharacterwillconsistof8databitswithnoparitybit.(f)SetSY/ASYtoSyn(synchronous).Inthismode,acontinuousbitstreamwithnostartandstopbitsistransmitted.(g)SettheSPEEDto19200.3.WriteaprogramfortheDSPtotakebitsfromtheNavteltesterandsimplyloopthembacktotheNavtelthroughMcBSP0.Lateryouwillbeaskedtointroduceerrorsintothebitstream.Thesamplerategenerator(SRG)inMcBSP0shouldbeusedtogeneratethetransmitframesync(FSX),receiveframesync(FSR),transmitbitclock(CLKX),andreceivebitclock(CLKR).AblockdiagramoftheSRGisshowninFigure10.1.FSRandFSXarenotconnectedtotheNavteltesterbutareusedinternallyinMcBSP0.However,CLKRandCLKXareconnectedtotheNavteltesterandusedasitsexternaldataclocks,soMcBSP0mustbeconfiguredtomakethemoutputs.TheclockforthesamplerategeneratorshouldbeanexternalclocksuppliedbyTimer0.Thetimeroutput,TOUT0,isloopedbacktotheSRG0clockinputpin,CLKS0,bytheconverterbox.YoushouldlookatChapter12oftheTMS320C6000PeripheralsReferenceGuide[I.10]forcompletedetailsontheserialportsandtheirsamplerategenerator.YouwillnoticetherethattheSRGcanuseaninternalclockwhosefrequencyisCPUclock/2forthe’C6713andthatithasdividerstogeneratethebitclocksandframesyncs.ThereasonforchoosingTOUT0astheclocksourceisthatthedividersintheSRGcannotdividetheinternalclockbyalargeenoughfactortoachievethedesired19200bpsrate.ThetimerswerediscussedinSection2.3andthefollowingformulaforthefrequencyofTOUTforthetimerinclockmodewasgiven:CPUclockfrequencyfTOUT=(10.14)8×(PeriodRegistervalue)wherethe“PeriodRegistervalue”isanunsigned32-bitinteger.TheCPUclockfrequencyis225MHzforthe’C6713DSK.WewillconfiguretheMcBSP0samplerategeneratortouseTOUT0asitsclockwhichcanbeinvertedintheSRGaccordingtothevalueofCLKSPandtheresult,CLKSRG,isselectedratherthantheinternalclocksourceandappliedtoapairofdividersiftheclockselectmodebit(CLKSM)is0.Thefirstdividerusesthevalueofthe8-bitunsignedinteger,CLKGDV,asthedivide-downnumbertogeneratethesignal,CLKG,whichispossiblyinvertedtoformthebitclocksCLKXand 180TheRS-232CProtocolandaBit-ErrorRateTesterCLKGDVFPERFWIDInternalClockSource1CLKSRGFrameFSG÷÷CLKSPulse0CLKSPCLKGCLKSMFramepulsedetectionGSYNCandclockFSRsynchronizationFigure10.1:StructureoftheSampleRateGenerator(SRG)CLKR.ThefrequencyofCLKGwhenthetimerisinclockmodeisCLKSRGfrequencybitclockfrequency=CLKGfrequency=CLKGDV+1CPUclockfrequency=(10.15)8×(PeriodRegister)(CLKGDV+1)WhenCLKGDVisoddorzero,CLKGhasa50%dutycycle.WhenCLKGDVisanevennumber,2p,thehighstatelastsp+1cyclesandthelowstatepcycles.ThesignalCLKGisthenappliedtoadividerwiththeunsignedinteger12-bitdivide-downnumber,FPER,togeneratethesignalFSGwhichisattheframesyncfrequency.ThefrequencyofFSGisCLKGfrequencyframesyncfrequency=FSGfrequency=(10.16)FPER+1Thesamplerategeneratorincludesoneadditionalcountertogeneratethewidthoftheframesyncpulse.Theunsigned8-bitinteger,FWID,determinestheframesyncpulsewidth.TheFSGpulsewidthisFWID+1pulsesofCLKG.Thefollowingcodesegmentwillhelpyouwriteyourprogram.First,astructureisini-tializedwiththevaluesrequiredtoconfigureMcBSP0forthedesiredmodeofoperation.McBSP0isconfiguredtotransmitandreceive32-bitwordsandthedivide-downnumber,FPER,fortheframesyncsissetto31.Accordingtotheperipheralsmanual,theactualframesyncperiodwillbeFPER+1=32serialbitclocks.Therefore,databitswillbetransmittedandreceivedwithnogapsbetweenwords.Fordetailsonthemnemon-icsseetheTMS320C6000ChipSupportLibraryAPIReferenceGuide,[I.6],AppendixB.10.NextaconfigurationstructureforTimer0isconstructed.InordertousetheCSLfunctions,MCBSP_open()iscalledwhichreturnsthehandlehMcBSP0andTIMER_open()iscalledwhichreturnsthehandlehTimer0.ThestructurevaluesforMcBSP0arethen 10.4Bit-ErrorRateTestExperiment181loadedintotheMcBSP0registersbythefunctionMCBSP_config()butMcBSP0isnotstartedyet.ThenTimer0isinitializedbythefunctionTIMER_config()andstartedbythefunctionTimer_start().Afterthetimerisrunning,McBSP0isstartedbythefunctionMcBSP_start().Finallyadummywordof0iswrittentoDXR0togetthetransmitteractuallyrunning.Program10.1CodeSegmentforConfiguringandStartingMcBSP0#include#include#includeMCBSP_HandlehMcBSP0;TIMER_HandlehTimer0;...main(){...MCBSP_ConfigmcbspCfgData={MCBSP_FMKS(SPCR,FREE,NO)|MCBSP_FMKS(SPCR,SOFT,NO)|MCBSP_FMKS(SPCR,FRST,NO)|MCBSP_FMKS(SPCR,GRST,YES)|MCBSP_FMKS(SPCR,XINTM,XRDY)|MCBSP_FMKS(SPCR,XSYNCERR,NO)|MCBSP_FMKS(SPCR,XRST,YES)|MCBSP_FMKS(SPCR,DLB,OFF)|MCBSP_FMKS(SPCR,RJUST,RZF)|MCBSP_FMKS(SPCR,CLKSTP,DISABLE)|MCBSP_FMKS(SPCR,DXENA,OFF)|MCBSP_FMKS(SPCR,RINTM,RRDY)|MCBSP_FMKS(SPCR,RSYNCERR,NO)|MCBSP_FMKS(SPCR,RRST,YES),MCBSP_FMKS(RCR,RPHASE,SINGLE)|MCBSP_FMKS(RCR,RFRLEN2,OF(0))|MCBSP_FMKS(RCR,RWDLEN2,DEFAULT)|MCBSP_FMKS(RCR,RCOMPAND,MSB)|MCBSP_FMKS(RCR,RFIG,NO)|MCBSP_FMKS(RCR,RDATDLY,0BIT)|MCBSP_FMKS(RCR,RFRLEN1,OF(0))|MCBSP_FMKS(RCR,RWDLEN1,32BIT)|MCBSP_FMKS(RCR,RWDREVRS,DISABLE), 182TheRS-232CProtocolandaBit-ErrorRateTesterMCBSP_FMKS(XCR,XPHASE,SINGLE)|MCBSP_FMKS(XCR,XFRLEN2,DEFAULT)|MCBSP_FMKS(XCR,XWDLEN2,DEFAULT)|MCBSP_FMKS(XCR,XCOMPAND,MSB)|MCBSP_FMKS(XCR,XFIG,NO)|MCBSP_FMKS(XCR,XDATDLY,0BIT)|MCBSP_FMKS(XCR,XFRLEN1,OF(0))|MCBSP_FMKS(XCR,XWDLEN1,32BIT)|MCBSP_FMKS(XCR,XWDREVRS,DISABLE),MCBSP_FMKS(SRGR,GSYNC,FREE)|MCBSP_FMKS(SRGR,CLKSP,RISING)|MCBSP_FMKS(SRGR,CLKSM,CLKS)|MCBSP_FMKS(SRGR,FSGM,FSG)|MCBSP_FMKS(SRGR,FPER,OF(31))|MCBSP_FMKS(SRGR,FWID,OF(1))|MCBSP_FMKS(SRGR,CLKGDV,OF(0)),MCBSP_MCR_DEFAULT,MCBSP_RCER_DEFAULT,MCBSP_XCER_DEFAULT,MCBSP_FMKS(PCR,XIOEN,SP)|MCBSP_FMKS(PCR,RIOEN,SP)|MCBSP_FMKS(PCR,FSXM,INTERNAL)|MCBSP_FMKS(PCR,FSRM,INTERNAL)|MCBSP_FMKS(PCR,CLKXM,OUTPUT)|MCBSP_FMKS(PCR,CLKRM,OUTPUT)|MCBSP_FMKS(PCR,CLKSSTAT,DEFAULT)|MCBSP_FMKS(PCR,DXSTAT,DEFAULT)|MCBSP_FMKS(PCR,FSXP,ACTIVEHIGH)|MCBSP_FMKS(PCR,FSRP,ACTIVEHIGH)|MCBSP_FMKS(PCR,CLKXP,RISING)|MCBSP_FMKS(PCR,CLKRP,FALLING)};TIMER_Configtimer0CfgData={TIMER_FMKS(CTL,INVINP,NO)|TIMER_FMKS(CTL,CLKSRC,CPUOVR4)|TIMER_FMKS(CTL,CP,CLOCK)|TIMER_FMKS(CTL,HLD,YES)|TIMER_FMKS(CTL,INVOUT,NO)|TIMER_FMKS(CTL,FUNC,TOUT), 10.4Bit-ErrorRateTestExperiment183putyourPDRvaluehere,/*Periodregistervalue*/0x00000000/*Initialcounterregistervalue*/};/*OpenMcBSP0andgethandle*/hMcBSP0=MCBSP_open(MCBSP_DEV0,MCBSP_OPEN_RESET);/*OpenTimer0andgethandle*/hTimer0=TIMER_open(TIMER_DEV0,0);/*ConfigureMcBSP0..*/MCBSP_config(hMcBSP0,&mcbspCfgData);/*ConfigureTimer0*/TIMER_config(hTimer0,&timer0CfgData);/*StartTimer0*/TIMER_start(hTimer0);/*StartMcBSP0*/MCBSP_start(hMcBSP0,MCBSP_XMIT_START|MCBSP_RCV_START|MCBSP_SRGR_START|MCBSP_SRGR_FRAMESYNC,220);/*WriteadummywordtoDXR0togettransmitterstarted*/MCBSP_write(hMcBSP0,0);...4.IncludealineinyourprogramtoconnectMcBSP0tothePeripheralExpansionConnectorratherthantheAIC23controlport.YoucanuseafunctionintheBSLtodothis.FordocumentationontheBSLfunctions,startCodeComposerStudio,clickonHelp,Contents,TMS320C6713DSK,Software,and,finally,BoardSupportLibrary.Bit0intheMISCregisteroftheCPLDcontrolstheMcBSP0connection.Youmustchangeitfrom0to1toconnectMcBSP0tothePeripheralExpansionConnector.Youcandothisbyincludingthefollowinglineinyourprogram:DSK6713_rset(DSK6713_MISC,0x01)5.SelectthePeriodRegistervalueforTimer0withMcBSP0samplerategeneratordividerCLKGDV=0togiveaserialbitrateascloseto19200bpsaspossible.Checkyourinitialprogrambystartingabit-errorratetest.Todothis,pressRUNontheNavteltester.PresstheupordownarrowsuntilBERTisdisplayed.Ifyouareloopingthedataback 184TheRS-232CProtocolandaBit-ErrorRateTestercorrectly,BERTshouldremain0.YoucanintroduceasingleerrorbypressingINSERTERRORandobservetheeffectontheBERTdisplay.6.Nowmodifyyourprogramtoadderrorstothebitstream.Foreachofthe16pairsofbitsinareceived32-bitword,generateapairofzeromean,uncorrelated,GaussiannoisesamplesbythemethoddescribedinAppendixA.Assumethatalogical0isrepresentedbyAvoltsonthechannelandlogical1by−AvoltsasdiscussedinSection10.2.Lettheintegratoroutputnoisevariancebeσ2=1andadjustAtogetthedesiredoutputsignal-to-noiseratio.Then,theSNRindBisA2S=10log102=20log10A(10.17)σandtherequiredvalueforAisS/20S/20A=σ×10=10(10.18)LetaparticularpairofGaussiannoisesamplesbedenotedby(X,Y).Accordingtothetheory,atransmitted1ischangedtoa0ifX>Aandatransmitted0ischangedtoa1ifX≤−A.Theprobabilitiesofthesetwoeventsareidenticalbecausetheprobabilitydensityfunctionforthezeromean,Gaussianrandomvariablesiseven.Thus,todeterminewhentointroduceabiterror,checktoseeifX>A.Ifthisistrue,anerrorshouldbeintroducedinthefirstbitofapair.Similarly,whenY>Aanerrorshouldbeintroducedinthesecondbitofapair.TheerrorscanbeintroducedbyXOR-ing1’sintotheerrorlocationsinthereceived32-bitserialwordtocomplementthecorrectbits.7.Nowexperimentallygenerateabit-errorratevs.SNRplot.Startwitha13dBSNRandworkdownto7dBinonedBincrements.MakesuretorunyourtestlongenoughateachSNRtoobtainastatisticallyreliableestimateoftheerrorrate.PlottheBERastheordinateonalogarithmicscale.PlottheSNRindBonalineardBscale.TheGaussiannoisegeneratoralgorithmcausesanupperlimitontheSNRvaluethatcancauseerrors.ItisshowninAppendixA,Equation(A.9)thatwiththe’C6xcompilerthemaximummagnitudeforXorYis|Xmax|=|Ymax|=σ30loge2=4.56009σ(10.19)NoerrorscanoccurifXmax20log1030loge2=13.1795dB(10.20)8.TheoreticallycomputetheBERvs.SNRplotandcompareitwithyourexperimentallymeasuredcurve. 10.5AdditionalReferences18510.5AdditionalReferencesTherearemanybooksthatdiscussdigitalcommunicationsystemsandhavesectionsontheoptimumdetectionofsignalscorruptedbyadditiveGaussiannoiseandhowtocomputeerrorprobabilitiesforvarioussignalsets.Forexample,seeGibson[II.D.9,Chapter10],Gitlin,HayesandWeinstein[II.D.11,Section2.2],andHaykin[II.D.17,Sections7.2–7.3]. Chapter11DigitalDataTransmissionbyBasebandPulseAmplitudeModulationInthischapteryouwillbeintroducedtoacommonmethodfordigitaldatatransmissionknownasbasebandpulseamplitudemodulation(PAM).ThepresentationisslantedtowardstransmissionoverbandlimitedchannelsandDSPimplementation.TheconceptslearnedherewillbegeneralizedtopassbanddigitalcommunicationsystemsinChapters13–16.Someoftheconceptsandtermsyouwillbeintroducedtoare:basebandshapingfiltersandraisedcosineshaping,intersymbolinterferenceandtheNyquistcriterion,eyediagrams,symbolerrorprobabilityformulas,interpolationfilterbanks,andasymbolclockrecoverymethod.11.1GeneralDescriptionofaBasebandPulseAmpli-tudeModulationSystemInpulseamplitudemodulation,informationsymbolsaretransmittedatdiscrete,uniformlyspacedtimeintervals.Thecarriersignalisatrainofpulsesuniformlyspacedatthesameintervalastheinformationsymbols.Theamplitudeofeachpulseisaone-to-onefunctionofthecorrespondinginformationsymbol.Theinformationisrecoveredatthereceiverbymeasuringtheamplitudeofeachpulseandmappingitbacktotheinformationsymbol.Inwidebandsystems,non-overlapping,rectangular,fullperiodpulsesareoftenused.Inbandlimitedsystems,thepulsesoverlapbutareselectedsothattheinformationsymbolscanbemeasuredbysamplingthereceivedsignalatthesymbolrateaswillbeexplainedbelow.TheblockdiagramofatypicalbasebandPAMsystemisshowninFigure11.1.ThetransmitterinputdiisaserialbinarydatasequencewithabitrateofRdbits/sec.InputbitsareblockedintoJ-bitwordsbytheserial-to-parallelconverterandmappedintothesequenceofsymbolsawhichareselectedfromanalphabetofM=2Jdistinctvoltagenlevels.Thesesymbolsaregeneratedattherateoffs=Rd/Jsymbols/secandwewilldesignatetheintervalbetweensymbolsasT=1/fs.Theterm,baud,iscommonlyusedforthesymbolratefsinhonorofBaudotwhoinventedabinarycodeforrepresentingalpha-187 188DigitalDataTransmissionbyPulseAmplitudeModulationnumericcharacters.Baudisalsofrequentlyused(ormisused)tomeanonesymbolperiod.Thelevelsareoftenselectedtobeequallyspacedandhaveanarithmeticaverageofzero.Inthischapter,wewilluselevelsspacedby2dwiththeMpossiblevaluesMMi=d(2i−1)fori=−+1,...,0,...,(11.1)22Thus,theminimumlevelis−(M−1)dandthemaximumlevelis(M−1)d.ItismathematicallyconvenienttorepresentthesymbolsequencebytheDiracimpulsetrain∞∗s(t)=akδ(t−kT)(11.2)k=−∞TheImpulseModulatorblockformsthisfunction.ThisimpulsetrainisappliedtoaTransmitFilterwithimpulseresponsegT(t)whichbandlimitsthesignaltothechannelbandwidth.Theresultingtransmittedsignalis∞s(t)=akgT(t−kT)(11.3)k=−∞whichisasuperpositionofamplitudemodulatedpulses.ThecombinationoftheimpulsemodulatorandtransmitfilterisamathematicalmodelforaDACfollowedbyalowpassfilter.Inthischapter,thechannelwillbemodeledasalinear,time-invariantfilterwiththefrequencyresponseC(ω)followedbyanadditivenoisesource.Atthereceiver,thechanneloutputr(t)isfirstpassedthroughareceivefilterwhicheliminatesout-of-bandnoiseand,inconjunctionwiththetransmitfilter,formsaproperlyshapedpulse.Thecombinedtransmitfilter,channel,andreceivefilterfrequencyresponseisG(ω)=GT(ω)C(ω)GR(ω)(11.4)andthecorrespondingimpulseresponseis−1g(t)=gT(t)∗c(t)∗gR(t)=F{G(ω)}(11.5)where∗representsconvolution.ThecombinedfilterrepresentedbyG(ω)iscalledthebase-bandshapingfilter.Theoutputofthereceivefilteris∞x(t)=akg(t−kT)+v(t)∗gR(t)(11.6)k=−∞NowassumethatthenoiseiszeroandthecombinedimpulseresponseiszeroatthetimeinstantsnTexceptforn=0whereitis1,thatis,1forn=0g(nT)=δn,0=(11.7)0otherwiseAnimpulseresponsewiththispropertyissaidtohavenointersymbolinterference(ISI).ThispropertyisexaminedinmoredetailinSection11.2.Withtheseassumptions,itcanbe 11.1DescriptionofaBasebandPulseAmplitudeModulationSystem189SerialtoMapfrom∗Transmitd.i..anImpulses(t)s(t).Parallel.J-bitWordstoFilter1JJModulatorConverter2LevelsGT(ω)TransmitterChannelr(t)+FrequencyResponseC(ω)v(t)AdditiveChannelNoiseChannelModelReceiveSamplerx(t)x(nT0+τ)Adaptivey(nT)aˆnFilterandQuantizerEqualizerGR(ω)ADCSymbolClockRecoverydˆParalleltoMapfrom.i..J.Serial.2Levelsto1ConverterJJ-bitWordsReceiverFigure11.1:BlockDiagramofaBasebandPAMSystem 190DigitalDataTransmissionbyPulseAmplitudeModulationseenfrom(11.6)thatthesamplesofthereceivefilteroutputtakenattimesnTreducetox(nT)=anwhichisexactlythesequenceoftransmittedsymbols.Often,thetransmitandreceivefiltersaredesignedtogiveacombinedfilterwithnointersymbolinterferenceundertheassumptionthatthechannelfrequencyresponseisconstantoverthesignalbandwidthand,therefore,introducesnodistortion.TheoutputofthereceivefilteristhensampledataratethatisanintegermultipleNofthesymbolratefs.Typically,Nmightbe3or4.ThecorrespondingsamplingperiodisT0=T/N.Thetransmitterandreceivertimereferencesarenotexactlysynchronizedinfrequencyorphaseandthisisindicatedbythevariableτinthesampleroutput.ThesamplesareusedbytheSymbolClockRecoverysystemtolockthereceiversymbolclocktothetransmitterclock.Inmanyinstances,thechannelfrequencyresponseisnotknownexactlyandmayvaryslowly.TheAdaptiveEqualizerisafilterthatautomaticallycompensatesfornon-idealchannelcharacteristics.Inaddition,itcorrectsforsmalldeviationsinthetransmitandreceivefilterresponsesfromtheiridealnominalvalues.ThetheoryofoperationoftheadaptiveequalizerispresentedinChapter15.Theequalizeroutputissampledatthesymbolrateandquantizedtothenearestideallevel.Theequalizeroutputsamplesdeviatefromtheideallevelsbecauseoftheadditivechannelnoiseandresidualintersymbolinterference.ThequantizeroutputlevelismappedbacktothecorrespondingJ-bitbinarywordandconvertedbacktoaserialoutputdatasequence.11.2BasebandShapingandIntersymbolInterferenceItwasshownintheprevioussectionthattheoutputofthereceivefilteristhesuperpositionoftimeshiftedandamplitudescaledversionsofthebasebandshapingfilterimpulseresponseg(t)ifthenoiseisignored.Wealsolearnedthatwheng(t)iszeroattheregularlyspacedsymboltimeinstantsnTexceptforn=0whereithasthevalue1,thetransmittedsymbolscanberecoveredbysamplingthereceivefilteroutputattimesnT.Inthiscase,thepulsegeneratedbythesymbolanhasamplitudeang(0)=anattimenTandthetailsofalltheotherpulsespassthrough0.So,thepulsesgeneratedbydifferentsymbolsdonotinterferewitheachotheratthetimesnT.Animpulseresponsewiththispropertyissaidtohavenointersymbolinterference(ISI).Inthissection,afrequencydomaincriterionfornoISIwillbepresented,aclassoflowpassfilterswithnoISIwillbediscussed,andacommonexperimentalmethodforobservingandmeasuringISIwillbedescribed.11.2.1TheNyquistCriterionforNoISIEquation(11.7)statesthecriterionfornoISIintermsofthebasebandshapingfilterimpulseresponsesamplesg(nT).Thesesamplescanbecomputedfromtheshapingfilterfrequencyresponsebytheformula1∞jωnTg(nT)=G(ω)edω(11.8)2π−∞ 11.2BasebandShapingandIntersymbolInterference191Letωs=2πfs=2π/T.Theintegralcanbecomputedbypartitioningtheωaxisintotheinfinitesetofintervalsωsωs−−kωs,−kωsfork=−∞,...,∞22andtakingthesumofintegralsovertheintervalstogetωs−kωωss∞2∞211jωnT11j(ω−kωs)nTg(nT)=G(ω)edω=G(ω−kωs)edω(11.9)k=−∞ωsωsTk=−∞ωsωsT−−kωs−22Recognizingthate−jknωsT=e−kn2π=1andtakingthesuminsidetheintegralgivesωs21∗jωnTg(nT)=G(ω)edω(11.10)ωsωs−2where1∞∗G(ω)=G(ω−kωs)(11.11)Tk=−∞ThefunctionG∗(ω)iscalledthealiasedorfoldedspectrumandiswellknownindigitalsignalprocessingtheory.Thecriterion(11.7)fornoISIissatisfiedifandonlyifG∗(ω)=1.Thiscanbeseenbyevaluating(11.10)forthisspecialcase.TheconstraintthatthealiasedspectrumG∗(ω)mustbeaconstantfornoISIisknownastheNyquistcriterion.11.2.2RaisedCosineBasebandShapingFiltersTherequirementfornoISIonlymakesconstraintsonthesymbolratesamplesofthebase-bandshapingfilterimpulseresponse.Thereareaninfinitenumberofimpulseresponsesthatmeettheconstraints.Oneclassoffiltersthatisoftenspecifiedforusewithlowpasschannelshasraisedcosinefrequencydomainshaping.Thefrequencyresponseofaraisedcosinefilteris⎧⎪⎪Tfor|ω|≤(1−α)ωs⎨2G(ω)=T1−sinT|ω|−ωsfor(1−α)ωs≤|ω|≤(1+α)ωs(11.12)⎪⎪22α222⎩0elsewherewhereαisaconstantintheinterval[0,1]andiscalledtheexcessbandwidthfactor.Theraisedcosinefrequencyresponseisflatoverthecentralportionofthepassbandandrollsoffsinusoidallytozeroatthebandedge.Itisdownfromthe0frequencyvaluebyafactorof2,whichisequivalentto6dB,atthefrequencyωs/2.Thefrequencyωs/2iscalledtheNyquistfrequency.Itcanbeshownthatthecorrespondingimpulseresponseissinωstcosαωst22g(t)=(11.13)ωst1−4(αt/T)22 192DigitalDataTransmissionbyPulseAmplitudeModulationTheprogramC:digfilrascos.execomputessamplesoftheraisedcosinefilterimpulseresponsemodifiedbytheHammingwindow.Noticethatwhenα=0,theraisedcosinefilterbecomesanidealflatlowpassfilterwithcutofffrequencyωs/2.Whenα=1,thefrequencyresponsehasnoflatregionandisonecycleofacosinefunctionraisedupsoitbecomes0atthecutofffrequencyofωs.Asthebandwidthisincreasedbymakingαcloserto1,theimpulseresponsedecaysmorerapidly.11.2.3SplittingtheShapingBetweentheTransmitandReceiveFiltersWhenthechannelamplituderesponseisflatacrossthesignalpassbandandthenoiseiswhite,itcanbeshown[II.D.29,p.54]thattheamplituderesponseofthecombinedbasebandshapingfiltershouldbeequallysplitbetweenthetransmitandreceivefilterstomaximizetheoutputsignal-to-noiseratio,thatis,1/2|GT(ω)|=|GR(ω)|=|G(ω)|(11.14)Theirphasescanbearbitraryaslongasthecombinedphaseislinear.Whenraisedcosineshapingisused,theresultingoptimumtransmitandreceivefiltersarecalledsquare-rootofraisedcosinefilters.TheprogramC:digfilsqrtraco.execanbeusedtocomputetheimpulseresponseofasquare-rootofraisedcosinefilter.11.2.4EyeDiagramsTheeyediagramisausefuldiagnostictoolforqualitativelyevaluatingtheoptimalityofaPAMsystem.Aneyediagramisformedbysuperimposingoscilloscopetracesofthereceivefilteroutput.Eachtraceistriggeredatthesamephasewithinasymbolintervalandlastsforafewsymbols.AsketchofsometracesinaneyediagramforacombinedchannelwithnoISIandatwo-levelinputsymbolalphabetisshowninFigure11.2.Noticethatallthetracespassthroughtheidealsymbolvaluesof±d=±1atthesamplinginstants{nT}.TheemptyareainsidethetracesaroundnTiscalledaneyeopening.WithanMlevelinputalphabet,thereareM−1openingsstackedverticallyateachsymbolinstant.Thequantizerslicingordecisionlevelsareusuallychosentobethevaluesk2dhalfwaybetweentheidealsymbollevels.Somewhatsurprisingly,theoptimumtimeatwhichtosamplethereceivefilteroutputisnotatthepeaksoftheeyediagramwithbandlimitedchannels.Itissomewhatdowninavalley.Themorebandlimitedthechannel,themorerapidlytheeyeclosesawayfromthesymbolinstantsandthehigherthepeaksbetweensymbolsbecome.Whenintersymbolinterferenceispresent,thetracesdonotallpassthroughtheideallevelsatthesamplinginstantsandthesepointsbecomedispersed.AstheISIincreases,thedispersiongrowsandtheeyebeginstoclose.Aslongastheeyeisopen,nodecisionerrorsaremadewhentheadditivechannelnoiseiszero.However,whennoiseispresent,theerrorrateincreasesastheeyecloses. 11.2BasebandShapingandIntersymbolInterference19321.510.50-0.5-1-1.5-200.511.52NormalizedTimet/TFigure11.2:EyeDiagramforaChannelwithnoISIandM=2.RaisedCosineShapingwithα=0.12.Withzeroadditivenoise,thesymbolratesamplesofthereceivefilteroutputare⎡⎤∞⎢∞g(nT−kT)⎥x(nT)=akg(nT−kT)=g(0)⎢⎣an+ak⎥⎦(11.15)g(0)k=−∞k=−∞k=nTheright-handsummationin(11.15)istheISIforthecurrentreceivedsymbol.DecisionerrorsaremadewhenthemagnitudeofthisISIexceedsdexceptwhentheISIcarriesanouterleveloutsidetheeyediagram.Wewillassumethatg(0)>0.TheISIisarandomvariableanddependsonthesymbolsequence.TheworstcaseorpeakISIoccurswhenthesymbolsakhavetheirmaximummagnitude(M−1)dandthesamesignasg(nT−kT).ThenthesumfortheISIbecomes∞g(nT−kT)∞g(kT)D=(M−1)d=(M−1)d(11.16)g(0)g(0)k=−∞k=−∞k=nk=0ThepeakfractionaleyeclosureisdefinedtobeD∞g(kT)η==(M−1)(11.17)dg(0)k=−∞k=0Whenηislessthan1,theeyesareopen. 194DigitalDataTransmissionbyPulseAmplitudeModulation11.3ImplementingtheTransmitFilterbyanInterpo-lationFilterBankDesigningandmanufacturingananaloglowpassfilterthatcloselyapproximatestheimpulseresponseorlinearphasefrequencyresponseofadesiredtransmitfilterliketheraisedcosineorsquare-rootofraisedcosineresponseisdifficult.AsolutiontothisproblemistoplacetheburdenonthetransmitterDSPandperformmostoftheshapingwithadiscrete-timeinterpolationfilterbankthatgeneratesLoutputsamplespersymbol.Thesesamples,whichoccurwithfrequencyLfs,areD/Aconvertedandappliedtoasimpleanaloglowpassfiltertogeneratethecontinuous-timetransmitteroutput.ThefirststepinderivingthedesiredinterpolationformulaistoreplacetbynT+m(T/L)in(11.3)whichgivesT∞TsnT+m=akgTnT+m−kTform=0,1,...,L−1(11.18)LLk=−∞NowletLdiscrete-timeinterpolationsubfiltersbedefinedasTgT,m(n)=gTnT+mform=0,1,...,L−1(11.19)LThen,theLoutputsamplesrequiredduringthesymbolperiodstartingattimenTcanbeexpressedasT∞snT+m=akgT,m(n−k)form=0,1,...,L−1(11.20)Lk=−∞Noticethatforeachm,(11.20)isequivalenttopassingtheTspacedinputsymbolsequence{an}throughaTspaceddigitalfilterwithimpulseresponsegT,m(n).TheresultingDSPoutputwordsarethenmultiplexedtoaDACattherateofLfssamples/second.Finally,theDACoutputispassedthroughasimpleanaloglowpassfiltertoeliminatetheunwantedhighfrequencyspectralcomponentsaroundmultiplesofLfs.ThisprocessisillustratedinFigure11.3.Inpractice,thetransmitfilterimpulseresponseistruncatedtoafinitedurationbyawindowfunctionliketheHammingwindowsoeachsubfilterbecomesafinitetapFIRdigitalfilter.11.4SymbolErrorProbabilityforaChannelwithaPerfectFrequencyResponseandAdditiveGaus-sianNoiseAnimportantmeasureoftheperformanceofadigitalcommunicationsystemisitserrorprobabilityasafunctionofthechannelSNR.AformulaforthesymbolerrorprobabilityofPAMwillbederivedinthissectionunderthefollowingassumptions:1.Thefrequencyresponseofthechannelisaconstantoverthesignalbandwidth. 11.4SymbolErrorProbabilitywithAdditiveGaussianNoise195gT,0(n)s(nT)gT,1(n)anLowpasss(t)DAC..Filter.L−1snT+TgT,L−1(n)LFigure11.3:ImplementingtheTransmitFilterbyanInterpolationFilterBank2.SymbolsfromtheMlevelalphabetareusedwithequalprobability.3.Symbolsselectedatdifferenttimesareuncorrelatedrandomvariables.4.TheadditivenoiseiswhiteandGaussianwithtwo-sidedpowerspectraldensityN0/2.5.Thecombinedbasebandshapingfilterhasaraisedcosineresponsewithexcessbandwidthfactorαandtheshapingissplitequallybetweenthetransmitandreceivefilters.There-fore,thetransmitandreceivefiltersbothhavesquare-rootofraisedcosineresponses.Itcanbeshown[II.D.29,pp.52-53]thattheaveragetransmittedpowerisE{a2}1∞n2Ps=|GT(ω)|dω(11.21)T2π−∞Withthesquare-rootofraisedcosinetransmitfilter,thisreducestoE{a2}nPs=(11.22)TUsing(11.1)andthefactthatthelevelsareequallylikely,theexpectedsquaredsymbolvalueisfoundtobe2M/2d22222a=E{an}=[d(2k−1)]=(M−1)(11.23)M3k=1Therefore,theaveragetransmittedpowerisd22Ps=(M−1)(11.24)3T 196DigitalDataTransmissionbyPulseAmplitudeModulationThenoiseattheoutputofthesquare-rootofraisedcosinereceivefilterhasthevariance1∞NNσ2=0|G(ω)|2dω=0(11.25)R2π−∞22Also,thechannelnoisepowerintheNyquistband(−ωs/2,ωs/2)is1ωs/2NN00PN=dω=(11.26)2π−ωs/222TSincethereisnoISI,thesamplesofthereceivefilteroutputhavetheformx(nT)=an+vR(nT)(11.27)wherevR(nT)isasampleofthechannelnoisefilteredbythereceivefilter.WhenanisoneoftheM−2innerlevels,thesymbolerrorprobabilityisPI=P(|vR(nT)|>d)=2Q(d/σ)(11.28)whereQ(x)istheGaussiantailprobabilitydefinedin(10.13).Fortheouterlevel(M−1)dtheerrorprobabilityisPO+=P(vR(nT)<−d)=Q(d/σ)(11.29)andfortheouterlevel−(M−1)dtheerrorprobabilityisPO−=P(vR(nT))>d)=Q(d/σ)=PO+(11.30)ThetotalsymbolerrorprobabilityisM−211M−1Pe=PI+PO++PO−=2Q(d/σ)(11.31)MMMMSolving(11.24)fordandusing(11.25)and(11.26),theerrorprobabilitycanbeexpressedintermsofthechannelsignal-to-noiseratioPs/PNas1/2M−13PsPe=2Q(11.32)MM2−1PN11.5SymbolClockRecoveryIntypicalPAMsystems,thereceiverhasareasonablygood,butnotperfect,knowledgeofthetransmitter’ssymbolclockfrequency.Itmustlockitslocalsymbolclockfrequencyandphasetothoseofthereceivedsignaltomaintainthepropersamplinginstants.AmethodforderivingthesymbolclockfromthereceivedPAMsignalispresentedinthissection.Itisparticularlysuitedtobandlimitedsystems.Widebandsystemsinwhichthesignalshavesharptransitionsoftenuseotherclockrecoverymethods. 11.5SymbolClockRecovery197TheblockdiagramofaclockrecoverysystemisshowninFigure11.4.Thereceivefilteroutputx(t)isfirstpassedthroughaprefilterwithfrequencyresponseB(ω).Theprefilteristypicallyabandpassfiltercenteredatfs/2,halfthesymbolfrequency.LetthecombinedbasebandshapingfilterandprefilterfrequencyandimpulseresponsesbeG1(ω)=G(ω)B(ω)andg1(t)=g(t)∗b(t)(11.33)Then,theprefilteroutputis∞q(t)=akg1(t−kT)(11.34)k=−∞Theprefilteroutputispassedthroughasquarerwhoseoutputis∞∞2p(t)=q(t)=akamg1(t−kT)g1(t−mT)(11.35)k=−∞m=−∞ThesquareroutputispassedthroughanarrowbandbandpassfilterH(ω)whosecenterfrequencyisthesymbolratefs.Theoutputz(t)lookslikeasinusoidatthesymbolclockfrequencywithaslowlyvaryingamplitudeandphase.Itszerocrossingstendtoclustertogether.Thissignalcanthenbeappliedtoanarrowbandphase-lockedlooptogenerateastablesymbolclock.BandpassPhase-x(t)Prefilterq(t)p(t)z(t)ρ(t)SquarerFilterLockedB(ω)q2(t)H(ω)LoopFigure11.4:BlockDiagramofaClockRecoverySystemAsbefore,itwillbeassumedthatthesymbolsareasequenceofzero-meanuncorrelatedrandomvariables.Therefore,2E{akam}=aδk,m(11.36)wherea2isgivenby(11.23).Theexpectedvalueofthesquareroutputis∞∞E{p(t)}=E{akam}g1(t−kT)g1(t−mT)(11.37)k=−∞m=−∞Onusing(11.36),thisreducesto∞22E{p(t)}=ag1(t−kT)(11.38)k=−∞TheexpectedvalueofthesquareroutputisperiodicwithperiodequaltothesymbolperiodT.Therefore,itcanbeexpressedasaFourierseriesoftheform∞jkωstE{p(t)}=pke(11.39)k=−∞ 198DigitalDataTransmissionbyPulseAmplitudeModulationwhere1T−jkωstpk=E{p(t)}edt(11.40)T0Afterseverallinesofmanipulations,itcanbeshownthata2∞a2∞2−jkωstpk=g1(t)edt=G1(ω)G1(kωs−ω)dω(11.41)T−∞T2π−∞TheexpectedvalueoftheoutputbandpassfilterisalsoperiodicwiththeFourierseriesexpansion∞jkωstE{z(t)}=zke(11.42)k=−∞wherea2∞zk=pkH(kωs)=H(kωs)G1(ω)G1(kωs−ω)dω(11.43)T2π−∞ByselectingtheprefilterB(ω)tobeanarrowbandfilterthatpassescomponentsonlynear±ωs/2,itcanbeseenfrom(11.41)thatpk=0exceptfork=−1,0,or1.ByselectingtheoutputbandpassfilterH(ω)sothatitonlypassesspectralcomponentsnear±ωs,thek=0termisremovedandonlythesymbolfrequencycomponentsfork=±1remain.Whenthebasebandshapingfilterhaszeroexcessbandwidth,thatis,whenG(ω)=0for|ω|≥ωs/2,alltheFouriercoefficientspkarezerofork=0sincethenonzeroportionsofG(ω)andG(kωs−ω)donotoverlap.Thistimingrecoverymethodthenfails.FranksandBubrouski[II.D.7]havealsoderivedformulasforE{z2(t)}andvarz(t).TheyshowthatwhenG1(ω)issymmetricaboutωs/2andisbandlimitedtotheintervalωs/4<|ω|<3ωs/4andH(ω)issymmetricaboutωs,thevarianceofz(t)iszeroandperfecttimingrecoveryispossible.Whenthesesymmetryconditionsarenearlymet,thevariationsinthezerocrossingsofthetimingwavez(t)areverysmallandthereceivercantrackthesymbolclockfrequencybylockingtothezerocrossings.Thefiltersinthetimingrecoverysystemcanintroduceaphaseshiftinthetimingwavewhichmustbetakenintoaccount.Thefractionallyspacedequalizercanautomaticallycorrectforthisphaseshiftaslongastherecoveredsymbolclockfrequencyiscorrect.11.6SimulationandTheoreticalExercisesforPAMTheseexercisesaredesignedtoimproveyourunderstandingofPAMbygeneratingsignalswithCprogramsbeforedoingreal-timeimplementationsinCorassemblylanguageandhavingtodealwiththehardwareaswellasthesoftware.YouwillgeneratefourlevelPAMsignalsusingraisedcosineandsquare-rootofraisedcosineshapingandcreateeyediagrams.Youwillalsobeaskedtomakeplotsofthesymbolerrorprobabilityforseveralcases.11.6.1GeneratingFour-LevelPseudo-RandomPAMSymbolsWriteaCfunctiontogeneratepseudo-randomfour-levelsymbols.Thefunctionshouldusea23-stageselfsynchronizingshiftregistersequencegeneratorwiththeconnectionpolynomial 11.6SimulationandTheoreticalExercisesforPAM199(9.9)or(9.10),asdiscussedinChapter9,togeneratethebinarysequencedn.Generatethefour-levelsequenceanfrompairsofbinarysymbols(d2n,d2n+1)accordingtotheruled2nan=(−1)(1+2d2n+1)d(11.44)wheredisadesiredscalefactor.Drawaverticalaxisandshowthe4levels.Labeleachlevelwithitsvalueandalsothecorrespondingpairofbinarydigits.Observethatthebinarylabelsforadjacentlevelsdifferinonlyonebit.ThisiscalledGraycoding.WithadditiveGaussiannoise,themostlikelysymboldecisionerrorinthereceiveristoanadjacentlevel.Graycodingminimizesthebit-errorprobabilityatthereceiver.11.6.2EyeDiagramforaPAMSignalUsingaRaisedCosineShapingFilterUsetheprogramrascos.exetodesignaninterpolationfilterbankforaraisedcosineshapingfilterwithanexcessbandwidthfactorofα=1.0.Useasymbolrateoffs=1/T=4kHz.Truncatetheshapingfilterimpulseresponsetotheinterval[−4T,4T]withaHammingwindow.GenerateL=16samplesofthePAMsignalpersymbolinterval,thatis,generatethesequences(kT/16).Usethefilterbankandthefour-levelrandomsymbolsequencetogeneratedataforaneyediagramthatextendsovertwosymbolintervals.Dothisbywritingenoughpairs(mod(k,32),s(kT/16))toafiletoformareasonablyfilledout4-leveleyediagram.Thefunction,mod(k,32),istheremainderwhenkisdividedby32andrangesfrom0to31.Askincreases,mod(k,32)cyclesthroughthevalues0,1,...,31.Thisperformsthefunctionofresettingthetracetotheleft-handsideeverytwosymbols.Whenkreachesamultipleof32andmod(k,32)=0,youshouldwritethethreeextrapoints(32,s(kT/16)),(32,0)and(0,0)tothefilebeforewriting(0,s(kT/16).Thefirstpointcontinuesthetracetotherightedgeoftheplot,thesecondpointmovesthetraceverticallyto0,andthethirdpointmovesthetracehorizontallyat0fromtherightedgebacktotheorigin.Writingthesethreeextrapointsisnecessaryforsomeplottingfunctionsthatdrawlinesthroughtheeyediagramfromthelastpointontheright-handsidetothefirstpointontheleft-handside.Theselinesareblankedoutonanoscilloscopewhenitretraces.Someplottingprogramsbehavenicely,blanktheretracelikeanoscilloscope,andtheextrapointsarenotneeded.Printtheeyediagramusingyourfavoriteplottingprogram.Nowchangeαto0.125andgenerateaneweyediagram.Printthenewdiagram.Discussdifferencesinthetwoeyediagramsandcommentonhowtheexcessbandwidthfactoraffectstherequiredsymbolsamplingtimeaccuracyinthereceiver.11.6.3EyeDiagramforaPAMSignalUsingaSquare-RootofRaisedCosineShapingFilterRepeattheexercisesoftheprevioussectionforasquare-rootofraisedcosinebasebandshapingfilter,butonlyforα=0.125.Also,computethepeakfractionaleyeclosuredefinedby(11.17)fromtheshapingfilterimpulseresponse. 200DigitalDataTransmissionbyPulseAmplitudeModulation11.6.4TheoreticalErrorProbabilityforaPAMSystemPlotthesymbolerrorprobabilityPegivenby(11.32)forM=2,4,and8asafunctionofthechannelsignal-to-noiseratioPs/PN.PlotPeonalogarithmicscaleand10log10(Ps/PN)dBonalinearscale.11.7HardwareExercisesforPAMNowusetheDSPtogenerateaPAMsignalandsynthesizethesymbolclockrecoverysystem.Useasymbolrateoffs=4kHz.GenerateL=4PAMsignalsamplespersymbolwithaninterpolationfilterbank,sotheDACsamplingrateshouldbesetto4×4=16kHz.11.7.1GeneratingaPAMSignalandEyeDiagramGenerateafour-levelPAMsignalusingaraisedcosinebasebandshapingfilter.Generatethefour-levelpseudo-randominputsymbolsequencebythesamemethodusedinSection11.6.1.Chooseα=0.125fortheexcessbandwidthfactorofyourshapingfilterandtruncatetheimpulseresponsetotheinterval[−4T,4T]byaHammingwindow.GenerateL=4outputsamplespersymbolperiodbytheinterpolationmethod.Writetheoutputsamplestotheleftchannel.Makesuretouselevelo3optimizationwhencompilingyourprogram.Lettheimpulseresponseofthebasebandshapingfilter,viewedasanFIRfilterwithT/4tapspacing,beg(nT/4)forn=−16,−15,...,16gn=(11.45)0elsewhereThefrequencyresponseofthisfilteris1616−jωnT/4G(ω)=gne=g0+2gncos(ωnT/4)(11.46)n=−16n=1Theright-handexpressionisaresultofthefactthattheimpulseresponsehasevensymmetry.ComputeandplottheamplituderesponseofthefilterindBoverthefrequencyrangeof0to8kHz.Thereareavarietyofwaystostructureaprogramtogeneratethereal-timeoutputsignal.Hereisoneapproachtotry.WriteoutputsamplestotheMcBSP1datatransmitregister(DXR)withaninterruptroutinethatistriggeredbytheserialporttransmitinterrupts(XINT)thatoccurwhenthedatatransmitregisterisloadedintotheserialporttransmitshiftregister(XSR).Determinethesymboltimingbycountinginterruptsmodulo4.Setupan8-wordcircularbufferasa“mailbox.”Onehalfofthebuffer(4words)willbeusedtoholdtheoutputsamplesforthecurrentsymbolperiod,andtheremaininghalfwillbeusedtostorethefoursamplesforthenextsymbolperiod.Eachsymbolperiod,theinputandoutputhalveswillbeswapped.Thesearesometimescalledping-pongbuffers.ThemailboxstructureisillustratedinFigure11.5.Initializeanoutputpointertotheaddressofthefirstword,word0,inthebufferandaninputpointertothefifthword,word4.Beforestartingdatatransmission,settheinterruptcountto0toindicatethestartofasymbol.Atthestart 11.7HardwareExercisesforPAM201ofeachsymbolperiod,generatefouroutputsamples,andwritethemtothemailbox.Dothisinthemainroutine.Theinputpointershouldbeincrementedcircularlymodulo8aftereachsampleiswrittentothemailbox.Afterthefoursamplesarewrittentothemailbox,themainroutineshouldwaitfortheinterruptcounttobecome0.Whenatransmitinterruptoccurs,writethesampleaddressedbytheoutputpointertotheDXR,incrementtheoutputpointercircularlymodulo8,andincrementtheinterruptcountmodulo4.Output01234567InputFigure11.5:TheOutputMailboxStructureTestyourtransmitterprogrambyobservingtheeyediagramontheoscilloscope.UseDCcouplingforthescopeinput.GeneratingaBaudSyncSignalYouwillneedasignaltosynchronizethesweepswiththesymbolperiodtogetadisplaylikeyourtheoreticalplot.Onewaytogenerateasyncsignalistocreatea4000Hzsquare-waveontherightchannelcodecoutput.YoucandothisbyputtinganintegerlikeA=16000inthelowerhalfofthewordsenttothecodecforfirsttwosamplesinabaudand−Ainthesecondtwosamples.Ofcourse,thecodecfilterswillroundoffthecornersandmakeitlookmorelikeasinewave.11.7.2TestingtheSquare-LawSymbolClockFrequencyGenera-torWriteaprogramfortheDSPtoimplementthesymbolclockrecoverysystemdiscussedinSection11.5uptothepointlabeledz(t)inFigure11.4.Donotimplementthephase-lockedloop.UsethesameraisedcosinebasebandshapingfilteryoudesignedinSection11.7.1.Thesamplingrateforalloperationsinthesymbolclockgeneratorshouldbe4fs=16kHz.WritethePAMoutputsamplestotheDACleftchannelandalsopipethemtoyourclockrecoverysystem.Fortheprefilter,B(ω),designasecond-orderIIRfilterwithacenterfrequencyoffs/2=2kHzandroughlya100Hz3dBbandwidth.Forthepostfilter,H(ω),designasecond-orderbandpassIIRfilterwithacenterfrequencyof4kHzanda3dBbandwidthofroughly25Hz.Youshouldexperimentwiththesebandwidthsandobservehowtheyaffectthesystemperformance.Writetheclockrecoverysystemoutputsamplesz(nT/4)totherightchanneloutput.Totestyourprogram,firstdriveyourbasebandshapingfilterwiththealternatingtwo-levelsymbolsequencea=(−1)nd.Thisalternatingsequenceiscalledadottingsequenceninthemodemjargon.Sendtheshapingfilteroutputsamplestotheleftchanneloutput,pipethemtotheclocktonegenerator,andsendtheclocktonegeneratoroutputsamplesto 202DigitalDataTransmissionbyPulseAmplitudeModulationtherightchanneloutput.Observetheleftandrightchanneloutputssimultaneouslyontheoscilloscope.Noticethatnωs(−1)=cosnT(11.47)2whicharesymbolratesamplesofacosinewavethathasafrequencyofhalfthesymbolrate.AccordingtoDSPtheory,thesampledsignalhasspectralcomponentsatthesetoffrequencies{ωs/2+kωs;k=−∞,...,∞}.Theshapingfilterwillpassthe2kHzcomponentandheavilyattenuatetheothercomponentsinthe[0,8)kHzband.Inotherwords,thePAMoutputsignalshouldbeveryclosetoa2kHzsinewave.Checkthatthetonegeneratoroutputisa4kHzsinewavelockedtothePAMsignal.Next,useatwo-levelpseudo-randomsymbolsequencehavingvalues±d.Usetheshiftregistergeneratortoselectthelevels.ObservethePAMsignalandclocktonegeneratoroutputsimultaneouslyontheoscilloscope.Theyshouldstillbelockedtogether.Commentonhowthetonegeneratoroutputlookscomparedtotheoutputwiththedottingsequence.Finally,usethefullfour-levelpseudo-randominputsymbolsequence.Observetheoutputoftheclockrecoverysystemontheoscilloscopeandcompareitwiththepreviouscases.11.7.3OptionalTeamExerciseIfyouareinterestedindoingmorewithPAM,teamupwithanadjacentgroup.MakeonesetupaPAMtransmitterandtheotheraPAMreceiver.Thisexerciseisnontrivialandshouldbeconsideredtobeequivalenttoacompletelabexperiment.Forsimplicityputalloftheraisedcosineshapinginthetransmitter.Transmitatwo-levelPAMsignal.Thetransmittedlevelsshouldbeselectedbytheoutputofthe23-stagescramblerdescribedinSection9.2.1withaninputof0.Makesuretheinitialscramblerstateisnon-zero.Again,usea4kHzsymbolrate.Connectthelineoutputofthetransmittertothelineinputofthereceiver.Samplethereceivedsignalat16kHz.Eventhoughthetransmitterandreceiverbothuseasamplingfrequencyof16kHz,therewillbeslightdifferencesduetosmallphysicalandtemperaturedifferencesintheoscillatorcrystalsandcircuitcomponents.Youwillhavetodeviseamethodforsynchronizingthesymbolclockinthereceivertothesymbolclockinthetransmitter.Thesamplingphaseofthecodeccannotbealtered,soyouwillhavetopassthereceivedsamplesthroughavariablephaseinterpolatorthatcompensatesforthephasedifferencebetweenthetransmitandreceiveclocks.VariablephaseinterpolatorsarediscussedinChapter12.Youcanlockthephaseofthereceiversymbolclocktothepositivezerocrossingsofthesymbolclocktonegenerator.Inadditionyouwillhavetocompensateforanydelaysinthesystemsothatsamplesaretakenatthesymbolinstants,thatis,atthepointwheretheeyehasitsmaximumopening.YoucouldalsoaddabasebandversionofaT/2spacedadaptiveequalizer.SeeChapter15foradiscussionofpassbandequalizers.Thefractionallyspacedequalizerwillautomaticallycompensateforafixedsymbolphaseoffsetbutnotforafrequencyoffset.Quantizetheselectedsymbolratesamplestoabinarysequence.Descramblethisse-quenceandcheckthattheoutputisall0’s.AddGaussiannoisetothereceivedsamplesintheDSPandmakeaplotofthebit-errorratevs.SNR. 11.8AdditionalReferences20311.8AdditionalReferencesForaverycompletediscussionofbasebanddigitaldatatransmissionbyPAM,seetheclassicbookbyLucky,Salz,andWeldon[II.D.29,Chapter4].AlsoseeGibson[II.D.9,Chapter8],Gitlin,Hayes,andWeinstein[II.D.11,Chapter4],LeeandMesserschmitt[II.D.26,Chapter6],andProakis[II.D.32,Chapter6].AllthesereferencesdiscussthebasicideaofPAM,basebandshapingfilters,intersymbolinterference,eyediagrams,Nyquist’scriterionfornoISI,raisedcosinepulses,andsymbolerrorprobabilityformulas.DiscussionsofinterpolationfilterbankscanbefoundinCrochiereandRabiner[II.C.4,Section3.3]andProakisandManolakis[II.C.15,Chapter10].AverythoroughanalysisofthesymbolclockrecoveryschemedescribedinthischapterispresentedinFranksandBubrouski[II.D.7].FurtherdiscussionsofthisschemeandotherscanbefoundinGitlin,Hayes,andWeinstein[II.D.11,Section6.5]andLeeandMesserschmitt[II.D.26,Chapter15]. Chapter12VariablePhaseInterpolationThereceiverinadigitalcommunicationsystemusuallyknowsthenominalsymbolrateusedbythetransmitter.Sincethereceiverisatadistancefromthetransmitter,hasslightlydifferentcomponents,andisatadifferenttemperature,thelocallygeneratedsymbolclockinthereceiverwilldifferinphaseandslightlyinfrequencyfromthetransmitter’sclock.Therefore,thereceivermustsynchronizeitssymbolclocktotheclockinthesignalreceivedfromthetransmitter.Itmustdothisjustusinginformationderivedfromthereceivedsignal.Somecodecsdesignedformodemfrontendshavebuilt-inhardwarecapabilityforchangingtheirsamplingphasebysmallincrementsasdirectedbycommandsfromtheDSPtheyareconnectedto.TheclocktonegeneratordiscussedinChapter11canbeusedtodeterminetheneededphaseincrements.ThecodecfortheTMS320C6713DSKdoesnothavethiscapabilityandrunswithafixedphase.Inthischapter,wewillseehowtoimplementthephaseshiftingintheDSPbyavariablephaseinterpolator.First,acontinuouslyvariablephaseshifterwillbepresented.Thenaphaseshifterusingfinequantizedstepswillbediscussed.AnotherproblemariseswhenthemodemoutputsamplesareconnecteddirectlytoadigitallinklikeaT1channelwherethesamplingrateisfixedat8kHzandisdifferentfromtherateneededforthemodeminputoroutputsampleswhichisamultipleofthesymbolrate.Wewillseehowtosolvethisproblembyusinganinterpolationfilterbanktoconvertbetweentwosamplingratesthatarerationallyrelated.12.1ContinuouslyVariablePhaseInterpolationLetx(t)beabandlimitedsignalwithcutofffrequencyωc,thatis,X(ω)=0for|ω|≥ωc.Letthesamplingratebeωs≥2ωcandsamplingperiodbeT=2π/ωs.ThesamplingfrequencyinHertzisfs=ωs/(2π)=1/T.Theidealimpulsesampledsignalis∞∗x(t)=x(nT)δ(t−nT)(12.1)n=−∞anditcanbeshowntheFouriertransformofx∗(t)isgivenbythealiasingformula∞∗X(ω)=fsX(ω−nωs)(12.2)n=−∞205 206VariablePhaseInterpolationAccordingtothesamplingtheorem,x(t)canbeexactlyreconstructedforanytfromitssamples{x(nT)}byapplyingx∗(t)toanideallowpassfilterwiththefrequencyresponse1/fs=Tfor|ω|0thesamplinginstantistoolateandtheadvancedishouldbereduced.Similarly,whene(nT)<0,thesamplinginstantistooearlyanddishouldbeincreased.Theincrementfordiisformedbyscalinge(iTb)byasmallpositiveconstantα.Theincrementsshouldbeasmallfractionofthesamplingperiodforaccurateclocktracking.Theincrementsarethensubtractedfromthepreviousvalueofdalongwithasecond-ordercorrectiontogetthenewinitialvalued˜i=di−1−αe(iTb)−γ(iTb)(12.19)whereγ(iTb)=βe(iTb)+γ((i−1)Tb)(12.20)Theaccumulatorgeneratingγ(iTb)adjustsforaconstantfrequencyoffsetjustasintheloopspresentedinChapters6,8,and15.Thepositiveconstantβshouldbe50to100timessmallerthanαforreasonabletransientresponse.Itisquiteimportanttohaveaverystablesymbolclockreferenceinhighspeedmodems.Theclockphaseshouldhavelittlejitter.InChapter14anonlinearfilter,calledarandomwalkfilter,isaddedtothesymbolclocktrackingloopforaQAMmodemtofurthersmooththeestimatedclockphase.Ifthetransmitterandreceiverclocksareexactlythesamefrequency,thevalueford˜ishouldhoveraroundaconstantvalue.Eachnewsamplingperiod,anewsampleofx(·)isshiftedintotheinterpolator’sFIRfilterandtheoutputforthedesiredvalueofd˜iiscomputed.Whenthereisafrequencyoffsetbetweenthetransmitterandreceiversymbolclocks,thevalueofd˜iwillslowlydriftinapositiveornegativedirection.Inthecontinuously 12.4ChangingtheSamplingRatebyaRationalFactor211variablephaseinterpolator,itsvaluewasrestrictedtotherange[−0.5,0.5).Whend˜ifallsoutsidethisrangesomecorrectiveactionmustbetaken.Wewillassumeitcanonlyfallasmalldistanceoutsidethisrange.Ifd˜i>0.5,thenormalsampleofx(·)shouldbeshiftedintotheFIRfilterdelaylineand,additionally,thenextnewsampleintimeshouldbeshiftedin.Then1shouldbesubtractedfromd˜i.Ifd˜i<−0.5,nonewsampleshouldbeshiftedintothedelaylineand1shouldbeaddedtod˜i.ThemodTboxinFigure12.1performsthiscorrectiveaction.Itgeneratesthefinalphaseadvancevaluediandinformstheinterpolatorifasampleshouldbeaddedordeleted.Asimilarstrategycanbeusedforthequantizedvariablephaseinterpolator.Itisconve-nienttouseanumberofsubfiltersthatisapoweroftwo,say,M=2J.Thesubfilterindexcanbestoredina32-bitintegerinaTMS320C67xxDSPwiththetopJbits,exclusiveofthesignbit,actuallyusedastheindex.Thephaseincrementscanbeaddedintothelowerbitsofthethewordwhichperformstheaccumulationandaveraging.WhentheupperJbitsfalloutsidetheallowedinterval,correctiveactionsimilartothatdescribedinthepreviousparagraphmustbetaken.12.4ChangingtheSamplingRatebyaRationalFactorAsituationarisesinmodemdesignwhereitisnecessarytouseinterpolationtochangefromonesamplingratetoanotherrationallyrelatedrate.Modemshavebeendesignedwheretheoutputsamplesarenotconvertedtoacontinuous-timesignalbutaresentdirectlyoveradigitalnetworkliketheInternettobypasstelephonecharges.SometimesaT1connectionisusedandthesampleshavetobeinterpolatedtoan8kHzsamplingrateandtransformedintoµora-law8-bitcodes.Forexample,themodemmightnormallyhaveasymbolrateof2400baudwiththreesamplesgeneratedpersymbolresultinginasamplingrateof7200Hz.Thenitisnecessarytointerpolatethesesamplestoan8000Hzrate.Theleastcommonmultipleof7200and8000is72000=10×7200=9×8000.Astandardapproachtoperformingthesamplingrateconversionistointerpolatethe7200Hzsamplesuptoa72000ratewithanFIRinterpolationfilterbankandthendown-samplebyafactorof9togetthe8000Hzsamples.Moregenerally,lettheinitialsamplingratebef1andthefinalratebef2.Supposetheratiooff1andf2whenreducedtolowesttermsisf1n1=(12.21)f2n2withn1andn2relativelyprime.Thentheintermediatesamplingrateshouldbef3=n2f1=n1f2(12.22)Intheexampleabove,n1=9andn2=10.Down-samplingthef3ratesequencebyafactorofn1givesthedesiredrateoff2.Thefirststepinchangingthesamplingratefromf1tof3istousethesamplingtheoremtoexpressthecontinuous-timesignalx(t)intermsofitsratef1samples.Thereconstruction 212VariablePhaseInterpolationformulais∞x(t)=x(kT1)h(t−kT1)(12.23)k=−∞wheresinπf1th(t)=(12.24)πf1tistheimpulseresponseofanideallowpassfilterwithcutofffrequencyf1/2andamplituderesponseT=1/f.Lettingt=nT+mT1gives111n2∞x(nT)=xnT+mT1=x(kT)hnT+mT1−kTm11n211n21k=−∞∞=x(kT1)hm(n−k)form=0,...,n2−1(12.25)k=−∞wheresubfiltermish(n)=h(nT+mT1)form=0,...,n−1(12.26)m1n22Thisformulashowshowtointerpolaten2pointsbetweeneachratef1samplestartingattimenT1togeneratetheratef3=n2f1sequence.TheapproachisthesameastheoneusedforimplementingthebasebandshapingfilterdiscussedinSection11.3.Foreachm,xm(nT1)isgeneratedbyadiscrete-timefilteroperatingwithsamplingratef1.TheinterpolationformulaisillustratedinFigure12.2asabankofn2filters.x0(nT1)h0(nT1)x1(nT1)h1(nT1)x(nT1)...xn2−1(nT1)hn2−1(nT1)Figure12.2:InterpolationFilterBankThenextstepistodownsampletheratef3sequencebyafactorofn1togetthedesiredratef2sequence.Supposetheoutputofsubfiltermischosenfromthen2subfilteroutputsgeneratedattimenT1.Thenextsamplethatshouldbeselectedistheoutputofsubfilterm+n1ifm+n10vˇ(n)=signv(n)=0forv(n)=0(14.19)⎪⎩−1forv(n)<0ThehardlimitingprovidesasimpleAGCactionthatkeepstheloopgainconstantinde-pendentoftheinputsignallevel.Thissignalisthenpassedthroughthesamekindofsecond-orderloopfilterasshowninFigure14.3resultinginthesignalˇp(n).Theoutputofthesecond-orderloopfilteristhenappliedtotherandomwalkfilter.Therandomwalkfilterisbasicallyanaccumulatorthatgetsresetwhenitsoutputexceedsapositiveornegativethreshold.Therandomwalkfilteraccumulatoroutputisy(n)=x(n)+ˇp(n)(14.20) 238QAMReceiverI–ClockRecoveryandOtherFront-EndSubsystemsGodardαv(n)ˇv(n)HardTimingToneLimiterγˇ(n)Generator+β+z−1pˇ(n)Advance/RetardPhaseControlThresholdy(n)+Detector+−+z−1q(n)x(n+1)x(n)RandomWalkFilterFigure14.4:IncludingaRandomWalkFilterintheClockTrackingLoopwherex(n+1)=y(n)−q(n)=x(n)+ˇp(n)−q(n)(14.21)Thesignalq(n)isgeneratedbytheThresholdDetectorandiszeromostofthetime.Whentheaccumulatoroutputy(n)exceedsthethresholdsofLor−L,theaccumulatorvalueisresetandthesamplingphaseoftheADCorvariablephaseinterpolatorisadvancedorretarded.Aslongastheaccumulatoroutputremainsbetweenthethresholds,thesamplingphaseisnotchanged.Thissignificantlyreducesclockjitter.TheexactrulesdescribingtheThresholdDetectorandaccumulatorare:⎧⎪⎨0for|y(n)|1andnoadditivechannelnoise,thisspectrumiszerooveraregionaroundhalfthesamplingrate.WhenRissingular,thenormalequation(15.18)doesnothaveauniquesolutionforthetapvectorsincethesumofanysolutionandavectorinthenullspaceofRisanothersolutionandallsolutionshavethesamemean-squarederror.Inpractice,thetapscanslowlydriftasaresultofcomputationalbiaseswhilethemean-squarederrorremainssmall.Whenatapgetstoolargeforitsfinite-word-lengthhardwarerepresentationandoverflows,thesystemcrashes.AsolutiontothisproblemistomodifytheLMSalgorithmtoincludetapleakage.Themodifiedtapadjustmentalgorithmishm(n+1)=(1−γ)hm(n)+µe+(nT)r+(nT−mT/n1)form=0,...,N−1(15.30)whereγisasmallpositiveconstant.Thus,witheachiteration,thecurrenttapvalueisshrunkslightlybeforeaddingtheestimatedgradientincrement. 15.2ThePhase-SplittingFractionallySpacedEqualizer24915.2ThePhase-SplittingFractionallySpacedEqual-izer++···+σR(nT/n0)hR,0hR,1hR,2hR,N−1r(nT/n0)σ+(nT)Downz−1/n0z−1/n0···z−1/n0SamplerhI,0hI,1hI,2hI,N−1σI(nT/n0)++···+Figure15.3:ThePhase-SplittingFractionallySpacedEqualizerThephase-splittingfractionallyspacedequalizershowninFigure15.3iscommonlyusedincurrenttelephonelinemodems.MuellerandWerner[II.D.30]observedthattherealandimaginaryoutputsofthecascadeoftheHilberttransformFIRfilterandcomplexcross-coupledequalizerarelinearcombinationsoftheinputsamplestotheHilberttransformfilter.Therefore,theysuggestedcombiningthetwofunctionsintothestructureshowninFigure15.3.Thephase-splittingequalizeriscomputationallymoreefficientthanthecomplexcross-coupledequalizerbecausethecomplexproducts,whichrequirefourrealmultiplications,arereplacedbytworealproducts.LingandQureshi[II.D.27]showthatthepricepaidisslowerconvergence.Whenthephase-splittingequalizerisused,theHilberttransformfiltershowninthereceiverfrontendblockdiagramonpage230isremovedandthesignalr(nT0)isconnecteddirectlytotheequalizerinput.Theinputsamplingratef0=1/T0mustbeatleasttwicetheuppercutofffrequencyofthereceivedsignaltosatisfytheSamplingTheorem.Asusual,wewilluseTtodenotethesymbolperiodandfs=1/Ttodenotethesymbolrate.ItisconvenienttoletT0=T/n0,andthenf0=n0fs.Forexample,aV.32modemusesacarrierfrequencyoffc=1800Hz,asymbolrateoffs=2400Hz,andsquare-rootofraisedcosineshapingwithα=12%excessbandwidthresultinginanuppercutofffrequencyofabout3144Hz.Therefore,aconvenientchoiceistoletn0=3resultinginasamplingrateoff=7200Hz.Thez−1/n0blocksinFigure15.3representdelaysofT.00Theoutputoftheupperfilterinthephase-splittingequalizerattimenTisN−1σR(nT)=e{σ+(nT)}=hR,kr(nT−kT/n0)(15.31)k=0andtheoutputofthelowerfilterattimenTisN−1σI(nT)=m{σ+(nT)}=hI,kr(nT−kT/n0)(15.32)k=0 250QAMReceiverII–EqualizerandCarrierRecoverySystemTherefore,theoutputoftheDownSamplerblockisN−1σ+(nT)=σR(nT)+jσI(nT)=hkr(nT−kT/n0)(15.33)k=0wherethecomplexequalizertapsaredefinedtobehk=hR,k+jhI,kfork=0,...,N−1(15.34)Noticethatthecomplextapvaluehkismultipliedbytherealdatasampler(nT−kT/n0)whichrequiresonlytworealproducts.Ontheotherhand,acomplextapismultipliedbyacomplexdatasampleinthecomplexcross-coupledequalizerandthisrequiresfourrealproducts.Theequalizedpassbandsamplesσ+(nT)areprocessedinexactlythesamewayasshowninthebottomhalfofFigure15.2.Eachsampleisdemodulatedtobasebandandquantizedtothenearestconstellationpoint.Thebasebanderror˜(nT)isformedusingtheidealreferencesequenceorslicerdecisionandremodulatedtothepassbanderror+(nT).Asinthecaseofthecomplexcross-coupledequalizer,thetapvaluescanbechosentominimizethemean-squaredbasebandorpassbanderrordefinedby(15.6).Usingthesameapproachasbefore,itcanbeshownthatthederivativesofΛwithrespecttothetapvaluesare∂Λ=−2E{e[+(nT)]r(nT−mT/n0)}form=0,...,N−1(15.35)∂hR,mand∂Λ=−2E{ m[+(nT)]r(nT−mT/n0)}form=0,...,N−1(15.36)∂hI,mThus,∂Λ∆∂Λ∂Λ=+j=−2E{+(nT)r(nT−mT/n1)}form=0,...,N−1(15.37)∂hm∂hR,m∂hI,mThesederivativessuggestusingthefollowingLMSalgorithmwithtapleakageforadapt-ingthetaps:hm(n+1)=(1−γ)hm(n)+µ+(nT)r(nT−mT/n0)(15.38)whereγisasmallpositiveleakageconstantandµisasmallpositiveupdatescalefactor.Intermsoftheindividualtapcomponents,thisformulaisequivalenttohR,m(n+1)=(1−γ)hR,m(n)+µe{+(nT)}r(nT−mT/n0)(15.39)andhI,m(n+1)=(1−γ)hI,m(n)+µm{+(nT)}r(nT−mT/n0)(15.40)Noticethatthecomplexpassbanderrorismultipliedbyarealdatasampletoupdatethecomplextapandthisrequirestworealproducts.Inthecomplexcross-coupledequalizer,thecomplexerrorismultipliedbyacomplexdatasampleandthisrequiresfourrealproducts.AblockdiagramforLMSupdatingofthephase-splittingequalizertapswouldbeverysimilartoFigure15.2.Themaindifferencewouldbethatthecomplexsignalr+(nT−mT/n1)wouldbereplacedbytherealsignalr(nT−mT/n0)sothecomplexT/n1spaceddelaylinewouldbecomearealT/n0spaceddelayline.The(complex×complex)productsinvolvingr+(·)forupdatingthetapsandcomputingtheequalizeroutputwouldbereplacedby(real×complex)productsinvolvingr(·).Also,thetapleakageisnotshowninFigure15.2. 15.3DecisionDirectedCarrierTracking25115.3DecisionDirectedCarrierTrackingUptothispoint,ithasbeenassumedthatthecarrierphaseisknownexactly.Anapproachtoestimatingandtrackingthecarrierphasecanbemotivatedbyminimizingthemean-squarederrorΛwithrespecttotheparametersofthephasesequencegeneratedbythereceiver’sCarrierRecoveryblock.Supposethissequencehastheformϕn=ωcnT+θ(15.41)whereωcisthecarrierfrequencyandθisafixedunknownphaseoffset.ReplacinghR,mbyθin(15.8),wefindthatthederivativeofthemean-squarederrorwithrespecttothephaseoffsetis∂Λ∂˜(nT)=2Ee˜(nT)(15.42)∂θ∂θRememberthatthebasebanderroris−j(ωcnT+θ)˜(nT)=cn−nd−σ˜(nT)=cn−nd−σ+(nT)e(15.43)Therefore,∂Λ−j(ωcnT+θ)=2Ee˜(nT)jσ+(nT)e=−2Em˜(nT)˜σ(nT)(15.44)∂θOnreplacing˜(nT)bycn−nd−σ˜(nT),thefollowingalternativeformulaforthederivativeisobtained:∂Λ=−2E{ m[cn−ndσ˜(nT)]}(15.45)∂θThisderivativehasaninterestingphysicalinterpretation.Letjβcjβσcn−nd=Rceandσ˜(nT)=Rσe(15.46)bethepolarformrepresentationsforthesetwocomplexnumbers.Rememberthattheequalizedbasebandoutputsample˜σ(nT)issupposedtobeacloseapproximationtotheidealsymbolcn−nd.Thenm[cn−ndσ˜(nT)]=RcRσsin(βσ−βc)(15.47)som[cn−ndσ˜(nT)]sin(βσ−βc)=(15.48)RcRσThishasthesamesignasthephaseerrorbetweentheidealconstellationpointcn−ndandtheequalizedbasebandreceivedpoint˜σ(nT)ifthephaseerrorisnottoolarge,andisnearlyalinearfunctionoftheerrorforsmallphaseerrors.Thisphaseerrormeasurecanbeusedinaphase-lockedlooptoiterativelyadjustθsothebasebandequalizedpointsarealignedinanglewiththeidealconstellationpoints.Changingθbysomeanglehastheeffectofrotatingthebasebandequalizedpointsbythenegativeoftheangle.Inpractice,cn−ndand˜σ(nT)becomeclosewhentheequalizerconvergessoRσ 252QAMReceiverII–EqualizerandCarrierRecoverySystemσ˜(nT)Slicercˆn−ndIdealReferencecn−nd1|·|2−+˜(nT)(·)×m(·)×ωcTϕˆnϕˆn+1z−1++k1∆θ(n)ψ(n)+k2z−1ψ(n−1)Figure15.4:DecisionDirectedCarrierTrackingSystemcanbereplacedbyRcin(15.48).Theseobservationssuggestadjustingθaccordingtotheformulam{˜(nT)˜σ(nT)}θ(n+1)=θ(n)+k1(15.49)|cn−n|2dwherek1isasmallpositiveconstant.Apracticalrealizationforasecond-ordercarriertrackingloopbasedonthisequationandincludingcarrierfrequencyoffsettrackingisshowninFigure15.4.First,anapproximationtothephaseerroriscomputedfromthebasebandequalizeroutputsample˜σ(nT)bytheformulam{˜(nT)˜σ(nT)}∆θ(n)=(15.50)|cn−n|2dDuringinitialstartup,aknownsymbolsequenceisoftentransmittedandtheIdealReferencegeneratorinthereceiverreplicatesthesesymbols.Aftertheequalizerandcarriertracking 15.4BlindEqualization253loophaveconverged,theoutputsoftheSliceraresubstitutedfortheknownsequenceandthesystemoperatesinthedecisiondirectedmode.Thephaseestimategeneratedbythelowerpartoftheblockdiagramisϕˆn+1=ˆϕn+ωcT+k1∆θ(n)+ψ(n)(15.51)whereψ(n)=ψ(n−1)+k2∆θ(n)(15.52)NoticethatωcTisthenominalchangeinthecarrierphaseanglebetweensymbols.When∆θ(n)iszeroforallnandthez−1delayelementsareinitiallycleared,thephasegeneratedisϕˆn=ωcnT(15.53)Thephilosophybehindthecarriertrackingloopistoincrementthephaseanglepredictedforthenextsymbolinstant,ˆϕn+ωcT,byasmallfraction,k1,ofthecurrentphaseerrorestimate∆θ(n).Inaddition,afraction,k2,ofthephaseerrorisaccumulatedtomeasureanybiascausedbyafrequencyoffset,andaddedtothephaseincrement.Thesystemisasecond-orderphase-lockedloopsimilarinbehaviortotheonesdiscussedinpreviouschapters.Itwilltrackaconstantphaseandfrequencyoffsetwithzerofinalerror.Theratiok1/k2shouldbeintheorderof100forgoodtransientresponse.15.4BlindEqualizationInmostcases,theadaptiveequalizerinaQAMreceiverisinitiallytrainedduringhandshak-ingwithaknownidealreferencesequence.Therearetimeswhenidealreferencetrainingisnotpossibleordesirable.Forexample,ifatributarymodeminamulti-dropnetworkgoesofflinebecauseofapowerfailureorforrepairs,itwouldbedesirabletobringthemodembackonlinewithouthavingtoretrainallthetributarymodemsonthenetwork.Withasimpleconstellationlikethefour-phaseV.22constellation,itissometimespossibletoachieveequalizationusingthedecisiondirectedmode.However,with16ormorecon-stellationpoints,startingLMSadaptationinthedecisiondirectedmodealmostalwaysfailswithtypicalchannels.Avarietyofalgorithmscalledblindequalizationhavebeendiscoveredthatuseonlyverygeneralknowledgeofthetransmittedconstellationandnottheexacttransmittedsequence.ThesealgorithmsconvergemuchslowerthantheLMSalgorithmwithidealreferencetrainingandthefinaloutputconstellationremainsfuzzy,buttheun-derlyingidealconstellationbecomesclearlyapparent.Aftertheconstellationemergeswithblindequalization,theequalizercanbeswitchedtoLMSdecisiondirectedtrainingforfineequalization.BlindequalizationwasfirstdisclosedbySato[II.D.33]in1975forthespecialcaseofone-dimensionalmultilevelPAM.Godard[II.D.14]in1980wasthefirsttodiscloseandthoroughlyanalyzeaclassofblindequalizationalgorithmsforQAM.TreichlerandAgeeindependentlydevelopedasimilarapproachintheclassifiedworldandtheirworkwaspublishedintheopenliteraturein1983[II.D.37].Thismethodhasbecomeknownastheconstantmodulusalgorithm(CMA).AnotherapproachispresentedbyBenvenistein[II.D.2]andiscalled 254QAMReceiverII–EqualizerandCarrierRecoverySystemareducedconstellationalgorithm(RCA).ItisageneralizationofSato’smethodtotwodimensions.Seethelastsectioninthischapterforadditionalreferences.Godard’s2ndorderblindequalizationalgorithmistheonemostcommonlyusedincom-mercialmodems.Jablon[II.D.24]experimentallycomparedthis2ndorderCMAalgorithmwiththeRCAalgorithmandconcludedthattheCMAalgorithmconvergesfasterwhencar-rierphaseandsymboltimingarealsobeingestimated.OnlyGodard’salgorithmwillbepresentedinthischapter.Godard’sclassofCMAalgorithmsoperatesdirectlyonthepassbandequalizeroutputσ+(nT)showninFig.’s14.1,15.1,and15.3.TheequalizertapsareadjustedtominimizethedispersionoforderpwhichisdefinedasDp=E(R−|σ(nT)|p)2(15.54)p+wherepisapositiveintegerandRpisapositiveconstantforwhichaformulawillbegivensoon.Sincethedemodulatedequalizeroutputis˜σ(nT)=σ(nT)e−jφn,thedispersioncan+alsobeexpressedasDp=E(R−|σ˜(nT)|p)2(15.55)pNoticethatthedispersionisindependentofthelocallygeneratedcarrierphase.There-fore,theconstellationcanemergerotatedbyanyangleasthealgorithmconverges.Thejobofthecarrierrecoveryloopistorotateittothecorrectangle.Thecarrierrecoveryloopiseffectivelyaone-tapcomplexequalizerwiththetapconstrainedtohavemagnitude1.Anequalizerwithasmallnumberoftapscanadaptfasterthanonewithmanytaps,sothecarrierrecoveryloopcanconvergemuchfasterthantheequalizer.ThefactthattheCMAalgorithmdoesnothavetorotatetheconstellationtothecorrectanglemayaccountforthebetterperformanceJablonobservedfortheCMAalgorithmovertheRCAalgorithm.15.4.1BlindEqualizationwiththeComplexCross-CoupledEqual-izerTheequalizertapscanbeadaptediterativelybytakingsmallstepsinthedirectionoppositetothegradientofDpwithrespecttothetaps.Withsomework,itcanbeshownthatinthecaseofthecomplexcross-coupledpassbandequalizer∂Dp∂Dp∂Dp∆=+j∂hm∂hR,m∂hI,mpp−2=−2pE(Rp−|σ+(nT)|)|σ+(nT)|σ+(nT)r(nT−mT/n1)(15.56)GodardshowsthatthevalueofRprequiredtogivethecorrectconstellationsizeisE{|c|2p}nRp=(15.57)E{|cn|p}Rememberthatcnisthebasebandsymbolsequencerandomlyselectedfromtheidealcon-stellation. 15.4BlindEqualization255Thestatisticalexpectationin(15.56)isnotknowninpracticebutcanbeapproximatedbytimeaveragingtheproductinsidetheexpectationoperator.Thisleadstothefollowingstochasticgradientalgorithmforadaptingtheequalizertaps:pp−2hm(n+1)=hm(n)+µ(Rp−|σ+(nT)|)|σ+(nT)|σ+(nT)r(nT−mT/n1)form=0,...,N−1(15.58)whereµisasmallpositiveconstantasintheLMSalgorithm.Evenafterconvergence,thetermR−|σ(nT)|pintheestimatedgradientwillfluctuatep+significantlyandtheblindequalizedconstellationwillbesomewhatfuzzy.TheconstantµmustbechosensignificantlysmallerfortheCMAalgorithmthanfortheLMSalgorithm.Aftertheequalizerconvergeswiththeblindequalizationalgorithm,aswitchtodecisiondirectedLMStrainingcanbemadetoachievepreciseequalization.Themostcommonlyimplementedalgorithmisthep=2case.Then,thetapupdateformulareducesto2hm(n+1)=hm(n)+µRp−|σ+(nT)|σ+(nT)r(nT−mT/n1)form=0,...,N−1(15.59)andtherequiredvalueofR2isE{|c|4}nR2=(15.60)E{|cn|2}ThecomputationalcomplexityforthisadaptationalgorithmisessentiallythesameasfortheLMSalgorithm.Inbothcases,anerrorsignalismultipliedbythecomplexconjugateofthereceivedsignalsampleatthetapbeingadjusted.Inthiscasetheerrorsignalis2(n)=Rp−|σ+(nT)|σ+(nT)(15.61)GodardderivessomeconvergencepropertiesfortheCMAalgorithms.Letg(0)bethechannelimpulseresponsesamplewiththelargestmagnitude.Thenforthep=2case,asufficientbutnotnecessaryconditionforconvergenceisthatalltheequalizertapsbeinitiallysettozeroexceptforthereferencetapatsomepositionLnearthecenterofthedelayline.ThistapmustsatisfytheinequalityE{|c|4}2n|hL|>2(15.62)2|g(0)|2(E{|cn|2})15.4.2BlindEqualizationwiththePhase-SplittingEqualizerTheCMAalgorithmforthephase-splittingequalizerisalmostidenticaltotheoneforthecomplexequalizer.Itcanbeshownthatthegradientofthedispersionwithrespecttotapmforthephase-splittingequalizeris∂Dp∂Dp∂Dp∆=+j∂hm∂hR,m∂hI,mpp−2=−2pE(Rp−|σ+(nT)|)|σ+(nT)|σ+(nT)r(nT−mT/n0)(15.63) 256QAMReceiverII–EqualizerandCarrierRecoverySystemThissuggeststhefollowingstochasticgradienttapadjustmentformula:pp−2hm(n+1)=hm(n)+µ(Rp−|σ+(nT)|)|σ+(nT)|σ+(nT)r(nT−mT/n0)form=0,...,N−1(15.64)ThevaluerequiredforRpisagainspecifiedby(15.57).Forp=2,thetapupdateformulareducesto2hm(n+1)=hm(n)+µRp−|σ+(nT)|σ+(nT)r(nT−mT/n0)form=0,...,N−1(15.65)Atthestartofblindequalization,therealtapsshouldallbesettozeroexceptforthereferencetapatpositionL.TheimaginarytapsshouldbesettoapproximateaHilberttransformwiththereferencetapatpositionL.Thescalingshouldbeadjustedtosatisfytheconvergenceconditionforthecomplexequalizer.15.5ComplexCross-CoupledEqualizerandCarrierTrackingLoopExperimentsNowitistimetocompletetheQAMreceiveryoubeganinChapter14bybuildinganadaptiveequalizerandcarriertrackingloop.Besuretousethemaximumcompileroptimizationlevel.Youwillbedirectedthroughastep-by-stepapproachtocompletingthereceiver.First,youwillmakea4-pointand,optionally,a16-pointslicer.Thenyouwillmakethecarriertrackingloopwiththeequalizerbypassed.Oncethecarrierloopisoperating,youwillbuildacomplexcross-coupledequalizer.Finally,youwillmakethedescramblerandcheckthatall1’sarereceivedwhentheyaretransmitted.Optionally,youcanimplementthephase-splittingpassbandequalizeraftersuccessfullycompletingthecomplexequalizer.Youcanalsoexperimentwithblindequalization.Thisisalongexperimentinvolvingtheimplementationofanumberofsubsystems.Itwouldbereasonabletoteamupwithoneormoreothergroupsandworkjointlyonthisexperiment.Youwillhavetodecidehowtopartitionthetasksamongtheteammembers,makesuretheprogramsfittogether,andmanagetheprogressofsubgroups.Thesearethingsyouwillhavetodoasanengineeronaproductdesignanddevelopmentteaminindustry.ContinuetousethemodifiedV.22bistransmitteryoumadeforChapter13asthesignalsource.ProgramthetransmittertoinitiallysendtheS1alternatingsequencedescribedinitem8ofSection13.5.2for1000symbols(1second)toallowthesymbolclockrecoverylooptolockup.Thencontinuouslysendscrambled1’susingthe4-pointV.22constellation.Optionally,aftersending4000(4seconds)4-pointsymbols,switchtosendingscrambled1’susingthe16-pointV.22bisconstellationshowninFigure13.3.15.5.1ImplementingtheSlicerTheSliceroutputsarerequiredtogeneratethebasebanderrorsequenceusedbyboththeadaptiveequalizerandcarriertrackingloopinthedecisiondirectedmode.Therefore,thefirstlogicalstepincompletingtheQAMreceiveristoimplementtheslicers. 15.5ComplexCross-CoupledEqualizerandCarrierTrackingExperiments257Makingthe4-PointSlicerTheV.22constellationconsistsofthe4pointsshowninFigure13.3withthecoordinates(3,1),(−1,3),(−3,−1),and(1,−3).Thesepointslieonacircleandareseparatedby90◦butarerotatedbyanoddanglerelativetotheaxes.Makea4-pointslicertoquantizeeachbasebandequalizeroutputsampletothenearestidealconstellationpoint.Tosimplifythequantizationoperation,rotatethereceivedbasebandsamples˜σ(nT)=xn+jynsothattheidealpointslieon45◦lines.Youcandothisbyusingthetransformationxn+jyn=(xn+jyn)(2+j)=(2x−y)+j(x+2y)(15.66)Thistransformationrotatestheidealpointstothenearest45◦lineandscalesthemtothefourpoints±5±j5.Thentheslicingoperationamountstodeterminingwhichquadrantthetransformedpointliesin,andthiscanbedeterminedbysimplyexaminingthesignbitsofxandy.nnInyourslicerfunction,alsodothefollowingtasks:1.Formtheunrotatedbasebanderror˜(nT)=cn−σ˜(nT)wherecnistheunrotatedidealconstellationpointcorrespondingtotheslicerdecision.2.Generateandstorethedifferentiallyencodeddatabits(Y1n,Y2n).3.DifferentiallydecodethedatabitsbyusingtheinverseofTable13.1.TestyourslicerbyusingCodeComposerStudiotosingle-stepthroughyourcodewithamadeupsequenceofbasebandinputsamples.Makingthe16-PointSlicerAsanoptionaltask,makea16-pointslicerfortheV.22bisconstellation.Theslicershouldquantizethebasebandequalizeroutputsampletothenearestidealconstellationpoint.Theslicerprogramshouldcontainatablethathasarecordforeachofthe16constel-lationpoints.Eachrecordshouldincludethecoordinatesoftheidealpoint,thedatabits(Y1,Y2,Q3,Q4)associatedwiththepoint,andthequantity1/|c|2foruseinthecarriernnnnntrackingalgorithm.Inaddition,theslicershouldperformthefollowingtasks:1.Formthebasebanderror.2.Generateandstorethedifferentiallyencodedbits(Y1n,Y2n).3.DifferentiallydecodethedatabitsbyusingtheinverseofTable13.1.TestyourslicerbyusingCodeComposerStudiotosingle-stepthroughyourcodewithamadeupsequenceofbasebandinputsamples. 258QAMReceiverII–EqualizerandCarrierRecoverySystem15.5.2MakingaDemodulatorandCarrierTrackingLoopAsthenextstepinbuildingtheQAMreceiver,implementthedemodulatorandcarriertrackingsystemshowninFigures14.1and15.4.Designyoursoftwaretoincludea16-tapT/2complexcross-coupledequalizer.Toreducetheinteractionbetweensubsystemsfordebuggingpurposes,effectivelybypasstheequalizer.Todothis,setupthenecessarycircularbufferstoholdthecomplexpassbandsamplesfortheequalizerdelaylinecomingfromthefrontendphasesplitterandcreatethearraysforthecomplexequalizercoefficientsh0,...,h15.Setalltheequalizercoefficientsto0+j0exceptmakeh8=1+j0.Implementtheequalizerconvolutionsumwiththetapsfrozenatthesevaluessotheequalizerinputsampleswillsimplybepassedtoitsoutputwithadelay.AlwaysloadsamplesfromthephasesplitterintotheequalizerdelaylineregardlessofwhetherornottheCarrierDetectsystemindicatesthepresenceofareceivedmodemsignal.TheGodardclockrecoverysystemimplementedinChapter14shouldmakethetimesatwhichitscross-correlatoroutputsarecomputednearlyoptimumtimesatwhichtosamplethereceivedsymbols.Theequalizeroutputshouldbecomputedatthesesymbolspacedtimes.MonitortheCarrierDetectsignalgeneratedbythereceiverfrontendandwhenacarrierisdetectedbeginincrementingacounteroncepersymbolperiod.Keepthe2ndorderaccumulatorstatevariableψ(n−1)storedinthez−1blockshowninFigure15.4cleareduntilthecountreaches1008.Atthistime,theS1sequenceshouldbefinishedandtheequalizerdelaylineshouldbefilledwithreceivedsamplesofthe4-pointscrambled1’ssignal.Inthispartoftheexperiment,theequalizertapsshouldbefrozenattheinitialvaluesspecifiedaboveindependentoftheCarrierDetectsignal.Writeaprogramtoimplementthecarriertrackingloop.Beforeareceivedmodemsignalisdetected,letthecarrierloopphasefreerun.Thatis,letk1=k2=ψ(n−1)=0sothatϕˆn+1=ˆϕn+ωcT(15.67)Totestyourprogram,scaleandconverttherealandimaginarypartsofthebasebandequalizedsample˜σ(nT)into16-bitintegers.SendthispairofintegerstoleftandrightcodecDACchannelstocreateaconstellationdisplay.AlwaysmakeaconstellationdisplayindependentofthestateoftheCarrierDetectsignal.Ifeverythingisworkingproperly,youshouldobservefourdistinctcloudsofpointsseparatedby90◦ontheconstellationdisplay.Youwereinstructedabovetomakealltheequalizertapszeroexceptforh8.Itispossiblebecauseofasampledelayunaccountedforinyourprogramthatthisisthewrongtaptopickasatimereferenceandyourconstellationdisplaysamplesarebeingtakenhalfwaybetweenthecorrectsamplinginstants.Inthiscase,youprobablywillnotobservefourdistinctcloudsofpoints.Inanycase,testforthebestsamplingtimebysettingh7to1+j0andalltherestofthetapstozero.ThisadvancesthesamplinginstantsbyT/2.Observetheresultingconstellationdisplay.Intherestofthisexperiment,usetheinitialequalizertapsettingthatgivesthebestresults.Oncethecarriertrackingloopisbasicallyworking,experimentusingdifferentvaluesofk1andk2.Whenk1islarge,theconstellationwillappeartojitterduetothelargerandomperturbations.Whenk1isverysmall,convergencewillbeslow. 15.5ComplexCross-CoupledEqualizerandCarrierTrackingExperiments25915.5.3MakingaComplexCross-CoupledAdaptiveEqualizerNowimplementtheLMSwithleakageequalizertapadaptationalgorithmdefinedby(15.30).KeepthetapsfrozenattheirinitialvaluesuntiltheCarrierDetectcountreaches1008symbolsbymakingγandµzerountilthistime.Thenturnontheupdatealgorithmbysettingµtoasmallnumberlike0.001.Theleakageconstantγshouldbeverysmallsotheapproximategradientupdatessignificantlyoutweighthetapreductionbythefactor1−γ.Observetheequalizerconvergenceonyourconstellationdisplay.Iftheequalizerandcarriertrackingloopareworkingproperly,thecloudscausedbyintersymbolinterferenceshouldconvergetofourtightpoints.Experimentwithseveralvaluesoftheupdateconstantµandobservetheconvergencespeedandtightnessofthesteady-stateconstellation.15.5.4Bit-ErrorRateTestOncetheequalizerandcarriertrackingloopareworking,addthedescramblertoyourre-ceiver.Thedescrambleroutputshouldbesteady1’s.Tocheckthis,youcanwritethedescrambledbitstoanarrayanduseCodeComposerStudiotoexaminethearraywhenyouhalttheDSPprogram.AprobepointcannotbeusedbecauseithaltstheDSPwhileread-ingsotheprogramdoesnotruninreal-time.YoucanalsousetheconverterboxdesignedfortheRS232experimentsandsendthedescrambledbitstreamoutthroughMcBSP0inreal-time.AddGaussiannoisesamplestotheADCinputsamplesusingthemethodpresentedinAppendixA.ObservethedispersionoftheconstellationcausedbythenoisefordifferentSNR.Experimentally,generateaplotofthebit-errorratevs.SNR.Dothisbywaitinguntiltheequalizerhasconvergedandthencountingthenumberof0’sinthedescrambledbitstreamforafixeddurationateachSNR.Makesurethecountdurationislongenoughtogiveastatisticallyreliableestimateofthebit-errorrate.Deriveatheoreticalformulaforthesymbolerrorprobabilityvs.SNRandplottheresults.Comparethisplotwithyourexperimentalbit-errorrateplot.Thegeneralshapeshouldbethesamebutthecurveswillbedifferentbecauseoneisforsymbolerrorsandtheotherisforbiterrors.Also,theself-synchronizingdescramblergeneratesthreeoutputbiterrorsforeachisolatederrorinitsinputbitstream.15.5.5OptionalExperiment–Receivingthe16-PointV.22bisCon-stellationAsanoptionalexperiment,programthetransmittertosendtheS1sequencefor1000sym-bols,followedbythe4-pointconstellationforscrambled1’sfor4000symbols,followedbythe16-pointconstellationforscrambled1’sindefinitely.Useacounterasabovetostarttheequalizerandcarriertrackingloop1008symbolsaftercarrierdetectionusingthe4-pointslicer.Afteranadditional4400symbols,switchtothe16-pointslicer.Ifyourtimingisoffbyafewsymbols,itshouldhaveanegligibleeffectwhenthecarriertrackingloopandequalizerupdateconstantsaresmall. 260QAMReceiverII–EqualizerandCarrierRecoverySystemPerformabit-errorratetestforthe16-pointconstellationandplottheresults.Comparetheplotsforthe4and16-pointconstellations.Findintheliteratureorderiveatheoreticalformulaforthesymbolerrorrateandplottheresults.Comparetheresultsforthe4and16-pointconstellations.15.5.6OptionalExperiment–IdealReferenceTrainingYouweredirectedtosetthescramblertotheall0stateatthestartofscrambled1’stransmission.Thereforethetransmittedtrainingsequenceisknownandidealreferencetrainingcanbeperformed.Makeareplicaofthescramblerandconstellationpointselectorinthereceiver.About1000symbolsaftercarrierdetect,startgeneratingtheidealreferencesymbolsequenceanduseittotraintheequalizerandcarrierloop.Initializealltheequalizertapstozeroforidealreferencetraining.Oncetheequalizeristrained,haltthereceiverandexaminetheequalizertapmagnitudesusingCodeComposerStudio.Adjustthetimeatwhichyoustarttheidealreferencetrainingtocenterthelargesttapintheequalizerdelayline.Ifyourinitialtimingphaseistoofaroff,themaintapwillwanttobeoffoneendortheotherofthedelaylineandtheequalizerwillnotconverge.Aftertheequalizerhasconverged,switchbacktodecisiondirectedadaptation.Oneofthevirtuesofafractionallyspacedequalizeristhatitcanadjustforanysymboltimingphaseoffset.StarttheidealreferencetrainingT/2seconds(halfasymbolperiod)laterthanbeforeandobservethesystemconvergence.15.6OptionalPhase-SplittingFractionallySpacedEqualizerExperimentIfyouareinterestedinpursuingadaptiveequalizersfurther,buildaphase-splittingfraction-allyspacedequalizerforthemodifiedV.22bisreceiver.Firststripthephasesplitteroutofthereceiverfrontend.Continuetousethesamplingratef0=8fs=8000Hz.Then,thephase-splittingequalizermustbeaT/8equalizer.The16-tapT/2complexcross-coupledequalizerspanseightsymbols.AT/8phase-splittingequalizermusthave8×8=64com-plextapstospaneightsymbols.However,rememberthatthecomplexequalizermustbeprecededbyaHilberttransformfilterwhichgivesthecascadealongermemoryspan.Inanycase,makea64complextapphase-splittingequalizer.Thecarriertrackingloopandslicerdonothavetobechangedfromthepreviousdesign.Theequalizertapsmustbeinitiallysettomakeitaphasesplitterwhenthedecisiondirectedstartupmodeisused.Dothisbyinitiallysettingalltherealtaps{hR,n}tozeroexceptforonenearthecenterofthedelaylinewhichshouldbesetto1.Designa63-tapHilberttransformfilterusingremez87.exeorwindow.exeandsettheimaginarytaps{hI,n}tothesevalues.AlignthecentertapoftheHilberttransformfilterwiththenonzerorealtap.Thepositionyoupickfortheinitialmaintap(theonewithrealpartequalto1)maynotgivetheoptimumsamplingphase.Thereare8choicesforthesymbolspacedsamplingphase.DeterminetheoptimumphaseinawaysimilartowhatyoudidfortheT/2complex 15.7OptionalBlindEqualizationExperiment261equalizer.Thatis,freezetheequalizertapsattheirinitialvalues.Setthetransmittertosend1000symbolsofS1followedbythe4-pointconstellationforscrambled1’sindefinitely.Observetheconstellationdisplayforeachofthe8phaseswhenthe4-pointconstellationistransmitted.Choosethephasethatresultsinthetightestconstellation.Alsoexperimentwithidealreferencetraining.Setalltheequalizertapstozeroinitiallyinthismode.Thetapsshouldautomaticallyadjustforanytimingphaseoffsetandconvergetoasetofvaluesthatperformtheequalizationandphase-splittingfunctions.Afteraperiodoftimewhentheequalizerhasconverged,switchtothedecisiondirectedmode.Youcouldalsotestyourreceiverwiththe16-pointconstellation.Asbefore,beginthetrainingwiththe4-pointconstellationandthenswitchtothe16-pointconstellationaftertheequalizerhasconverged.Performabit-errorratetestforyourreceiver.Comparethetightnessoftheconstella-tionandthebit-errorrateperformanceofyourcomplexcross-coupledandphase-splittingequalizers.15.7OptionalBlindEqualizationExperimentUsethemodifiedV.22bistransmitteryoumadeforChapter13asthesignalsourcefortheblindequalizationexperimentsofthissubsection.Youmightwanttopassthesignalthroughthecommercialtelephonechannelsimulatortointroduceadditionalintersymbolinterferencebyselectingabadline.Performthefollowingtasks:1.ProgramthetransmittertofirstsendtheS1alternationsfor1000symbolstoallowyoursymbolclocktrackinglooptolockup.Thenswitchtosendingscrambled1’susingthe16-pointconstellation.2.ComputetherequiredvalueforR2using(15.60)tomaketheequalizedconstellationhavethecorrectscalingforyour16-pointslicer.3.Modifyyourcomplexcross-coupledequalizertouseGodard’sp=2tapupdatealgorithmgivenby(15.59).Initializeallthetapstozeroexceptforthereferencetapnearthecenterofthedelaylinethatyouexperimentallyselectedinthepreviousexercises.Setthereferencetaptoavalueyouthinkwillsatisfy(15.62).Notethatifallthetapsaresettozero,theequalizeroutputwillbezero,thetapupdateincrementswillallbezero,andadaptationwillnotoccur.4.Waitfor1008symbolsaftercarrierdetectandthenbeginCMAupdatingoftheequalizertaps.Turnonthecarriertrackingloopatthistimealso.The16-pointconstellationwiththecorrectrotationshouldemerge.Iftheconstellationdisplaydoesnotconvergetotheexpectedpicturebuttosomedifferentstablepattern,tryadjustingtheinitialvalueofthereferencetap.Youmightwanttowaittoturnonthe2ndorderintegratorinthecarrierloopforsometimeafteradaptiveequalizationisstartedsorandomslicingerrorsdonotdriveitsoutputfarfromthecorrectvalue.Ifthishappenstheconstellationwillspinrapidly. 262QAMReceiverII–EqualizerandCarrierRecoverySystem5.Repeattheprevioustaskwiththecarrierloopfree-runningatthenominalcarrierfre-quency.Theconstellationshouldemergebutspinatthecarrieroffsetfrequency.6.DeviseandimplementastrategyforswitchingfromCMAtoLMStrainingandwatchthereceivedconstellationconvergeto16tightpoints.7.Ifyouareinterestedinexperimentingwithblindequalizationfurther,implementitforthephase-splittingfractionallyspacedequalizer.15.8AdditionalReferencesTheuseofadaptivetransversalequalizersindatamodemswasfirstinvestigatedandcom-mercializedbyR.W.Lucky[II.D.28]atAT&TBellLabsinthemid1960’s.ThisapproachisalsodiscussedinLucky,Salz,andWeldon[II.D.29,Chapter6]andisbasedonazeroforcingcriterion.Thesetworeferencesareprimarilyofhistoricalinterestsincethezeroforcingap-proachwassoonreplacedbythemorepowerfulLMSalgorithm.Fordetailedpresentationsofthecomplexcross-coupledLMSalgorithmforadaptiveequalization,seeGitlin,Hayes,andWeinstein[II.D.11,Chapter8],Haykin[II.D.18,Chapter9],LeeandMesserschmitt[II.D.26,Chapter9],Proakis[II.D.32,Chapter6],Treichler,Johnson,andLarimore[II.D.38,Chapter4],andWidrowandStearns[II.D.41,Chapter10].ThetapleakagealgorithmisproposedandinvestigatedinGitlin,Meadors,andWein-stein[II.D.12].Treichler,Johnson,andLarimore[II.D.38,Section4.2.6.2]alsoanalyzethebehavioroftheLMSalgorithmwithtapleakage.MuellerandWerner[II.D.30]andLingandQureshi[II.D.27]aregoodreferencesforthefractionallyspacedphase-splittingequalizer.Theequivalenceofthecross-coupledcomplexequalizerandphase-splittingequalizerispresentedinTretter[II.D.39,Chapter11]alongwithaderivationofthetransferfunctionoftheoptimumlinearfractionallyspacedequalizer.DiscussionsofcarrierrecoverytechniquesforQAMsystemscanbefoundinGitlin,Hayes,andWeinstein[II.D.11,Section6.4]andLeeandMesserschmitt[II.D.26,Chapter14].Anad-ditiontothecarriertrackinglooppresentedinthischapterthatallowstrackingofsinusoidalphasejitterisdiscussedinSugarandTretter[II.D.35].BlindequalizationwasfirstdisclosedbySato[II.D.33]foronedimensionalmultilevelPAM.ThenextmajorpublicationwasbyGodard[II.D.14]whichpresentedathoroughanalysisofaclassofblindequalizationalgorithmsandcarriertrackingforQAMreceivers.TreichlerandAgee[II.D.37]independentlydiscoveredthe2ndordercaseofGodard’sclassofalgorithms.BenvenisteandGoursat[II.D.2]presentedadditionalblindequalizationalgo-rithms.MorerecentpapersonblindequalizationincludeFoschini[II.D.6]andPicchiandPrati[II.D.31].BookswithdiscussionsofblindequalizationincludeGitlin,Hayes,andWe-instein[II.D.11],Haykin[II.D.18,Chapter20],Proakis[II.D.32,Chapter20],andTreichler,Johnson,andLarimore[II.D.38,Chapter6]. Chapter16EchoCancellationforFull-DuplexModemsAnimportantadvanceinthedesignofhighspeedvoice-bandtelephonelinemodemsforthedialnetworkwastheintroductionofechocancelerstoachievefull-duplexdatatransmissionover2-wirecircuits.Thistechniquewasstudiedintheearly1980’sandthenwidelyintro-ducedincommercialproductsinthemid1980’swhentheCCITTV.32recommendationfora9600bpsmodemwasapproved.Afewyearslater,theV.32bisrecommendationfor14.4kbpsmodemswasapproved,andtheV.34recommendationforratesupto33.6kbpswasapprovedinJune1994.Thesealsouseechocancelers.TherecentV.90andV.92modemsthatusePCMdownstreamuseechocancelersto.Echocancelersarealsousedinsomehighspeeddigitalsubscriberlinesatdataratesof64kbpsormore.Lineechocancelerswereusedwithanalogvoicetransmissiontoeliminateannoyingtalkerechopriortotheinclusionofechocancellationindigitaldatamodems.Thevoiceechocancelersareplacedatdifferentpointsinthetelephonecircuitthantheonesfordatatransmissionandaredisabledduringdatatransmissionbyaspecialsignalinthemodemhandshakesequence.Thetechniqueisalsousedinspeakerphonestoeliminateannoyingacousticreflectionsfromthespeakertothemicrophoneandthenbacktothefarendtalker.Inthischapter,youwilllearnthefundamentalsofechocancellationforvoice-bandmodems.Youwillbuildanechocancelerfornear-endechoandobserveitsbehaviorwithoutafarendtransmittedsignal.Youwillalsobuildafar-endcancelerwithfrequencyoffsetcorrection.Suggestionsforadditionalreferencesonechocancellationareincludedattheendofthischapter.YoushoulddoChapter13beforethisexperimentbecausethemodifiedV.22bistrans-mitteryoumaketherewillbeusedasthesignalsource.16.1TheEchoSourcesinaDialedTelephoneLineCir-cuitAtypicalfull-duplexdialedtelephonelinecircuitisshowninFigure16.1.TheTransmitter,Receiver,andHybridboxesshownontheleftareallcontainedintheleftmodemandthe263 264EchoCancellationforFull-DuplexModemsonesontherightareinanothermodem.Thelefttransmittersendstotherightreceiverwhiletherighttransmittersimultaneouslysendstotheleftreceiver.Thetransmissionsinbothdirectionsareindependentofeachother.Bothmodemsareconnectedtoordinary2-wirevoice-bandtelephonelinecircuitswhichgofromthemodemsitetothelocalofficeandarecalled2-wirelocalloops.Amodemtransmitsandreceivesoverthesamepairofwires.ThefunctionoftheHybridboxistoisolatethetransmitandreceivedsignalsatthe4-wireto2-wireinterfaces.Anidealhybridroutesthesignalonthetransmitterminalpaironthe4-wiresideonlytothe2-wireloopandnottothereceivepaironthe4-wireside.Similarly,thereceivedsignalonthe2-wireloopisroutedonlytothereceiveterminalpaironthe4-wireside.Customerscanlease4-wirecircuitsatadditionalcostandeliminatetheneedforechocancelers.Signalsaretransmittedbetweenofficeswithinthetelephoneplantusing4-wirecircuits.Onepairisusedtotransmitinonedirectionandtheotherpairintheoppositedirection.Again,hybridsareusedatthe2-wireto4-wireinterfaces.The4-wirecircuitcanconsistofcombinationsofgroundlines,fiberopticcables,microwavelinks,andsatellitecircuits.AverylargepercentageofthetransmissionsbetweenofficesisindigitalformintheUS.4-WireCarrierCircuitTransmitterTransmitter2-Wire2-WireLoopLoopHybridHybridHybridHybridReceiverReceiverFigure16.1:TypicalFull-DuplexDialedTelephoneLineConnectionWithoutEchoCancel-lationReal-worldhybridsarenotperfect.Theyaredesignedtoworkwithanominalimpedanceonthe2-wireloopandactualloopsdifferfromthenominal.Therefore,someofthetransmit-tedsignalatalocalmodemleaksthroughthehybridbacktothelocaltransmitter.Thisisknownasnear-endecho.Whentheimpedanceimbalanceislarge,thenear-endechopowercanbe30dBabovethepowerofthedesiredsignalreceivedfromthetransmitterofthefar-endmodem.Theimpulseresponseofthenear-endechopathtypicallyhasadurationoffrom5to18ms.Anothersourceofechoisleakagethroughthehybridatthefarendofthe4-wirecircuitandiscalledfar-endecho.Thefar-endechoisdelayedbythepropagationtimethroughtheechopath.Thisdelaycanrangefromafewmillisecondsuptoasmuchas1.5secondswhenthetransmissionpathcontainsacoupleofsatellitehops.Thedurationoftheimpulseresponseofthefar-endechopath,ignoringthebulkdelay,istypicallynomorethan20ms.Thelevelofthefar-endechoistypicallyatleast15dBbelowthatofthenear-endecho.Inaddition,therecanbefrequencyoffsetsonthefar-endechowhencarrier 16.2TheData-Driven,Nyquist,In-BandEchoCanceler265circuitsareinthepath.Additionalechoscancirculatearoundthe4-wirecircuitbutareusuallyattenuatedtothepointofbeingnegligible.Techniquesusedforeliminatingtheechosdependonwhetherthemodemsareloworhighspeed.Thevoice-bandcircuithasausablebandwidthextendingfromabout300to3200Hz.LowspeedmodemsliketheV.22bisseparatethetransmitandreceivepathsbyfrequencydivisionmultiplexingandbandpassfiltering.HigherspeedmodemsliketheV.34useasymbolrateof2400Hzormoresothesignalspectrumfillsmostoftheavailablebandwidthandfrequencydivisionmultiplexingcannotbeused.Thenearandfar-endmodemsusethesamecarrierfrequency,sothetransmittedandreceivedspectracompletelyoverlap.Echocancellationwaschosenasthesolutiontothisproblem.16.2TheData-Driven,Nyquist,In-BandEchoCan-celer16.2.1GeneralDescriptionThearchitectureforapracticalechocancelerisshowninFigure16.2.ThetransmitterusesthepassbandshapingfilterapproachpresentedinSection13.3andshowninFigure13.6.AsinChapter13,cn=an+jbnisthesequenceofconstellationpointsselectedbytheinputdataandjωcnTcn=cne=an+jbn(16.1)iscalledtherotatedsymbolsequence.Theechocancelerisbasicallyanadaptivetappeddelay-linefilterwithnearandfar-endsections.Itisdrivenbytherotatedsymbolsandsynthesizesareplicaoftherealpassbandecho.Forthesereasons,itiscalledadata-driven,in-bandcanceler.Sincethesynthesizedechoissubtracteddirectlyfromthereceivedsignal,echosamplesmustbegeneratedandthereceivedsignalsampledataratethatisatleasttwicethehighestfrequencycomponentinthereceivedsignalsotheNyquistcriterionissatisfied.ThereceivedsignalistypicallysampledatLtimesthesymbolratefs=1/TasindicatedintheADCblockinthefigure.Forexample,thesymbolrateforaV.32modemis2400Hzwithacarrierfrequencyof1800Hzanduses12%excessbandwidthsquare-rootofraisedcosineshaping,sotheuppercutofffrequencyis3144Hz.ThesmallestchoiceforLthatsatisfiestheNyqistcriterionisL=3resultinginasamplingrateof7200Hzandisthemostefficientchoiceintermsofminimizingtherequirednumberofcomputationspersecond.Thecanceleralsoincludesafar-endfrequencyoffsetcorrectionphase-lockedloop.With-outfrequencyoffsetcorrection,thereceivedconstellationappearstopulsateattheoffsetfrequencyandtheerrorrateperformanceisseverelydegraded.Modernlinkswherethetransmissionbetweenlocalofficesisentirelydigitaldonothaveanyfrequencyoffset.Thesynthesizedechosamplesaresubtractedfromthereceivedsignalsamplestogivewhatiscalledtheresidualsignalsequence.Theremainingechocomponentintheresid-ualistypicallyrequiredtobeatleast30dBbelowthereceiveddatasignalcomponentforadequateerrorrateperformance.Theechocancelerandreceivedsignalsamplinginstantsaresynchronizedtothetransmittersymboltiming.Thesignalreceivedfromthefar-end 266EchoCancellationforFull-DuplexModemsejωcnTcnPassbandT/Lcn×e(·)ShapingFilterDACBulkLowpassDelayFilterejβn×s(t)Frequency2-WireOffsetPLLFarEndNearEndLoopHybridCancelerCancelerm(·)q(nT/L)p(nT/L)e(·)e(·)BandpassFilterqR(nT/L)pR(nT/L)+−v(t)Receiver+T/L+InterpolatorADCToReceiverρ(nT/L)ResidualFigure16.2:AData-Driven,Nyquist,In-Band,EchoCanceler 16.2TheData-Driven,Nyquist,In-BandEchoCanceler267modemhasthesamenominalsymbolrate.However,itwillhaveaslightlydifferentfre-quencybecauseofminorhardwaredifferences.Therefore,theresidualsamplinginstantsarenotsynchronizedwiththedesiredreceiversymboltiming.ThisproblemissolvedbytheReceiverInterpolatorblockwhichgeneratesoutputsamplessynchronizedwiththereceivertiming.Theinterpolatorcanbeimplementedbyconvertingtheresidualsamplesbacktoacontinuous-timesignalandre-samplingtheanaloglowpassreconstructionfilteroutputattimessynchronizedwiththereceivertiming.Modemanalogfrontendchipsarecommer-ciallyavailablethatperformtheinterpolationusingnumericalDSPtechniques.ThesechipsalsoincludetheADC,DAC,analoglowpasstransmitandbandpassreceivefilters,andclockgenerationcircuits.TheinterpolationcanalsobeperformednumericallyusingthevariablephaseinterpolatormethodspresentedinChapter12.TheinterpolatedresidualsequenceissenttothereceiverwhichhasthesamestructureasdescribedinChapters14and15.Theechocancelerproblemissimplerthantheequalizerprobleminoneway.Themodem’stransmitterandreceiverarelocatedinthesameboxandmayevenbeimplementedassubroutinesinthesameDSP.Therefore,thelocalreceiverhasexactknowledgeofthelocallytransmittedsymbolsequenceandtheexacterrorsignal,theresidual,isformed.Theadaptiveequalizermustusedecisiondirectedadaptationalgorithmsaftertheinitialhandshakingsequence.Thecancelerproblemismoredifficultinanotherway.Intheequalizerproblem,thereceivedsignaltonoiseratioisusuallyratherhigh.Intheechocancelerproblemitisusuallylowbecausethedesiredreceivedsignalfromthefar-endmodemcanbeatasignificantlevelrelativetotheechosthatneedtobecancelled.Therefore,alargeamountofaveragingmustbeperformedintheadaptationalgorithmtosuppressthefarendsignalwhichlookslikenoisetothecanceler.Whenbothmodemsaretransmittingsimultaneously,theyaresaidtobedoubletalking.Inpractice,thelocalandremoteechocancelersareusuallyseparatelytrainedinthehalf-duplexmodeduringaninitialhandshakesequence.Thedatasignalstransmittedinbothdirectionsarestatisticallyindependent.Differentscramblersareusedinthenearandfarendmodemstoensurethisindependence.Thisallowstheechoimpulseresponsetobetrackedduringdoubletalkingwithenoughaveraging.16.2.2TheNear-EndEchoCancelerTheinputstothenear-endechocanceleraretherotatedsymbolscwhichoccuratthensymbolratefs=1/T.ThecancelermustgenerateoutputsatarateLfsthatsatisfiestheNyquistcriterionforsamplingthereceivedsignalv(t).ThecancelercanbeimplementedbygeneralizingtheinterpolationfilterbankstructurediscussedinSection11.3.ThecancelerrequiresLFIRsubfilterseachofwhichiscalledasubcanceler.SupposeeachsubcancelerhasN1complextapsandthetapsforthem-thsubcanceleraredenotedbyAm(n)=αR,m(n)+jαI,m(n)forn=0,...,N1−1andm=0,...,L−1(16.2)Thesubcancelersallusethesamedelay-linewhichstoresthepresentandN1−1pastrotatedsymbols.Aftereachnewrotatedsymbolcarrives,theLsubcanceleroutputsarecomputednas⎧⎫⎨N1−1⎬pR(nT+mT/L)=e⎩Am(k)cn−k⎭k=0 268EchoCancellationforFull-DuplexModemsN1−1=αR,m(k)an−k−αI,m(k)bn−kform=0,...,L−1(16.3)k=0Theresidualforthem-thsubcancelerisρ(nT+mT/L)=v(nT+mT/L)−pR(nT+mT/L)−qR(nT+mT/L)(16.4)whereqR(nT+mT/L)isthefar-endechocanceleroutput.Aswithadaptiveequalizers,choosingthesubcancelercoefficientstominimizetheLmean-squaredresidualshasbeenfoundtobeagoodstrategy.Thederivativesofthem-thresidualwithrespecttothei-threalandimaginarytapcomponentsare∂2ρ(nT+mT/L)=−2ρ(nT+mT/L)an−i(16.5)∂αR,m(i)and∂2ρ(nT+mT/L)=2ρ(nT+mT/L)bn−i(16.6)∂αI,m(i)Therefore,usingtheLMSstrategypresentedinChapter15,thecoefficientsofthem-thsubcancelercanbeadjustedbythefollowingformulas:αR,m(i;n+1)=αR,m(i,n)+µρ(nT+mT/L)an−ifori=0,...,N1−1(16.7)αI,m(i;n+1)=αI,m(i;n)−µρ(nT+mT/L)bn−ifori=0,...,N1−1(16.8)whereµisasmallpositiveconstant.TheseformulascanbeexpressedintermsofthecomplexcoefficientsandrotateddatasymbolsbythesingleequationA(i;n+1)=A(i;n)+µρ(nT+mT/L)cfori=0,...,N−1(16.9)mmn−i1SomesimplestabilityandrateofconvergenceformulascanbederivedforthisLMSalgorithm.Supposetheconstellationpointsareselectedwithequallikelihood,areanuncor-relatedsequence,andarelocatedsothat222σ=E{an}=E{bn}(16.10)Then,itcanbeshown[II.D.40]thatthisLMSadaptationalgorithmisstableiftheupdatescalefactorµsatisfiesthebounds10<µ<(16.11)N1σ2Thescalefactorthatgivesthemostrapidconvergenceofthemean-squarederroris1µ0=(16.12)2N1σ2Letξ(nT+mT/L)betheportionofthereceivedsignalv(nT+mT/L)exclusiveoftheechos.Itincludesthereceivedfar-enddatasignalandchannelnoise.Then,thesteady-statemean-squaredresidualvalue,assumingthefar-endechoisnotpresent,is1L−12E{ξ(nT+mT/L)}Lm=0R∞=(16.13)1−µN1σ2 16.2TheData-Driven,Nyquist,In-BandEchoCanceler269Thisequationshowsthatasµisreducedtozero,thesteady-stateresidualpowerreducestothepoweroftheinterferencesignal.Whenµischosentogivethefastestspeedofconvergence,thesteady-stateresidualpowerisdoublethatoftheinterferencesignal.Duringdoubletalking,µmustbemadeverysmalltoaverageouttheeffectsoftheinterferencefromthefar-enddatasignal.Thiscanresultinanunderflowproblemandcausetheadaptationtostop,particularlywithfixedpointDSP’s.Asolutiontothisproblemistosumseveralpastproductstoformthegradientestimateandiscalledtheblockleastmean-square(BLMS)algorithm.Theformulaforadjustingthei-thcomplextapofthem-thsubfilterusingablockdepthofMisM−1A(i;n+M)=A(i;n)+µρ(nT+kT+mT/L)c(16.14)mmn+k−ik=0NoticethatthisreducestothestandardLMSalgorithmforM=1.WiththeBLMSalgorithm,thetapsareadjustedeveryMsamples.ThestabilityandconvergencerateformulasarethesameasfortheLMSalgorithm.ItisverylikelywithcurrentDSPtechnology,thatalltheechocancelertapscannotbeupdatedduringonesymbolperiod,especiallywhentheDSPisperformingothertransmitterandreceivertasksinaddition.Astandardsolutiontothisproblemistoupdatejustaportionofthetapseachsymbolperiod.16.2.3TheFar-EndEchoCancelerTheimpulseresponseoftheechopathusuallyconsistsofaninitialperiodofactivitycausedbythenear-endecho,followedbyaperiodofsilence,followedbyaperiodofactivitycausedbythefar-endecho.Noechocancelerfiltertapsarerequiredtomodelthesilentperiodcausedbytheround-trippropagationtimeofthefar-endecho.Itisonlynecessarytoincludeabulkdelaytomodeltheround-tripdelay.Aportionofthehandshakesequenceisusedtomeasuretheround-tripdelayinV.32,V.32bis,andV.34modems.Thefar-endechomayhaveafrequencyoffsetinadditiontothedelay.ThefrequencyoffsetiscorrectedbymultiplyingtheoutputoftheBulkDelaybyejβn.Thedetailsoftheoffsetcorrectionarepresentedinthefollowingsubsection.Thestructureofthefar-endechocancelerFIRfilterisexactlythesameasforthenear-endcancelerexceptthatitwillhavemoretapsbecausethefar-endechoisusuallydispersedmorethanthenear-endecho.Supposethemeasuredbulkdelayisd0symbols.Then,theinputtothefar-endechocancelerisjβncn=cn−d0e=an+jbn(16.15)Letthetapsforthem-thfar-endechosubcancelerbeGm(n)=γR,m(n)+jγI,m(n)forn=0,...,N2−1andm=0,...,L−1(16.16)Then,them-thsubcanceleroutputis⎧⎫⎨N2−1⎬qR(nT+mT/L)=e{q(nT+mT/L)}=e⎩Gm(k)cn−k⎭k=0 270EchoCancellationforFull-DuplexModemsN2−1=γR,m(k)an−k−γI,m(k)bn−k(16.17)k=0Usingthesameapproachasforthenear-endcanceler,theLMStapadjustmentformulaforthem-thsubcancelerisfoundtobeG(i;n+1)=G(i;n)+µρ(nT+mT/L)cfori=0,...,N−1(16.18)mmn−i216.2.4Far-EndFrequencyOffsetCompensationWitholdertelephonecircuitsusinganalogfrequencydivisionmultiplexing,ithasbeenfoundthatitisimportanttocompensateforthefar-endechofrequencyoffsettoachievesatisfactorymodemperformance.Asafirstapproximation,supposethiseffectcanberemovedbylettingβn=θ+ω0nT(16.19)Then,thecomplexoutputofthem-thfarendechosubcancelerisN2−1j[θ+ω0(n−k)T]q(nT+mT/L)=Gm(k)cn−d0−kek=0N2−1j(θ+ω0nT)−jω0kT=eGm(k)ecn−d0−k(16.20)k=0Thederivativeofthesquaredresidualwithrespecttoθis∂2∂ρ(nT+mT/L)=−2ρ(nT+mT/L)e{q(nT+mT/L)}∂θ∂θ∂=−2ρ(nT+mT/L)eq(nT+mT/L)=−2ρ(nT+mT/L)e{jq(nT+mT/L)}∂θ=2ρ(nT+mT/L)m{q(nT+mT/L)}(16.21)whereN2−1m{q(nT+mT/L)}=γI,m(k)an−k+γR,m(k)bn−k(16.22)k=0LetL−1∆n=−ρ(nT+mT/L)m{q(nT+mT/L)}(16.23)m=0Then,asecond-orderphase-lockedloopupdateformulaforthefar-endechophasecorrectionanglesuggestedbytheseresultsisβn+1=βn+k3∆n+Γn(16.24)wherethesecond-orderaccumulatoroutputisΓn=Γn−1+k4∆n(16.25) 16.3EchoCancelerExperiments271andk3andk4aresmallpositiveconstantswithk3/k4≈100.ThestructureforthisPLLisessentiallythesameasthelowerpartoftheQAMcarriertrackingloopshowninFigure15.4withωcT=0.Inordertosavecomputationtime,thephaseupdatecanbeperformedoncepersymbolperiodusingtheresidualfromjustonesubcanceler.Forexample,supposetheresidualforsubcancelerm=0isused.Then,theonlychangerequiredintheformulasistoreplace∆nby∆n=−ρ(nT)m{q(nT)}(16.26)16.3EchoCancelerExperimentsYouwillbeaskedtomakeanear-endechocancelerandafar-endechocancelerwithfrequencyoffsetcorrectionintheseexperiments.Nointerferingdatasignalfromafar-endmodemwillbeincluded.Makesuretousethehighestcompileroptimizationlevel.16.3.1MakingaNear-EndEchoCancelerUsethemodifiedV.22bistransmitteryoumadeinChapter13asastartingpointforyournear-endechocancelerprogram.SendtheoutputsamplestotheleftchanneloftheDAC.ConnecttheDACoutputtotheADCinputtosimulatethenear-endecho.Yourtransmitterusesapassbandshapingfilterwithanimpulseresponsethatspans8symbols.Therefore,yournear-endechocancelerwillhavetospanatleast8symbolswhichisequivalentto8msat1000baud.Usean8000Hzsamplingratefortheechocanceler.ThisrequiresusingL=8000/1000=8samplespersymbolor8subcancelers.Youwillhavetofigureoutastrategyforinterleavingthetransmitterandechocancelersubfiltercomputationseachsymbol.Considerusingtheinterruptsfortransmittedsamplessomehowtogeneratetherequiredtiming.Implementtheechocancelerwith8subcancelersusing(16.7)and(16.8)toupdatethetaps.PasstheresidualsignaltotherightDACchannelandobserveitontheoscilloscope.Experimentwithdifferentvaluesoftheupdatescalefactorµandobservetheconvergenceratesandsteady-stateresidualvariations.Measurethepowerofthereceivedsequencebeforetheechocancelersubtractionnodeandthepoweroftheresidual.andcalculatetheratiooftheinputtoresidualpowerindB.16.3.2MakingaFar-EndEchoCancelerwithFrequencyOffsetCorrectionSimulateafrequencyoffsetfar-endechobymultiplyingthecomplexoutputofthetransmitterpassbandshapingfilterbyej2πfdnT0beforesendingitsrealparttotheDAC.TheparameterT0isthefilterbanksamplingperiodandfdisthefrequencyoffset.Chooseafrequencyoffsetoffd=0.25Hz.Forsimulationpurposes,assumethefar-endpropagationtimeiszeroandignoretheBulkDelayblock.Addthefrequencycorrectionfunctionstoyournear-endecho 272EchoCancellationforFull-DuplexModemscancelerandpretenditisafar-endcanceler.Donotimplementanear-endcanceleralso.Updatethefar-endfrequencyoffsettrackinglooponlyoncepersymbolwhenprocessingsubcancelerm=0using(16.24),(16.25),and(16.26).SendtheresidualtotherightDACchannelandobserveitontheoscilloscope.Experimentwiththesystemparametersandobservetheresidualbehavior.Whenyouhavefoundagoodsetofparameters,measuretheinputandresidualpowersandcomputetheratioindB.16.4AdditionalReferencesWerner[II.D.40]givesaverygoodpresentationofechocancelersfordigitaldatamodems.ThisworkhadasignificantinfluenceontheroundtripdelayestimationmethodchosenfortheV.32recommendation.AlsoseeGitlin,Hayes,andWeinstein[II.D.11,Chapter9],andLeeandMesserschmitt[II.D.26,Chapter18]forcomprehensivetheoreticaltreatmentsandalternativestructuresforechocancelers. Chapter17Multi-CarrierModulationThischapterexploresthefundamentalconceptsofmulti-carriermodulation.Multi-carriermodulationisimportanttoknowabouttodaybecauseitisusedextensivelyinbroadbanddigitalwirelinesystemsandinmanybroadbandwirelesssystems.ThesystemsareverycomplexandthischapterwillonlylookatthefundamentalconceptsusedformodulationanddemodulationbyimplementingasimplifiedADSLtransmitterandreceiver.Thesystemsalsoincludesophisticatederrorcorrectingcodes,interleavers,andnetworkprotocols.17.1ABriefOverviewoftheHistoryandImplemen-tationofMulti-CarrierModulationMulti-carriermodulationisoftenselectedforsituationswherethechannelfrequencyre-sponseandnoiseinterferencevarysignificantlywithfrequencyand/ortimeoverthesignal-ingbandwidth.Applicationsincludefadingwirelesschannelsandbroadbandwirelinedigitalsubscriberlines.Itiscalleddiscretemulti-tonemodulation(DMT)inthewirelinecommu-nityandorthogonalfrequencydivisionmultiplexing(OFDM)inthewirelesscommunity.Thebasicphilosophybehindmulti-carriermodulationistopartitionthechannelfrequencybandintomultiplenon-overlappingnarrow-bandsub-channelswithnearlyconstantfrequencyre-sponseovereachsub-channel.Dataistransmittedbymodulatingcarrierscenteredineachsub-channelusinganarrow-bandmodulationmethodlikeQAM.Theindividualcarriersareoftencalledtonesorsubcarriers.Atthereceiver,theQAMconstellationforeachsubcarrierisessentiallyscaledbyacomplexconstantcorrespondingtothechannelfrequencyresponseatthesubcarrierfrequencyandcanbeeasilyequalizedbymultiplyingbythereciprocaloftheconstant.Ablockofmanydatabitsistakenfromthedatasourceandsubsetsofbitsareassignedtothedifferentsubcarriersbasedonsub-channelsignal-to-noiseratiomea-surements.ThesubcarriersaremodulatedandalltransmittedforsometimeTandthenanotherdatablockistakenandtheprocessisrepeated.Thesumofmodulatedsubcarrierstransmittedforaninputdatablockiscalledamulti-carriersymbol.Sincemanybitsareassignedtoasymbol,thesymbolrate1/Tissmallcomparedtothedatarateor,inotherwords,thesymbolperiodislongcomparedtotheinputbitperiod.Multi-carriermodulationisusedextensivelyisinbroadbanddigitalwirelinesystems273 274Multi-CarrierModulationusingexistingcoppertwistedpairtelephonelinecables.Thesetelephonelinesystemsareknownasdigitalsubscriberlines.TheAmericanNationalStandardsInstitutepublishedastandardforabroadbandmulti-carrierwirelinesystemin1998[E.1]calledanasymmetricdigitalsubscriberline(ADSL).TheInternationalTelecommunicationUnionhasapprovedanumberofmulti-carrierwirelinerecommendationsincludingITU-TG.992.3[E.10],G.992.4[E.11],andG.992.5[E.12].Multi-carriermodulationiscalleddiscretemulti-tonemodulation(DMT)inthewirelineworld.Voice-bandtelephonelinemodemsstartingwiththeWesternElectric110baudBell103binaryFSK(frequencyshiftkeyed)modemsofthe1960’s,followedbyotherproprietarycommercialmodems,andonesconformingtotheinternationalstandardITU-TV-seriesrecommendationsuptotheITU-TV.34modemapprovedin1998haveallusedsingle-carriermodulation.Thevoice-bandchanneliswellmodeledbyalineartime-invariantfilterfollowedbyadditivenoise.Almostallofthemodemsoperatingatdataratesof1200bitspersecondormorehaveusedquadratureamplitudemodulation(QAM).Afewearlyhighspeedmodemsusedsinglesidebandmodulation.TheITU-TV.90modemapprovedinSeptember1998alwaysusessingle-carrierV.34modulationupstreamfromthecustomertothecentralofficebutpulsecodemodulation(PCM)downstreamfromthecentralofficetothecustomerifchannelconditionsallowit.TheV.92modemsapprovedin2000usePCMupstreamanddownstreambutcanfallbacktoV.34ineitherdirection.Chapters13,14,15,and16presentthetheoryandalgorithmsrequiredtoimplementasingle-carriervoice-bandtelephonelinemodem.Afewmulti-carriervoice-bandtelephonelinemodemshavebeenproducedbutnonewerecommerciallysuccessfulorincludedininternationalstandards.ThemanufacturersclaimedtomakeoptimumuseofthetelephonechannelbyadjustingcarrieramplitudesandnumberofbitsassignedtoeachcarrierbasedoncapacityformulasfromInformationTheory.Onereasonfornotbeingacceptedisthattheyintroducedlargedelaysatvoice-banddatarates.Anotherreasonisthattheirtransmittedsignalhadalargepeak-to-averageratiorequiringamplifiersandcircuitswithalargedynamicrangeandsmallnon-linearities.Theperformanceofmulti-carriermodemswasalsodegradedbycarrierphasejitterwhichwasstillpresentintelephoneplantanalogcarriercircuits.ThesehavenowbeenalmostentirelyreplacedbydigitalPCMsystems.Inaddition,equivalentresultscouldbeobtainedwithsingle-carriermodemsusingadaptiveprecoding.Thesituationchangeddramaticallywhenthetelephonecompanieswereforcedbygovern-mentregulationandcompetitionfromcableandwirelesscompaniestoprovidebroadbanddatatransmission.Thisrequireddirectaccesstothecoppertwistedpairlocalloopswithoutgoingthroughthelowpassvoice-bandfilterswithacut-offfrequencyofaround4kHz.Itwasfoundthatthelocalloopscouldsupportsignalswithspectralcomponentsupto1.1MHzormore,insomecases,allowingdataratesuptoseveralmegabitspersecond.Theusefulbandwidthdependsonthedistanceofthecustomerfromthecentraloffice,bridgetapsintothecable,andambientnoise.SeeGolden[E:3]forextensivediscussionofthecableprop-erties.Thefrequencyresponseofthecablesandnoiseinterferencevariesgreatlyoverthesebandwidths.ThenoiseincludesAMradiosignalsandcross-talkfromothercablesinthesamebundle.Expertsdecidedthattheadaptiveequalizationtechniqueusedinsingle-carriersystemswasexpensivetoimplementathighsymbolrates,didnotallowflexibilityinusing 17.1HistoryandImplementationofMulti-CarrierModulation275thechannel,andthatmoderatedelaywasnotaproblemforapplicationsusingbroadbandsystemslikewebsurfingorvideoondemand.Theychosetousethemulti-carrierapproachwiththesubcarrierfrequenciesuniformlyspreadovertheusablebandwidth.InADSL,up-streamtransmissionusessubcarrierfrequenciesatmultiplesof4.3125kHzfromabout25kHzto138kHzandcanprovidedataratesupto896kbit/s.Downstreamtransmissionusesfrequenciesatmultiplesof4.3125kHzusuallyinthebandfrom138kHzto1.104MHzbutcanusethefull25kHzto1.104MHzbandifechocancellationisimplementedprovidingdataratesupto8Mbit/s.QAMmodulationwithalargerangeofconstellationsizesisusedforeachofthesubcarriers.Thefrequenciesbelow25kHzarenotusedsotheplainoldtelephonesystem(POTS)0to4kHzvoice-bandchannelscanbefrequencydivisionmul-tiplexedwiththeADSLsignalsontothesamecable.Channelmeasurementsofthecablefrequencyresponseandinterferingnoiseareusedtodeterminewhichsubcarrierstouse,theiramplitudes,andthenumberofdatabitsassignedtoeachtotrytoachieveadatarateapproachingthecapacitypredictedbyInformationTheory.Multi-carriermodulationisusedextensivelyinwirelessdigitaldatacommunicationsys-temswherethechannelhasfadingcharacteristicscausedbythetransmittedsignalpropagat-ingovermultiplepathstothereceiverasaresultofreflectionsanddiffraction.Multi-carriermodulationiscalledorthogonalfrequencydivisionmultiplexing(OFDM)inthewirelesscom-munity.ItisessentiallythesameasDMTusedintheDSLsystems.Thesefadingchannelsarealsocalledmulti-pathchannels.Theyaretimevaryingbecauseofmotionofthereflectorsand,possibly,thetransmitterandreceiver.Whenanunmodulatedcarrieristransmittedandallthepathshaveaboutthesamepowerandintroduceindependentrandomphaseshiftsandtherearemanypaths,theamplitudeofthereceivedsignalcanbeshowntohaveaprobabilitydensityfunctionthatiswellapproximatedbytheRayleighdensityandthephaseisuniformlydistributedover[0,2π).Whenthereisastrongline-of-sightcomponent,theprobabilitydensityfunctionfortheamplitudeofthereceivedsignalhasaRicianpdf.SeebooksonwirelesscommunicationslikeGoldsmith[E.4],Haykin[E.5],Schwartz[E.15],andSt¨uber[E.17]forthedetailedtheory.Thefrequencyresponseofthechannelfromtrans-mittertothereceivercanhaveanamplitudethatvariessignificantlywithfrequencyandcanhavedeepnullsatsomefrequenciesdependingonthedelaysandamplitudesofthepaths.Thesechannelsaresaidtohavefrequencyselectivefading.Thepeaksandnullsarecausedbyreinforcementandcancellationofthesignalsarrivingalongthedifferentpaths.Multi-carriermodulationwasusedaslongasfiftyyearsagoforHFdigitalradiocommu-nicationoverlongdistanceslikefromshiptoshore.TheHFsignalreflectsofflayersoftheionosphereandcanpropagateoverlongdistancesbouncingaroundtheEarth.Thereceivedsignalexperiencessignificanttimevaryingmulti-pathfadingastheionosphericlayersshift.Theinitialradiosusedanalogfilterswhichweredifficulttokeeptuned.Inthelate1960’s,themilitarybeganusingexpensivespecialpurposemini-computersanddigitalsignalprocessingalgorithmsincludingtheFFTandIFFTtoperformthespeechcompression,encryption,modulation,forwarderrorcorrection,anddemodulation.Thesystemsusedarounda3kHzbandwidthandintheorderof32subcarriers.SmallinexpensivemodernDSP’scannowbeusedtoimplementtheHFmodems.Arguably,themostcommoncurrentuseofmulti-carriermodulationisintheubiquitousWi-Finetworks.ThereareanumberofIEEEstandardsforWi-Fi.TheIEEE802.11a 276Multi-CarrierModulationstandard[E.6]wasreleasedin1999.ItusesOFDMinthe5GHzband,hasamaximumdatarateof54Mbit/swithatypicalthroughputof21Mbit/s,anindoorrangeofabout25meters,andanoutdoorrangeofabout75meters.TheIEEE802.11gstandard[E.7]wasreleasedin2003.ItusesOFDMininthe2.4GHzband,hasamaximumdatarateof54Mbit/sandtypicalthroughputof20Mbit/s,anindoorrangeofabout40meters,andanoutdoorrangeofabout95meters.EachindividualsubcarriercanbemodulatedwithBPSK,QPSK,16-QAM,or64-QAM.Anewstandard,802.11n,isintheadvancedstagesandisexpectedtobereleasedaroundSeptember2007.Itincludesprovisionsformultipletransmitandreceiveantennas(MIMO).Theindoorenvironmentisquitehostilewithextensivemulti-pathpropagationandinterferencefromotherelectronicdevicestransmittingintheWi-Fibands.Multi-carriermodulationallowstheWi-Fisystemstoadaptivelyselectsubcarriersatfrequencieswherethechannelisgood.Byfar,themostcommonWi-Finetworkconfigurationistohavemultipleusersconnecttothenetworkthroughanearbytransceivercalledanaccesspoint.Amultipleaccessprotocolisused.InthewirelineDSLsystems,asingletransceiverononeendofthelinecommunicateswithasingletransceiverontheotherend.Thisarrangementiscalledapoint-to-pointconnection.ItisalsopossiblefortwonearbyWi-Fiuserstomakeapoint-to-pointconnection.Currently,multi-carriermodulationisalmostalwaysbeingselectedandimplementedforlongdistancebroadbanddigitalwirelesscommunicationswithfixedandmobileusersratherthancodedivisionmultipleaccess(CDMA).Thesesystemswillhavearchitecturessimilartocellulartelephonenetworkswherethemobilesconnecttoanearbybasestationandareautomaticallyswitchedbetweenstationsastheymovetoadjacentcells.ThestandardizedsystemthatiscurrentlygettingthemostattentionandisintheprocessofbeingdeployedbymajorcarrierslikeSprintispopularlycalledWiMax.Thissystemwasinitiallystandardizedin2004byIEEEStd802.16[E.8]asafixedbroadbandsystem.In2005itwasexpandedtoincludemobileunitsbyIEEEStd802.16e[E.9].The802.16esystemsweredesignedtooperatebelow11GHzandhavebandwidthsrangingfrom1.25to20MHz.Thesestandardscontainamultitudeofoptions.AnindustrywidecommitteecalledtheWiMaxForumhasbeenmeetingtoselectasubsetofoptionsthatmanufacturersshouldincludetomakeWiMaxtransceiverscompatiblewitheachother.CompanieslikeTexasInstrumentshavegroupsfuriouslyworkingonmakingDSP’swithspecialperipheralstoimplementsignalprocessingtasksrequiredinWiMaxtransceiversandgroupscreatingoptimizedsoftwaretoimplementtherequiredalgorithms.Itisprojectedthatmobilesasmuchas30milesawaywillbeabletocommunicatewithabasestation.TheWiMaxsystemsareveryflexibleintermsofchannelbandwidths,datarates,andnumberofusers.Theyarealsoverycomplicatedandusethelatestmodulationandcodingmethods.WiMaxusesavariantofOFDMcalledorthogonalfrequencydivisionmultipleaccess(OFDMA).InOFDMA,differentmobilesareallocateddifferentsubsetsofsubcarrierfre-quencies.Periodically,thebasestationcollectsgroupsofbitsfromthedigitalnetworktobesenttoeachofthemobiles.EachgroupofbitsismappedtoasetofQAMconstellationpoints,oneforeachsubcarrierallocatedtothatmobile.QPSK(4-QAM),16-QAM,or64-QAMconstellationscanbeusedbasedondesireddatarates,transmittedsignalbandwidths,andmeasuredchannelconditions.Eachconstellationpointisacomplexnumberthatspec-ifiestheDFTvalueforthecorrespondingsubcarrierfrequencyorDFTindex.Thesetof 17.2AsymmetricDigitalSubscriberLine(ADSL)SystemArchitecture277constellationpointsforallthemobilesistheDFTfrequencydomainrepresentationforonetransmittedsymbol.ModulationisperformedbytakingtheinversefastFouriertransform(IFFT)ofthesetofconstellationpoints.WiMaxsystemscanuseIFFTsizesof128,512,1024,or2048points.ThetotalnumberofsubcarriersusedforallthemobilesissomewhatlessthaneachoftheseIFFTsizesbecausesomesubcarriersatthebandedgesaresettozerotoconfinethespectrumandothersubcarriersareusedtosendpilotsignalsforchannelesti-mation.ThemobilesdemodulateeachsymbolbyusinganFFT.Asimilarprocesshappensintheupstreamdirectionfromthemobilestothebasestation.Eachmobileperiodicallycol-lectsagroupofbitstobesenttothebasestation,mapsthemtoconstellationpointsforitsassignedsetofsubcarriers,andperformsmodulationusinganIFFT.ThetransmissionsfromthemobilesmustbetimedsothatwhentheyarriveatthebasestationtheirsumappearstothebasestationasasingleOFDMsymbol.The802.16estandardincludesproceduresforinitiallyacquiringandtrackingthistiming.ThebasestationdemodulatesthereceivedsymbolsbytakingFFT’s.TheEuropeancellulartelephonecommunityisalsoworkingonmulti-carrierbroadbandwirelessdatacommunicationstandardstocompetewithWiMax.TheThirdGenerationPartnershipProject(3GPP)isworkingonastandardcalledLongTermEvolution(LTE)[E.18].OFDMAwillbeusedinthedownlinkfromthebasestationtothemobilesandan-othervariationofOFDMcalledsinglecarrierfrequencydivisionmultipleaccess(SC-FDMA)willbeuseduplink.Again,QPSK,16-QAM,and64-QAMconstellationsareproposed.Thebandwidthswillbescalablefrom1.25to20MHz.Maximumdataratesareprojectedtobe100Mbit/sdownlinkand50Mbit/suplink.Systemsareexpectedtoberolledoutin2009.Multi-carriermodulationisalsousedinavarietyofothersystems.ItisusedfordigitalaudioandvideobroadcastinginEurope.ItisalsoincludedasoneoptionintheIEEE802.15ultra-widebandstandard.Anumberofproprietarysystemshavebeenbuiltandfieldtested.OneoftheseiscalledFLASH-OFDMwhichwascreatedbyaspin-offfromBellLabscalledFlarionwhichwasrecentlyboughtbyQualcomm.17.2AsymmetricDigitalSubscriberLine(ADSL)Sys-temArchitectureFigure17.1showsthehighlevelblockdiagramofanADSLlink.Atatelephonecompanycentraloffice,dataforaremotecustomerpremiseiscollectedfromabroadbandnetworkliketheInternetandroutedtoanADSLmodem.TheNetworkInterfaceboxoftencon-tainsadevicecalledaDigitalSubscriberLineAccessMultiplexer(DSLAM)thatperformsthemultiplexingtask.InthexDSLcommunity,modemsareoftencalledtransceiversfortransmitter/receiver.ThemodeminthecentralofficeisdesignatedbyATU-Cwhichstandsfor“ADSLtransceiverunit,centraloffice.”TheATU-Ctransmittertransformsitsinputdataintoasequenceofmulti-carriersymbolsthataresentthroughasplitterinthecentralofficeandthenoverthecoppertwistedpairlocallooptothecustomerpremise.TheATU-CtransmitspectrumforITU-TRecommendationG.992.3[E.10]ismostoftenconfinedtoafrequencybandextendingfrom138kHzto1.104MHz.Thereisalsoanoptiontouseechocancellationandletthespectrumgofrom25kHzto1.104MHzbutthisisrarelyused.The 278Multi-CarrierModulationmaximumdownstreamdatarateforADSL2is12Mbit/sbuttheactualratedependsonthequalityofthelocalloop.Anordinaryvoice-bandtelephonechannelfromthePublicSwitchedTelephoneNetwork(PSTN)whichhasalowpassspectrumwithanominalcutofffrequencyof4kHzisalsoappliedtothecentralofficesplitterandsenttothecustomeroverthelocalloopalongwiththeADSLsignal.OrdinarytelephonechannelshavebeengiventhenamePlainOldTelephoneService(POTS).Atthecustomerpremise,theADSLandPOTSsignalsareseparatedbythehighpassandlowpassfiltersinasplitteratthecustomerpremise.AsomewhatsimplerandlowercostoptioncalledsplitterlessADSLinITU-TRecommendationG.992.4[E.11]eliminatesthecustomerpremisesplitterandrequiresthecustomertoinstalllowpassfiltersathisordinarytelephones.TheADSLmodematthecustomerpremiseiscalledtheremotetransceiverandisdesignatedbyATU-RwhereRstandsforremote.TheATU-Rdemodulatesthereceivedmulti-carriersymbolsandsendsthereceiveddatatothecustomerpremisenetwork.CPEinthefigurestandsfor“customerpremiseequipment”whichcouldbeaPCornetworkprinter.DataandvoicetransmissionupstreamfromthecustomerpremisetothecentralofficefollowsthesameprocessasdownstreamexceptthattheupstreamADSL2spectrumislimitedtoabandextendingfrom25kHzto138kHzwithamaximumdatarateof1Mbit/s.ThereasonfortheasymmetryintheupstreamanddownstreamdataratesisthatthedesignersenvisionedthatthemajoruseofthebroadbandconnectionwouldbeforsurfingtheInternetorvideoondemandwheresmallmessageswouldbesentfromthecustomertoaserverandlargefileswouldbedown-loadedfromtheservertothecustomer.17.3ComponentsofaSimplifiedADSLTransmitterTheblockdiagramofanADSLtransmitterthatisasimplifiedversionoftheoneintheANSIT1.413standard[E.1]isshowninFigure17.2.TheITU-TG.993.3transmitter[E.10]isverysimilar.Thesestandardsincludeextensivedescriptionsofhowdataiscollectedfromanumberofinputstreamsandputintoframestoformthe“DataSource”showninFigure17.2forawidevarietyofdataratesthataremultiplesof32kbit/s.ThedataratesareadaptivelydeterminedfrommeasurementsofthelocalloopfrequencyresponseandnoiseandarecomputedbasedonequationsfromInformationTheorytomaximizetherateofreliabletransmission.Thestandardsincludeaparallelpathintothe“Mapblock”boxthatdoesnotincludetheinterleavertogivea“fast”pathwithmuchlessdelay.Theyalsoincludetheoptionforatrellisencoderbetweenthe“Mapblock”andIFFTblock.17.3.1TheCyclicRedundancyCheckGeneratorThecyclicredundancycheckgenerator(CRC)computesacheckbyteforeachsuccessiveblockofkbitsfromtheDataSource.Becauseoftheflexibilityofhowtheinputsourcesaremultiplexedandvarietyofdatarates,theseblockscanbeanywherefrom67uptoaround14,875byteslong.LettheblockofdatabitsbetherowvectorM=[mk−1,mk−2,...,m1,m0] 17.3ComponentsofaSimplifiedADSLTransmitter279CentralOfficeNetworkADSLBroadbandInterfaceModemNetworkATU−CHighpassFilterNarrowbandLowpassNetworkFilter(PSTN)SplitterCCPECPELocalLoopNetworkADSLCustomerInterfaceModemPremiseATU−RNetworkHighpassFilterPlainOldTelephoneTelephoneSetService(POTS)LowpassorVoice−bandFiltermodemSplitterCustomerPremiseRFigure17.1:BlockDiagramofanADSLSystem 280Multi-CarrierModulationDataAddCyclic2NSC−1SourceRedundancyInsertChecks(CRC)2NSC-pointCyclicPrefixMapblockIFFTScramblerofbitstoaDACblockof2NSC...(Modulator)...OutputQAMReed-SolomonsamplesconstellationEncoder(FEC)seriallypoints1TolocalConvolutional0loopInterleaverFigure17.2:SimplifiedBlockDiagramofanADSLTransmitterAnequivalentrepresentationisthepolynomialK−2k−1M(D)=mk−1+mk−2D+...+m1D+m0DThecheckbyteistheremainderwhenM(D)D8isdividedbytheprimitivepolynomialg(D)=D8+D4+D3+D2+1wherecoefficientsarecomputedusingmodulo2arithmetic.Letthischeckbytebe8567c(D)=mod[M(D)D,g(D)]=c7+c6D+...+c2D+c1D+c0D(17.1)AcircuitforcomputingthecheckbyteisshowninFigure17.3.EachDrepresentsaone-bitdelayelement.Theaddersperformmodulotwoadditionwhichisthesameasanexclusive-orfunction.Theeightdelayelementsareinitiallyclearedtozero.Thenthedatabitsareshiftedintotherightsideofthefeedbackregisterstartingwithm0,thecoefficientofthehighestpowerofD.Thecheckbyteisthecontentsoftheregisterafterthelastdatabit,mk−1isshiftedin.Thedatablockwiththecheckbyteappendedhasthepolynomialrepresentation8X(D)=M(D)D+c(D)(17.2)orvectorformX=[c7,c6,...,c1,c0,mk−1,mk−2,...,m1,m0](17.3)IftheCRCgeneratorregisterisinitiallyclearedandthecomponentsofthevectorXareshiftedintotheadderontheright-handside,startingwithm0downtoc7,thedelayelementswillendupbeingall0.IfY(D)=X(D)+e(D)wheree(D)isanerrorpatternwhichisnotdivisiblebyg(D),theregistercontentswillnotbezerowhenY(D)isshiftedintotheCRCgenerator.Anyerrorpatternwhichisdivisiblebyg(D)isanundetectableerrorpattern.AddingtheCRCbyteallowsthereceivertomakeafinaloverallcheckfortransmissionerrors.CRCfailuresaretypicallyusedbythesystemoperatorstocheckforequipmentfailures. 17.3ComponentsofaSimplifiedADSLTransmitter281DD+D+D+DDDD+c7c6c5c4c3c2c1c0mk−1···m1m0Figure17.3:CyclicRedundancyCheck(CRC)Generator17.3.2TheScramblerThebitstreamfromtheCRCgeneratoristhenpassedthroughaself-synchronizingscramblerliketheonediscussedinChapter9andshowninFigure9.1tobreakuplongstringsof1’sand0’s.Theconnectionpolynomialish(D)=1+D18+D23whichisthesameastheoneusedintheV.32andV.34callingmodems.Lettheinputtothescramblerbex(n).Then,thescrambleroutputisy(n)=x(n)+y(n−18)+y(n−23)(17.4)where“+”ismodulotwoaddition.Theinputcanbecomputedfromtheoutput,thatis,descrambledbycomputingx(n)=y(n)+y(n−18)+y(n−23)(17.5)17.3.3TheReed-SolomonEncoderSuccessiveblocksofbitsfromthescramblerareoperatedonbytheReed-Solomonencoderwhichaddsredundantbitstotheblockssothattransmissionerrorscanbecorrectedatthereceiver.Thisprocessisoftencalledforwarderrorcorrection(FEC).Thedetailedtheoryofthesecodesisbeyondthescopeofthiscourse.SeebooksonerrorcorrectingcodeslikePetersonandWeldon[F.12]andWicker[F.19]forcompletedetails.Abriefdescriptionoftheencoderwillbegivenheretogiveyouahintofwhatitdoes.TheADSLReed-Solomonencoderisbasedontheprimitivepolynomialf(D)=D8+D4+D3+D2+1whichwasusedintheCRCgenerator.ThispolynomialhasrootsintheGaloisfieldGF(28).Letαbeoneoftheroots.Thenallthe256elementsofGF(28)canberepresentedintheform67β=b0+b1α+...+b6α+b7αwherethebi’sare0or1.Anelementcanalsoberepresentedbythebyte[b0,b1,...,b7].TheADSLReed-SolomonencoderconsiderscodesymbolstobeelementsofGF(28)orbytes.Acodewordcanbeatmost255byteslongincludingtheinformationandcheckbits.Theinteger255isthenaturallengthofcodewords,butsomeinformationsymbolscanbesettozeroandnotused.AvarietyofgeneratorpolynomialscanbeusedandhavetheformR−1ig(D)=(D−α)(17.6)i=0 282Multi-CarrierModulationwhereRisapositiveinteger.Thedegreeofg(D)isRwhichisalsothenumberofchecksymbolsinacodeword.Thenumberofinformationsymbolsis255−Randthecoderateis(255−R)/255.Uptot=R/2symbolerrorscanbecorrectedinacodeword.Anywherefromonetoeightbiterrorsinacodesymbol(byte)isasinglesymbolerrorasfarastheReed-Solomoncodeisconcerned.ThechoiceofRallowsatradeoffbetweenerrorcorrectioncapabilityandcoderate.TheANSIT1.413standardrequiresimplementationsforR=2ifori=0,1,...,8.AblockofKmessagebytes[m0,m1,...,mK−1]canberepresentedbythepolynomialK−1K−1−iM(D)=miD(17.7)i=0ThechecksymbolsaretheremainderwhenM(D)DRisdividedbyg(D)usingGF(28)arithmetic,thatis,R−1RR−1−iC(D)=mod[M(D)D,g(D)]=ciD(17.8)i=0andthecompletecodewordisx(D)=M(D)DR+C(D).ThehighestorderKsymbolsarethemessagebytesandthelowerorderRsymbolsarethechecksymbols.ThecodewordlengthisN=K+R.17.3.4TheConvolutionalInterleaverImpulsenoiseisoneofthemajordisturbancesinADSLsystems.Animpulsecancorruptseveralmulti-carriersymbolsandcauseburstsoferrorsinthereceiveddatastreamsifnospecialprecautionsaretaken.ADSLsystemsprotectagainstburstsintwoways.First,theReed-Solomoncodesdiscussedintheprevioussectionnaturallycancorrectmultiplebiterrorsinasinglecodesymbol,whichconsistofastringofeightbits,sinceanypatternofeightorlessbitsistreatedasasingleGF(28)codesymbolerror.Second,atechniquethathasbeenusedformanyyearsinothersystemscalledinterleavingisrequiredbythestandardsforthedatastreamsneedinglowerrorrates.DetaileddiscussionsofinterleavingarepresentedinRamsey[F.13]andForney[F.5].Basically,aninterleavershufflesmultiplecodewordstogetherbeforetransmissionsosymbolsfromanindividualcodewordareseparatedintimewhentheinterleavedcodewordsaretransmittedoverthechannel.SupposethesymbolsfromonecodewordoccurintheinterleavedstreamatmultiplesofanintegerLcalledtheinterleavingdepth.ThenanerrorburstoflengthBonthechannelwillcauseaboutB/Lerrorsinthewordobtainedbydeinterleavingatthereceiver.Theexactnumberoferrorsinthedeinterleavedworddependsontheburstphasingandlength.TheADSLstandardsspecifytheuseofatypeofinterleavercalledaconvolutionalinter-leaver.SupposewestartenteringcodewordsoflengthNbytesintotheinterleaverattime0.Then,enteringofthejthcodewordstartsattimejN.LetthiscodewordbedesignatedbyjjjXj=[B0,B1,...,BN−1] 17.3ComponentsofaSimplifiedADSLTransmitter283jThesymbolsareenteredintotheinterleaverstartingfromtheleftwithB0attimejNandjjendingontherightwithBN−1attimejN+N−1=(j+1)N−1.SymbolBiisenteredjattimejN+i.TheADSLinterleaverdelaysBibyi(L−1)symbolsfori=0,1,...,N−1.TheintegerLiscalledtheinterleavingdepth.TheANSIstandardrequiressupportofthejvalues1,2,4,8,16,32,and64forLwhichareallpowersof2.ThesymbolBiemergesfromtheinterleaverattimejTi=jN+i+i(L−1)=jN+iL(17.9)WhenNandLarerelativelyprime,eachcodesymbolemergesfromtheinterleaveratadistincttimeandeverytimeslotisfilledwithacodesymbol.WhenNisoddandLisapowerof2,NandLarerelativelyprime.OnepossibleinterleaverimplementationisshowninFigure17.4.EachDrepresentsadelayofonetimeunitforacodesymbol,thatis,abyte,soDLisadelayofLtimeunits.Wewillcallthecascadeofdelayelementsashiftregister.Theoutputofeachadderisthebit-wiseexclusive-orofthetwoinputbytes.AttimejNthesymbolsforcodewordXjappearinparallelattheinputstothe“and”gates.Theoutputofagateistheinputbytewhenthe“Load”signalis1,anda0bytewhenLoadis0.TheLoadsignalbecomes1atjjtimen=jNsoB0appearsattheoutputlabeledIn.TheregisterisclockedonceandB0isclockedoutoftheinterleaverintothenextsystemcomponent.Atthesametime,therestoftheBj’sareloadedintotheDLboxes.ThenLoadissetto0tomaketheoutputsoftheandigates0bytesandtheregistersareclockedN−1moretimes.Thisprocessisrepeatedforeachnewcodeword.TheLoadsignalis0exceptattimesjNwhenanewcodewordarrives.Tosummarize,theNcodesymbolsofanewcodewordareloadedintotheregisterstagesseparatedbyLtimeunitsandthenNbytesareclockedoutoftheregister.ThisprocessisrepeatedeveryNclockpulsesforeachnewcodeword.ItcanbeshownthatwhenNandLarerelativelyprime,newcodesymbolsareenteredintoemptystagesintheregisterandallpositionsarefilledwithbytesfromsomecodeword.Atthestartofeachnewcodeword,thatis,attimejN,thehorizontalinputstotheaddersareallzerobytesthathavebeenloadedintotheshiftregisterduringtheN−1timeswhenLoadis0.ThisstructureisequivalenttotheRamseyTypeII[F.13]interleaver.jjjjBN−1BN−2B1B0Load···InDL+DL···+DL+Figure17.4:ShiftRegisterImplementationoftheADSLInterleaverTheblockdiagramofadeinterleaverisshowninFigure17.5.Assumingthattheinter-leaveroutputisdirectlyconnectedtothedeinterleaverinput,startingattime0,symbolsof 284Multi-CarrierModulationtheinterleavedsequenceareshiftedintoan(N−1)LstageshiftregisterwithtapseveryLstagesasshowninthefigure.Afteradelayof(N−1)Lsymbols,B0appearsattheright0sideoftheshiftregister.ThenNsymbolsarecombedoutoftheshiftregisteratthetapsandcollectedintotheoriginalcodewordtransmittedstartingattime0.ThefigureshowstheseNsymbolsbeingloadedinparallelintoanN-symbolshiftregisterbytheLoadsignal.There-assembledcodewordcanthenbeshiftedoutofthisregisterserially.ItcouldalsojustbewrittenintoanarrayinaRAMmemory.ThisprocessisthenrepeatedcontinuallywithNsymbolsshiftedintotheregisterandNcombedout.Figure17.5showsthesitua-tionwhenthejthcodewordisreadytobecombedoutoftheregister.Eachinputsymboltotheinterleaverexperiencesadelayof(N−1)Lsymbolsbeforeitiscombedoutofthedeinterleaver,ignoringtheothersystemdelays.jjjjBN−1BN−2B1B0IDLDL···DLDLn···Load···InParalleltoSerialConverterFigure17.5:ADeinterleaverTheinterleavercanalsobeimplementedusingaRAMorganizedasatwo-dimensionalarraywithNcolumnsandLrows.AnexampleforN=5andL=2isillustratedinFigure17.6.ArowofNinterleavedsymbolsisreadoutofthearraystartingfromcolumn0ontheleft.Thenthesymbolsofanewcodeword,say,Xj,areenteredintothearrayfromjrowjdowninamannerthatwillnowbedescribed.ThesymbolBishouldappearatthejjinterleaveroutputattimeTi=jN+iLfori=0,...,N−1.ThereforesymbolB0shouldjbewrittenintorowjandcolumn0ofthearray.Thenextsymbol,B1shouldbewrittenjintocolumnLofrowjifLL,$%&'(N−1)LLqN−1==L−=L−1(17.11)NN 17.3ComponentsofaSimplifiedADSLTransmitter285Therefore,thesymbolsofcodewordXjaredistributedoverLrowsstartingwithrowj.Afterrowjisreadout,itscontentsarenolongerneeded.Consequently,therowcanbeclearedandtherowcontainingthelastfewsymbolsforcodewordXj+1canbewrittenintotherowjustreadout.ThusthememorycanbeusedasacirculararrayofLrows.01234j−1...............jj−1jj−1jjB0B3B1B4B2j+1jj+1jj+1j+1B0B3B1B4B2j+2j+1j+2j+1j+2j+2B0B3B1B4B2j+3...Bj+2...Bj+2...34Figure17.6:RAMInterleaverImplementationExampleforN=5andL=217.3.5TheMapandIFFTModulatorBlocksSuccessiveblocksofbitsarecollectedfromtheinterleavereveryT0secondsandassignedtosubcarriersinthetransmittedsymbols.ForADSL,thenominaldatasymbolrateisf0=1/T0=4000symbolspersecond.Thenumberofbitsassignedtoasubcarrierisdeterminedbymeasurementsofthechannelfrequencyresponseandnoiseatthesubcarrierfrequencymadeduringthetransceiverinitializationsequence.Thechannelcharacteristicscanalsobemonitoredduringdatatransmissionandthebitassignmentsadjusted.SeeGolden,etal.,[E.3,pp.204–206]foradiscussionofbitallocationalgorithms.EachgroupofbitsassignedtoasubcarrierismappedtoacomplexnumberZk=Xk+jYkcorrespondingtoapointinaQAMconstellation.Thenumberofbitsassignedtoasubcarriercanrangefrom2through15,thatis,theconstellationsizecanvaryfrom22=4upto215=32,768pointsaccordingtotheADSLstandard.TheconstellationpointsZkfor0≤k≤N/2−1areconsideredtobethefirsthalfoftheelementsofanN-pointDFT.Actually,thestandardrequiresthatZ0=0.TheremaininghalfoftheelementsaresettoZN−k=Zkfork=1,...,N/2−1andZN/2=ZN/2(17.12)ThisimpliesthatZN/2mustbereal.Thestandardspecifiesthatitshouldnotbeusedfordatatransmission.Withthiscomplexconjugatesymmetry,itcanbeshownthattheN-pointtimesequencezn=IDFT{Zk}isreal.Conversely,whenznisreal,itsDFTmusthavethiscomplexconjugatesymmetry.ThecentralofficeATU-CtransmitterusesN=512andtheremoteATU-RtransmitterusesN=64.InFigures17.2and17.8,NSC=N/2. 286Multi-CarrierModulationUsinganIDFTforModulationModulationisperformedbytakinganIDFTofthesequenceofconstellationpoints.SinceNisapowerof2,theIDFTcanbeefficientlycomputedusinganinversefastFouriertransform(IFFT).ThetimesequencecomputedbytheIDFT,andmoreefficientlybyanIFFT,is1N−12π1N−1f1z=ZejNkn=Zej2π(kN)nT1forn=0,...,N−1(17.13)nkkNNk=0k=0wheref=1/Tisthesamplingfrequency.LetZ=AejθkwhereA=|Z|andθ=11kkkkkargZk.UsingthecomplexconjugatesymmetrypropertyoftheZksequenceandassumingZ0=ZN/2=0,itfollowsthatN−112f1f1j2πknT1j2π(N−k)nT1zn=ZkeN+ZN−keNNk=1N−112f1f1=Aej(2πkNnT1+θk)+e−j(2πkNnT1+θk)kNk=1N−122f1=Akcos2πknT1+θk(17.14)NNk=1Therefore,thetimesequencezisthesumofcosinesatthesubcarrierfrequenciesf(k)=nkf1/Nfork=1,...,N/2−1sampledwithperiodT1.Thefrequencyf1/2correspondingtok=N/2iscalledtheNyquistfrequency.AlgorithmforCreatingConstellationsIfbbitsareassignedtoasubcarrier,itsconstellationmusthave2bpoints.Letthebitsassignedtoasubcarrierbethebinaryvector(vb−1,vb−2,...,v1,v0)whichhasthedecimal(b−1ivalued=i=0vi2.IntheANSIT1.413-1998ADSLstandard[E.1],theXandYcoordinatesofaconstellationpointwhenbisevenare,towithinascalefactor,theoddintegerswiththe2’scomplementrepresentationsXk↔(vb−1,vb−3,...,v1,1)andYk↔(vb−2,vb−4,...,v0,1)(17.15)Constellationsforb=2and4areshownifFigure17.7.TheADSLstandardalsogivesanalgorithmforconstellationswithbodd.Inpractice,theactualconstellationsarescaledtogivedesiredpowerlevelsforeachsubcarrier.TheANSIADSLstandard[E.1,Section6.8]alsoincludesanoptionforusinga4-dimensional,16-state,Wei[F.18]trelliscodeforconvertinginputdatabitstosequencesofconstellationpoints.ThiscodeisaslightvariationoftheoneusedinV.34modems.Thedetailsofthiscodewillnotbedescribedhereandareleftforinterestedreaderstopursue. 17.3ComponentsofaSimplifiedADSLTransmitter287YkYk911133201810021−11−3−113XkXk-131131557−1-3121446(a)4-PointConstellationforb=2(b)16-PointConsellationforb=4Figure17.7:Constellationswith4and16PointsTheCyclicPrefixTheimpulseresponseofalocallooplastsformanysamples.However,itchangesveryslowlyovertime,sothelocalloopcanbeconsideredtobealineartime-invariantsystem,forallpracticalpurposes.Theimpulseresponseofawirelesschannelcanalsolastformanysamplesasaresultofmulti-pathpropagationandthisisreferredtoasdelayspread.Thewirelesschannelcanchangerelativelyquicklywithtimeasaresultofmotionofthetransmitter,receiver,andreflectingobjectsandmustbetreatedasatime-varyingchan-nel.However,multi-carriermodulationandlineartime-invariantmethodscanbeusedifthechannelchangesinsignificantlyoverthedurationofasymbolandchannelestimatesarecontinuallyupdated.Ineithercase,thechannelimpulseresponsecausesintersymbolinter-ference(ISI)betweenadjacentmulti-carriersymbols.Supposetheimpulseresponse,h(n),canbenonzeroonlyforn=0,1,...,Landasymbol,zn,startingattimen=0endsattimen=Mandthesymboldurationislongerthantheimpulseresponseduration,thatis,M>L.TheISIfromthissymbolintothenextisMI(n)=zkh(n−k)forn=M+1,...,M+L(17.16)k=n−Lash(n−k)slidesofftherightsideofthenon-zeroportionofzk.Asimilarinitialtransientoccursash(n−k)slidesontothenextsymbolduringthesametimeperiod.TheISIandinitialtransientproblemhasbeensolvedforwirelineandwirelesssystemsbyincreasingthesymboldurationtoN=N+νsamplesbyprependingacleverlychosensequenceofνsampleswhichislongerthantheimpulseresponseduration.ThisprovidesaguardtimebetweensymbolsfortheISItodisappear.Theprependedsamplesarethelastνsamplesofthesymbol,thatis,(zN−ν,...,zN−2,zN−1),sotheaugmentedsymbolsequenceis(zN−ν,...,zN−2,zN−1,z0,z1,...,zN−1).Supposez0occursattimen=0.Thenthechannel 288Multi-CarrierModulationoutputfor0≤n≤N−1,ignoringnoise,isnNr(n)=zmod(k,N)h(n−k)=zkhmod(n−k,N)(17.17)k=n−Lk=0whereh(n)for0≤n≤Lhn=0forL+1≤n≤N−1Thisformulacanbethoughtofastheconvolutionofh(n)withaperiodicallyrepeatedversionoftheNsymbolsamplescomputedbytheIFFT,orthecircularorcyclicconvolutionoftheN-pointsequencesznandhn.TheDFTofthecyclicconvolutionoftwoN-pointsignalsistheproductoftheirDFT’s,thatisRk=DFT{rn}=DFT{zn}DFT{hn}=ZkHk(17.18)TheN=N+νpointsoftheaugmentedsequencearesenttotheDACstartingwiththecyclicprefix.TheATU-CandATU-Rbothusecyclicprefixesoflengthν=N/16.ThusthelengthofthecyclicprefixfortheATU-Cisν=512/16=32andN=544.FortheATU-R,CCν=64/16=4andN=68.RRTheActualSamplingRatesandSubcarrierFrequenciesTheATU-CandATU-RinsertaknownN-pointsyncsequenceintheirsymbolstreamsafterevery68datasymbols.Tomaintainadatasymbolrateof4000datasymbolspersecond,thechannelsymbolrateisincreasedbythefactor69/68.Therefore,thesamplingratesare69×4000×544=2.208MHzforATU-C6968f1=×4000×(N+ν)=(17.19)6869×4000×68=276kHzforATU-R68Thesubcarrierfrequenciesinbothcasesaremultiplesoff1/N=4.3125kHz.17.3.6SomeSignalsUsedforInitializationandSynchronizationTheADSLstandardsdefineacomplicatedproceduretoinitializethecentralofficeandremotetransceiversforfullduplexdatatransmission.Interestedreadersshouldconsultthestandardsforallthedetails.AfewofthesignalsdefinedintheANSIstandardwillbedescribedinthissectionsotheycanbeusedfortheexperiments.OneobvioussignaliscalledQUIET.Thissignalisjust0voltsforaperiodoftime.Itisusedbeforetransmissionstartsandthetransceiversareidleaswellasbetweenseveralsegmentsoftheinitializationsequence.AsignaltransmittedbytheATU-CiscalledC-REVERB.ThissignalallowstheATU-Rtoadjustitsautomaticgaincontrol(AGC),synchronizeitstiming,measurenoiseonthechannel,measurethechannelamplituderesponse,andadjustitsadaptiveequalizer.The 17.3ComponentsofaSimplifiedADSLTransmitter289databitsequenceforaDMTC-REVERBsymbolisgeneratedstartingattimen=1bythefollowingrule:dn=1forn=1,...,9(17.20)dn=dn−4+dn−9forn=10,...512where“+”ismodulo2addition.Thebitsd1throughd9areinitializedtoall1’sforeachC-REVERBsymbol,sotheC-REVERBsymbolsallusethesamedatasequence.Thisistherulefora9-stagePNsequencegeneratorasdiscussedinChapter9andshowninFigure9.1excepttheoutputistakenfromthedelayelementontherightsideofthegeneratorandallthedelayelementsareinitiallysetto1.Theconnectionpolynomialistheprimitivepolynomialh(D)=1+D4+D9.Theperiodofthissequenceis29−1=511,sod=d.5121Subcarriers0and256aresetto0andbitsd1andd2arenotused.Bitpairs(d2k+1,d2k+2)areusedtoQPSKmodulatesubcarriersk=1,...,255asshownuptoascalefactorinTable17.1.Bitsd129andd130whichmodulatesubcarrier64areoverwrittenbybits(0,0)togeneratetheconstellationpoint(X64,Y64)=(+1,+1)toformapilotcarrier.The512C-REVERBsymboltimesamplesaretransmittedwithoutthecyclicprefix.TheC-REVERBsymbolisrepeatedanywherefrom512upto1536timesdependingontheseveralpositionsitoccupiesintheinitializationsequence.AnothersignalcalledC-SEGUEisthe180degreephasereversalofC-REVERBfor10symbolsandfollowsrightaftertheendofC-REVERB.Thisphasereversalcanbedetectedbythereceiverandusedasatimingmark.Table17.1:MappingofTwoDataBitstoQPSKConstellationPointsd2k+1d2k+2DecimalLabelXkYk000+1+1011+1−1102−1+1113−1−1TheATU-Rtransmitssimilarsignals.ThebitsforR-REVERBaregeneratedbya6-stagePNsequencegeneratoraccordingtotherule:dn=1forn=1,...,6(17.21)dn=dn−5+dn−6forn=7,...64Bitsd1throughd6areinitializedtoall1’sforeachR-REVERBsymbol,sotheyallusethesamedatasequence.Thissequencehasperiod63sod64=d1.Subcarriers0and32aresetto0andbitsd1andd2arenotused.Bitpairs(d2k+1,d2k+2)areusedtoQPSKmodulatesubcarriersk=1,...,31asshownuptoascalefactorinTable17.1.Bitsd33andd34whichmodulatesubcarrier16areoverwrittenbybits(0,0)togeneratetheconstellationpoint(X16,Y16)=(+1,+1)toformapilotcarrier.R-REVERBistransmittedwithnocyclicprefixandrepeatedmanytimes.AnR-SEGUEsimilartoC-SEGUEisusedtogenerateatimingmark. 290Multi-CarrierModulationTheATU-CandATU-Rbothsendasynchronizationsymbolafterevery68datasymbols.ThesesymbolsareidenticaltoC-REVERBandR-REVERBexceptthatthecyclicprefixesareincluded.17.4ASimplifiedADSLReceiverTheblockdiagramofasimplifiedADSLreceiverisshowninFigure17.8.Signalsfromthefarendtransmitterarefirstappliedtoananalog-to-digitalconverter(ADC).ThesamplingrateforthesignalreceivedattheATU-RreceiverfromtheATU-Ctransmitteristypicallyf1=2.208MHzwhichistwicetheNyquistfrequencyforthedownstreamsignal.ThesamplingrateforthesignalreceivedattheATU-CreceiverfromtheATU-Rtransmitteristypicallyf1=276kHz.Theremainingblocksinthefigure,exceptfortheFrequencyDomainEqualizer,performtheinverseoperationsofthoseinthetransmitter.DataDoCyclicSinkRedundancyCollectCheck2NSC-pointFrequencyablockMapblockDomainofFFTofNSCEqualizersamplesDescramblerNSC−1QAM(Demod)..and(FEQ).constellationReed-Solomon....removepointsto..CyclicDecoderablockofPrefix1databitsConvolutional0DeinterleaverFromlocalloopADCFigure17.8:SimplifiedBlockDiagramofanADSLReceiverOneblockthathasnotbeenshowniscalledatime-domainequalizer(TEQ).Theimpulseresponseofalocalloopisoftenlongerthanthelengthsofthecyclicprefixesspecifiedinthestandards.ThisproblemhasbeensolvedbyputtinganadaptivefilterbetweentheADCand“Collectablockofsamples”block.Thejobofthisfilteristoshortenthechannelimpulseresponsetoanacceptablelength.Itistrainedduringtheinitializationprocedure.Thistypeoffilterisusuallynotusedinwirelesssystemsbecausethesignalparametersarechosentomakethedelayspreadnolongerthanthecyclicprefixlength.Also,thefilterwouldhavetobeupdatedasfastasthewirelesschannelchanges.WewillnotimplementtheTEQinthiscourse.SeeChapter11ofGolden,etal.,[E.3]fordetails.Otherblocksthathavenotbeenshownexplicitlyarethoseforsamplingclockandsymbolclockacquisitionandtracking.Thesefunctionsarecriticalinmakingatransceiveractuallyworkintherealworldbutareusuallyoverlookedintextbooks.Theyareimplicitlyincluded 17.4ASimplifiedADSLReceiver291inthe“Collectablockofsamples”block.ApproachestotimingacquisitionandtrackingwillbediscussedinSections17.4.2and17.4.3.17.4.1DemodulationandFrequencyDomainEqualizationThesamplesforaDMTsymbolarecollectedandasequenceofN=2NSCconsecutivesamplesareextractedbyremovingthecyclicprefix.Lettheresultingsequenceforsymbolibern,iforn=0,...,N−1.TheFFTdemodulatoroutputisN−1−j2πnkRk,i=rn,ieN=Zk,iHk+Vk,ifork=0,...,N−1(17.22)n=0whereHisthechannelfrequencyresponseatsubcarrierk,S=E{|Z|2},andViskkk,ik,iazero-meannoisesamplewithvarianceσ2=E{|V|2}.TheeffectofHistoscaleandkk,ikrotatethereceivedconstellation.Onlythelowerhalfofthepointsareneededbecauseofthecomplexconjugatesymmetryofthetransformofarealsequence.ThechannelfrequencyresponsecanbeestimatedduringinitializationwhenaknowsequencelikeREVERBistransmittedformanysymbols.OnemethodforestimatingHkistoaverageRk,i/Zk,ioveranumberofsymbols.Thisassumesthatthesampleclockhasalreadybeenadequatelyacquiredanddriftsnegligiblybetweensymbols.Theinitialchannelfrequencyresponseestimatescanbeadaptivelyupdatedduringregu-lardatatransmissiontorefinetheinitialestimates,trackslowchangesinthechannelcausedbyenvironmentalfactorslikedailyvariationsintemperature,andcompensateforsmallsam-pleclockdrifts.TheLMSalgorithm,discussedforsinglecarriermodemsinChapter15,withaone-tapequalizercanbeusedforeachsubcarrier.Theresultingsetofequalizersiscalledafrequencydomainequalizer(FEQ).LettheequalizercoefficientforsubcarrierkbeWk,theequalizedreceivedpointbeZ˜k,i=WkRk,i,andtheestimationerrorbe∆k,i=Zk,i−WkRk,i.Undernoisyconditions,Wkcanbechosentominimize2Λk=E|∆k,i|=E(Zk,i−WkRk,i)(Zk,i−WkRk,i)(17.23)IfHkisknown,theclosedformsolutionisWˆ=SkH(17.24)kS|H|2+σ2kkkkandthecorrespondingmean-squarederrorisΛˆ=σ2Sk(17.25)kkS|H|2+σ2kkkSinceHkisnotactuallyknown,theiterativeLMSalgorithmcanbeused.LetAkandBkbetherealandimaginarypartsofWksothatWk=Ak+jBk.TakingderivativesasintheLMSderivationinChapter15gives∂Λk=−2E{e{∆k,iRk,i}}(17.26)∂Ak 292Multi-CarrierModulationand∂Λk=−2E{ m{∆k,iRk,i}}(17.27)∂Bkso∂Λk∂Λk∂Λk=+j=−2E{∆k,iRk,i}(17.28)∂Wk∂Ak∂BkThissuggeststheapproximateupdateformulaWk(i+1)=Wk(i)+µ∆k,iRk,i=Wk(i)+µ[Zk,i−Wk(i)Rk,i]Rk,i(17.29)whereµisasmallpositiveconstant.ItwasstatedinChapter15thatinorderforthemean-squarederrortoconverge,µmustsatisfythestabilityconstraint2220<µ<2/E{|Rk,i|}=2/(Sk|Hk|+σk)(17.30)Sincetheproduct∆k,iRk,iisaroughestimateofitsexpectedvalue,thecoefficientestimateconvergestothecorrectmeanvaluewithexcessfluctuations.Makingµsmallreducestheexcessvariancebutslowstheconvergencetime.Aformulafortheexcessmean-squarederrorisgivenby(15.29).ThetruevalueofZk,iisnotknownatthereceiver.However,afterinitialchannelesti-mation,theequalizeroutputZ˜k,i=WkRk,iwillbeclosetothetruevalue.ThenanaccurateestimateofZk,icanbemadebyquantizingZ˜k,itotheclosestidealconstellationpoint.Thequantizationprocedureresultsinveryaccuratedecisionsduringinitializationsymbolsequenceswhenthe4-pointQPSKconstellationisused.This“decisiondirected”approachworksverywellinpracticeevenforconstellationsoflargesizeaftertheequalizercoefficienthasconvergedandµismadesmall.17.4.2SampleClockAcquisitionandTrackingThesampleclocksinatransmitterandremotereceiverwillhavesomefrequencyoffset.Thisoffsetwillbesmallbecausethestandardsplacetighttolerancesontheclockfrequency.Nev-ertheless,asmallfrequencyerrorwillaccumulatetoalargephaseerrorovertimeleadingtosignificantdegradationofperformance.Thereceivermustlockitsclocktothetransmitterclockbasedontiminginformationderivedfromitsreceivedsignal.Theoffsetcanbeesti-matedinanopenloopmannerduringinitializationwhenknownsignalsaretransmitted,andupdatedinaclosedlooptrackingmodeduringnormaldatatransmission.Mostsystemsuseaphase-lockedloop(PLL)togenerateandtrackthesamplingtimes.Somesystemsemulateaphase-lockedloopinsoftwareusingnumericalinterpolationorbufferswithsamplestuffingordeletiontoeliminatethecostofthehardwarePLL.EffectofSampleClockOffsetontheOutputoftheReceiver’sFFTLetT1=1/f1bethesamplingperiodofthetransmitter.Considerthesymbolwithsamples,zn,givenby(17.13)startingattimen=0withaνsamplecyclicprefixlongerthanthe 17.4ASimplifiedADSLReceiver293channelimpulseresponseprependedfortime−ν,−ν+1,...,−1.WhenthisN+νpointsequenceisappliedtotheDAC,theresultingcontinuous-timesignalis1N−1f1j2πtz(t)=ZeN(17.31)N=0LetthesamplingperiodatthereceiverbeT2=(1+)T1whereisasmallconstant.Then,thesamplesobservedatthereceiverare1N−1f11N−12πj2πn(1+)T1j(1+)nrn,0=HZeN=HZeN(17.32)NN=0=0whereHkisthechannelfrequencyresponseatsubcarrierk.ThereceivercomputestheDFTofthissequencetogetN−12πN−11N−12π2π−jnkj(1+)n−jnkRk,0=rn,0eN=HZeNeNNn=0n=0=0N−11N−12πN−1jn[(1+)−k]=HZeN=HZQ(k,,)(17.33)N=0n=0=0whereN−1j2π[(1+)−k]1j2πn[(1+)−k]1e−1Q(k,,)=eN=2π(17.34)NNejN[(1+)−k]−1n=0Byfactoringoutetohalftheexponentinthenumeratoranddenominator,thiscanbeputintothefollowingmoreinformativeform:j2π[(1+)−k]N−1sinπ[(1+)−k]Q(k,,)=eN2(17.35)Nsinπ[(1+)−k]NEquation(17.33)showsthataneffectoftimingoffsetistointroducecrosstalkfromonesubchannelintoanother.ThecomponentproportionaltoZkinRk,0isj2πk N−1sinπkHkZkQ(k,k,)=HkZkeN2(17.36)NsinπkNThetimingfrequencyoffsetcausesaphaserotationofHZbytheangleβ=k2πN−1kkkN2thatincreaseslinearlywithfrequencyindexandscalesitsamplitude.Theamplitudescalingisnegligibleforsmall||andcomputationshowsthatthecrosstalkcomponentsaresmallwhenthetimingoffsetiswithinthetolerancesrequiredbythestandards.Therefore,j2πk N−1Rk,0≈HkZkeN2for|| 1(17.37) 294Multi-CarrierModulationOpenLoopEstimationoftheSampleClockPeriodErrorNowsupposethesymbolincludingthecyclicprefixisrepeatedstartingattimeN.Thetransmittedsignalisz1(t)=z[t−(N+ν)T1]forNT1≤t≤(2N+ν)T1.ThecyclicprefixforthisrepeatedsymbolextendsoverNT1≤t≤(N+ν)T1.Skippingoverwhatitthinksisthereceivedcyclicprefix,thereceivercollectstheN-pointsequencern,1=z1[(n+N+ν)T2]=z1[(n+N+ν)(1+)T1]=z[n(1+)T1+(N+ν)T1]N−11j2π (N+ν)j2π(1+)n=HZeNeNforn=0,...,N−1(17.38)N=0andcomputestheDFTN−1j2π (N+ν)Rk,1=HZeNQ(k,,)(17.39)=0Again,thesubcarriercrosstalkissmallif|| 1andj2πk N−1j2πk (N+ν)Rk,1≈HkZkeN2eN(17.40)Atthispointintheinitializationprocedure,thechannelfrequencyresponseHkmaynotbeknownyet.ThephaseeffectsofthisresponseandtheconstellationpointZkcanberemovedbyformingtheproduct2j2πk (N+ν)Γk,1=Rk,1Rk,0=|HkZk|eN(17.41)whichhastheangle2πϕk,1=argΓk,1=k(N+ν)(17.42)NTheprecedingderivationshaveneglectedtheeffectsofnoise.AnaccurateestimateofcanbeobtainedwhennoiseispresentbyaveragingΓk,i=Rk,iRk,i−1overseveralsymbolsforarangeofk,computingphaseestimatesˆϕkfromtheaverages,andthenchoosingtoformaleast-squaresfitofastraightlinetothephaseestimatesovertherangeofk.Supposetherangeisk1≤k≤k2.Thentheleast-squaresfitestimateis⎛⎞−1Nk2k2ˆ=⎝k2⎠kϕˆ(17.43)k2π(N+ν)k=k1k=k1ThesumofsquarescanbecomputedbyusingtheformulaNN(N+1)(2N+1)2k=(17.44)6n=1 17.4ASimplifiedADSLReceiver295TrackingtheSampleClockPeriodOnceinitializationisfinished,randomDMTsymbolsgeneratedbycustomerdataaretrans-mittedandtheopenloopmethodofestimatingthetimingperioderrorjustpresentedcannotbeused.Attheendofinitialization,thefrequencydomainequalizer(FEQ)shouldbewelladjustedandagoodestimateofshouldhavebeenmadeandinsertedintotheclockgen-erator.Theconstellationsobservedforeachsubcarrierattheoutputofthereceiver’sFFTshouldbeveryclosetotheidealtransmittedconstellations.Ifthereisasmallresidualclockperioderror,theconstellationswillappeartoslowlyrotateiftheFEQiskeptconstantasshownby(17.42).Theseobservationssuggeststhatadecision-directedmethodcanbeusedfortrackingthesampleclock.LetZˆ=|Zˆ|ejαk,ibetheidealconstellationpointclosestk,ik,itotheequalizedpointZ˜=|Z˜|ejψk,iforthesymbolattimei.Theoperationoffindingk,ik,ithisidealpointisoftencalledquantizingorslicingZ˜k,itothenearestidealpoint.Theanglebetweentheequalizedandestimatedidealconstellationpointscanbedeterminedasζ=arg(Z˜Zˆ)=arg|Z˜||Zˆ|ej(ψk,i−αk,i)=ψ−α(17.45)k,ik,ik,ik,ik,ik,ik,iInrectangularformZ˜k,iZˆk,i=|Z˜k,i||Zˆk,i|cosζk,i+j|Z˜k,i||Zˆk,i|sinζk,i(17.46)Thephaserotationfromonesymboltothenextwillbesmallwhenthesampleclockisbeingtrackedwell.Usingtheapproximationsinx≈xfor|x| 1andthefactthat|Z˜k,i|≈|Zˆk,i|whentheFEQiswelladjusted,givesm{Z˜Zˆ}=|Z˜||Zˆ|sinζ≈|Z˜||Zˆ|ζ≈|Zˆ|2ζ(17.47)k,ik,ik,ik,ik,ik,ik,ik,ik,ik,iwhichisproportionaltothephaserotation.Computingm{Z˜k,iZˆk,i}fromtherectangularformsrequiresthedifferenceoftworealproductsandisanefficientmethodforimplemen-tationwithDSP’s.Accordingto(17.42)ζk,ishouldbeproportionaltothefrequencyindexkandifnoiseisignored.Astraightlinecanbefittothephaserotationsatdifferentsubcarrierstogivethefollowingformulasimilarto(17.43)forestimatingtheresidualtimingoffsettowithinaconstant:ζi=Ckζk,i(17.48)kusedwhereCisanappropriatescalefactor.Thephaserotationestimatecanbeusedtoupdatethesamplingperiodofahardwarephase-lockedloop.Ifζi>0,theconstellationhasrotatedcounterclockwise(inthepositivedirectionmathematically),andthesamplingperiodistoolargeandshouldbereduced.ThiscanbedoneinhardwarebyinsertingextrahighspeedclockpulsesintoadividerchaininthePLL.Ifζi<0thesamplingperiodistoosmallandshouldbeincreased.Thiscanbedoneinhardwarebyinhibitingpulsestoadividerchain.TheTMS320C6713DSKdoesnothaveacodecthatincludesahardwarePLLforthesampleclock,sowewillhavetouseadifferentapproach.SupposetheFEQisperfectlyadjustedatsymboltimeiandisheldconstantafterthat.Atsymboltimeitherewillbenoconstellationrotation.Accordingto(17.42),theconstellationatsymboltimei+1will 296Multi-CarrierModulationberotatedbyϕ=2πk(N+ν).Thiscanbecorrectedbyrotatingtheequalizedpointk,1Nintheoppositedirectionbyϕk,1.Mathematically,thecounter-rotationcanbeaccomplishedbymultiplyingtheequalizedpointZ˜bye−jϕk,1.Eachsuccessivesymboltheequalizedk,i+1pointhastobecounter-rotatedbyalargerangle.Thatis,atsymboli+qtheequalizedpointwouldhavetoberotatedbyangle−qϕk,1.Asecond-orderPLLcanbeimplementedtogeneratetherequiredrotation.LetthePLLoutputatsymboltimeibeτi.Thecorrespondingconstellationpointshouldberotatedbytheangle−2πkτ(N+ν).First,thephaseerrorsareaccumulatedusingtheequationNiδi=δi−1+βζi(17.49)Then,thePLLoutputiscomputedasτi=τi−1+δi(17.50)whereαandβaresmallconstants.Theideaisthatwhenthephaserotationestimateζihasaconstantcomponent,itsaccumulatedvaluewillconvergeintheclosedlooptotheconstantrequiredtoincrementτieachiterationtoforcetheobservedrotationerrortozero.Addingaαζitermtotheequationforτiwouldallowthelooptoeliminateaconstantconstellationtilt.However,theFEQalreadycorrectsforanyconstanttilt,soitisnotnecessarytoaddthistermhere.Forthisarrangementtoworkcorrectly,theFEQmustchangeitscoefficientsmuchmoreslowlythanthetimingPLLtracks.ThePLLoutputτiwillgrowlinearlywithoutboundunlesssomecorrectiveactionistaken.Ifnoactionistaken,thesymboltimingcanslipintothecyclicprefixorintoanadjacentsymbol.Anapproachistokeep|τi|≤0.5bystuffingorrobbingasamplebetweensymbols.Whenτiexceeds0.5,thisindicatesthattheequalizedconstellationsarerotatedinacounter-clockwisedirectionandthesamplingperiodistoolarge.Thiscanbecorrectedbyadvancingthetimingbyonesample.Theadvancecanbeimplementedby“stuffing”anextrasampleintothecyclicprefixtomovetheNpointscollectedforthesymbolforwardinthesamplebufferbyonesample.Thenτishouldbereplacedbyτi−1.Whenτibecomeslessthan−0.5,thisindicatesthesamplingisoccurringtooearlyandaonesampledelayshouldbeintroduced.Thiscanbeaccomplishedbydeletingor“robbing”asamplefromthecyclicprefixtomovethesymbolcollectiontimeonesamplelaterrelativetothesamplebufferandthenτishouldbereplacedbyτi+1.Inthisscheme,τiwillvarybetween−0.5and0.5.17.4.3SymbolAlignmentAcquisitionandTrackingThereceivermustdeterminewhereasymbolstartssoitcandeletethecyclicprefixandselectasequenceofNISIfreesamplesfortheFFTdemodulator.Beforetheinitializationprocessbegins,thetransmittersaresilent.Areceivercanmonitorthepowerlevelofitsinputsignal,detectajumpaboveapresetthreshold,anddeterminerelativelyquicklywhenaninitializationsignalhasstarted.SpecialtrainingsignalslikeREVERB,whichconsistsofrepeatedsymbolswithoutcyclicprefixes,aresentduringinitializationforspecifiedtimeintervals.Symbolcountingfromthedetectionofthestartofinitializationcangiveaballparkestimateofwhendatasymbolsbegin.Tohelpthesymbolsynchronizationprocess,the 17.4ASimplifiedADSLReceiver297SEGUEsequenceissentfor10symbolsattheendofREVERB.SEGUEsymbolsarethe180degreephaseshiftofREVERBsymbols.Thisphasereversalcanbeaccuratelydetectedandusedasatimingmark.Onceregulardatasymbolsaretransmitted,aνsamplecyclicprefixisincludedinthesymbols.ThereceivercansearchsymbolsfortherepetitionoftheprefixNsampleslaterbysometypeofcorrelationprocess.Forexample,thereceivercouldcomputetheperiodicitymetricnnnn222pn,i=(r,i−r−N,i)=r,i+r−N,i−2r,ir−N,i(17.51)=n−d=n−d=n−d=n−dwheredissomewhatlessthanthecyclicprefixlengthν.Thiscouldalsobeaveragedoverseveralsymbols.Themetricwillbeclosetozerowhennisattheendofthesymbolandthetwosamplessubtractedaretheoreticallyidenticalandgetslargeelsewhere.Ofcourse,theywillnotbeidenticalintherealworldbecauseofnoiseandISI.Theminimumofthemetricindicatesthelocationoftheendofasymbol.Atestforthelocationoftheminimumistocheckwhenforsomeappropriatelychosensmallpositiveconstantγ⎛⎞nnnnnr2+r2−2rr<γ⎝r2+r2⎠(17.52),i−N,i,i−N,i,i−N,i=n−d=n−d=n−d=n−d=n−dor⎛⎞n1−γnnrr>⎝r2+r2⎠(17.53),i−N,i2,i−N,i=n−d=n−d=n−dInthislastform,thesearchisforcorrelationpeaksratherthanperiodicitymetricnulls.Thecomputationcouldbesimplifiedbyreplacingtheright-handsidebyafixedthreshold.However,thesumontheright-handsideisanestimateoftheaveragepowerandprovidesanautomaticthresholdnormalization.Duringdatatransmission,thespecialsyncsymbolissentafterevery68regulardatasymbols.Acorrelationpeaksearchforthesyncsymbolcouldalsobeusedtoaidsymbolsynchronization.17.4.4RemainingBlocksTheremainingblocksinthereceiverdothereverseofthecorrespondingblocksinthetrans-mitter.TheconstellationpointsattheoutputoftheFEQarequantizedandmappedbackintoabitsequence.Thissequenceisdeinterleaved,processedbytheReed-Solomondecoder,descrambled,andCRCchecked.Theresultingoutputbitsaresenttothedatasink.AnyCRCerrorsarereportedtothemaintenancefunctions.Thedescramblerisdescribedby(17.5).TheReed-Solomondecodingalgorithmisbeyondthescopeofthisbook.InterestedreaderscanfindthedetailsinbooksonerrorcorrectingcodeslikeWicker[F.19].TheCRCcheckisperformedbyshiftingacodewordincludingtheCRCbitsintotheCRCgeneratorshowninFigure17.3startingwithallthedelayelementscleared.Theregisterdelayelementsshouldallbe0whenthelastbitisshiftedinforthechecktopass. 298Multi-CarrierModulation17.5MakingaSimplifiedADSLTransmitterandRe-ceiverInthisexperimentyouwillmakeasimplifiedversionofanANSIT1.413-1998[E.1]ADSLATU-RtransmitterandATU-Creceiver.SettheTMS320C6713DSKsamplingratetof1=16kHz.ThetransmittershoulduseanN=64pointIFFTandthereceivera64-pointFFT.Thesubcarriersareatfrequenciesthataremultiplesof16000/64=250Hz.Thesubcarriersfork=0and32shouldbesettozeroandnotused.Thesubcarriersfork=1,...,31willbeusedtosendQPSK(4-QAM)or16-QAMconstellationscorrespondingto2and4bitsperconstellationpoint,respectively.Thesubcarrierpointsfork>32aredeterminedbytheconstellationpointsfork<32bythecomplexconjugatesymmetryruleZ64−k=Zkfork=1,...,31(17.54)whichwillforcezn=IFFT{Zk}tobereal.Useacyclicprefixofν=4samples.Youmayhavetolengthenthisaftermeasuringthechannelimpulseresponse.ThenthelengthofregulardatasymbolswillbeN=68samples.Thenumberofsymbolstransmittedpersecondwillbe16000/68=235.294.Theminimumnumberofbitstransmittedpersymbolis2×31=62whenQPSKisusedforalltheusedsubcarriersgivingadatarateof62×16000/68=14588.235bitspersecondifnosyncsymbolsareused.Themaximumnumberofbitspersymbolis4×31=124when16-QAMisusedforalltheusedsubcarriersgivingadatarateof124×16000/68=29176.47bitspersecondifnosyncsymbolsareused.Thisratesarescaledby68/69whenasyncsymbolisinsertedafterevery68datasymbols.Carryoutthestepsinthefollowingsubsectionstomakeandtestyourtransmitterandreceiver.17.5.1Makinga64-PointIFFTanda64-PointFFTYouwillneeda64-pointIFFTforyourtransmitteranda64-pointFFTforyourreceiver.Modifythedecimation-in-timeFFTfunctionfromChapter4tobea64-pointIFFT.Thisfunctionshouldacceptthe64-pointconstellationarrayinnaturalorder,shuffleitintobit-reversedorder,andthenperformtheequivalentofthe“decimation-in-time”FFTalgorithmtogettheoutputtimesequenceinnaturalorder.Readrequiredcosineandsinevaluesforthe“twiddlefactors”fromapre-computedtableratherthancomputethemrecursivelylikeintheFFTfunctionfromChapter4.Onlyasinglesinetableisneeded,notbothasineandcosinetable,becausecosθ=sin(θ+π/2).Youcanachievesomecomputationalsavingsinthelaststagebyusingthefactthattheoutputmustberealandnotcomputingtheimaginarypart.TestyourIFFTbyputtinginsomesequencesthathaveknownoutputs.Forexample,Zk=cos(2πmk/64)hastheIFFT,zn=0.5δ[n−m]+0.5δ[n−(64−m)].Modifythedecimation-in-timeFFTfunctioninChapter4tobea64-pointFFT.Again,readthesine/cosinetwiddlefactorsfromatable.Somecomputationalsavingscanbeachievedbyusingthefactthattheinputisrealinthefirststage.TestyourfunctionbyusingsomeinputswithknownFFT’s. 17.5MakingaSimplifiedADSLTransmitterandReceiver29917.5.2MakingaScrambler,ConstellationPointMapper,andTheirInversesImplementthe23-stageselfsynchronizingscramblerpresentedinSection17.3.2withinputx(n)=1forallntogeneratesimulatedcustomerrandomdata.BypasstheCRCgenerator,Reed-Solomonencoder,andconvolutionalinterleaverforthetimebeing.Youcanimplementtheselaterasoptionalexercises.InitiallyyouwilltestyourtransmitterwithQPSKconstel-lationsforallofthe31usedsubcarriers.Inthismode,youshouldgenerateblocksof62bitswiththescrambler.Lateryouwilluse16-QAMforall31usedsubcarrierswhichwillrequireblocksof124bits.Makeafunctionthatmapsanarrayof62inputbitsintoa64elementcomplexarrayZwithZ[0]=Z[32]=0,Z[1],...,Z[31]QPSKconstellationpointsXk+jYkcorrespondingtosuccessivepairsofinputbitsusingtherulestatedonpage287andillustratedinFigure17.7,andZ64−k=Zkfork=1,...,31.Makeanotherfunctionfor16-QAMthatmapsanarrayof124inputbitsintoa64elementcomplexarrayZwithZ[0]=Z[32]=0,Z[1],...,Z[31]16-QAMconstellationpointsXk+jYkcorrespondingtosuccessivegroupsoffourinputbitsusingtherulestatedonpage287andillustratedinFigure17.7,andZ64−k=Zkfork=1,...,31.Maketheinversefunctions.Thatis,makefunctionstoconverta64elementcomplexarraybackintoanarrayof62bitsforQPSKand124bitsfor16-QAM.ThesefunctionsshouldquantizeacomplexpointR[k]correspondingtoanelementoftheoutputoftheFFTinthereceivertotheidealconstellationpointshowninFigure17.7thatisnearesttoitinEuclideandistance,andputthetwoorfourdatabitscorrespondingtothequantizedpointintoa62or124elementarrayfork=1,...,31.Implementadescramblerusing(17.5).Testyourinversemappersanddescramblerseparately.Thentestthecascadeofthescrambler,mapper,inversemapper,anddescramblerforastringoftransmittedDMTsymbols.DothisinternallyinaprogramforoneDSPwithoutworryingaboutgettingdatatoandfromthecodec.Theoutputofthedescramblershouldbeall1’sexcept,possibly,forashortinitialtransientifthescrambleranddescramblerinitialstatesdiffer.Oncethecascadeisworking,insertthetransmitterIFFTandreceiverFFT.FirstleavetheIFFToutputasafloating-pointarray.UsethisarrayastheFFTinput.DothisinternallyinthesingleDSPprogramwithoutworryingaboutgettingdatatoandfromthecodec.NextconverttheIFFToutputarraytoanintegerformatscaledappropriatelyfortherightcodecchannelanduseitinternallyintheprogramasthereceiverFFTinputandcheckthatthecascadeworks.Youwillhavetostructuretheinversemappertoaccountforthescaling.17.5.3MeasuringtheChannelImpulseResponseDurationYouwillsendthesamplesgeneratedintheDSPforthetransmitterthroughtheDACintheAIC23codectotheLineOut,throughacablefromtheLineOuttotheLineInofthereceiver,andthroughtheADCofthecodec.Initially,youwilllooptheLineOutoftheDSKbacktotheLineInofthesameDSK.Later,youwillconnecttheLineOutofonestationtotheLineInofanotherstation.Thechannelsforbothofthesecasesshouldbeverysimilar.Thedurationofthechannelimpulseresponsemustbeknowntoselectthelengthofthe 300Multi-CarrierModulationcyclicprefix.Writeaprogramtofirstsend128zerostotherightchannelADCtoclearanyinitialstartuptransients.ThensendperiodicpulsestotherightchannelADC.Forexample,send∞s[n]=15000δ[n−64k](17.55)k=2Thescalefactor,15000,waschosentouseasignificantportionoftherangeoftheADC.Thissignalisaperiodictrainofunitpulsesoccurringevery64sampleswithzerosinbetween.LooptheLineOutbacktotheLineInofthesameDSK.Collect128samplesfromtheLineIninanarraystartingwhenyousendthefirstpulse.Examinethearrayusingawatchwindowor,perhaps,moreinformativelybyusingthegraphingcapabilitiesofCodeComposeranddeterminethedurationofthechannelimpulseresponse.YoucanalsoconnecttheLineOuttotheoscilloscopeandobservertheimpulseresponsethroughtheADCtotheLineOut.AnotherapproachwouldbetointernallywithintheDSPprogram,loopthesamplesreceivedfromrightchannelLineInbackouttotheleftchannelLineoutputandobservetherepetitionsoftheimpulseresponseontheoscilloscope.Chooseavalue,ν,forthecyclicprefixlengththatissomewhatlargerthanthedurationofthechannelimpulseresponse.17.5.4CompletingtheTransmitterNowitistimetoputtogetherthetransmitterblocksalongwithaninitializationsequenceandoperateinreal-time.Useping-pongbufferstosendoutputsamplestotheleftchannelDACwhentransmittingregulardatasymbols.Definetwointegerarrays,ping[]andpong[],eachofwhichcanholdtheoutputsamplesforoneDMTsymbol.SamplesshouldbesenttotheDACfromoneofthearraysusinganinterruptserviceroutinetriggeredbyinterruptsfromtheMcBSP1XRDY1flag.YoucouldalsousetheEDMAtosendoutthesamples.Whilethesamplesaregoingoutofonearray,yourprogramshouldgeneratethesamplesforthenextDMTsymbolandputthemintotheotherarrayandthenwaitforallthesamplestobetransmittedfromthefirstarray.ThenthefunctionsofthetwoarraysshouldbeswappedwithsamplestransmittedfromthearrayjustfilledandsamplesforanewDMTsymbolgeneratedandputintotheotherarray.Asaninitialtestofyourping-pongbufferscheme,selectasubcarrierwithindexk0intheset{1,2,...,31}andaconstantCk0togiveasignificantDACoutput,andformthecomplex64-dimensionalarrayofsubcarrierconstellationpoints⎧⎪⎪0fork=0and32⎪⎨Ck0fork=k0Zk=(17.56)⎪⎪⎪⎩Ck0fork=64−k00otherwiseSendthe64-pointtimesequenceznrepeatedlyandwithoutacyclicprefix.PerformtheIFFTforeachsymbol,eventhoughtheresultswillbethesameeachtime,tomakesureitisintegratedintoyourping-pongschemecorrectly.Thetransmittedsignalshouldbeacosinewaveatthesubcarrierfrequency.Checkthatthisiswhatyouseeontheoscilloscope.Trythisforseveralsubcarrierfrequencies. 17.5MakingaSimplifiedADSLTransmitterandReceiver301Onceyourping-pongbufferschemeisworking,createaprogramtomakethetransmittersendthefollowingsequenceofsignals:1.Whenyourtransmitterprogramfirststarts,sendaboutonesecondofsilence.Thatis,sendsamplesthatareall0voltsforaboutonesecond.Thiswillallowanyinitialtransientsthatmightoccurwhenyourprogramisloadedandstartedtodisappear.Itwillalsoallowthereceivertorecognizethatthetransmitterisnotyetsendingasignalandgetintoawaitingstate.2.Next,sendtheR-REVERBsymboldescribedonpage289withoutacyclicprefix1024times.Thiswillallowthereceivertodetectthepresenceofasignal,estimatesymbolclocktimingfrequencyoffset,andinitiallytrainitsequalizer.Youshouldcomputethereal64-pointR-REVERBtimesequencejustonce,scaleittouseasignificantrangeoftheDAC,convertittotheintegerformatfortheleftDACchannel,andstoretheresulting64-pointsequenceinanintegerarrayforrepeatedtransmission.YoucanuseinterruptsortheEDMAwithlinkingtorepeatedlytransmittheR-REVERB64-pointtimesequence.Sinceyouhavealreadyimplementedping-pongbuffers,agoodapproachwouldbetostorethe64-pointsequenceinbothping[]andpong[]andletyourping-pongschemealternatebetweensendingthetwobuffers.3.AfteralltheR-REVERBsymbolshavebeensent,sendtheR-SEGUEsymboltentimes.Thissymbolisdefinedonpage290.TheR-SEGUEsymbolisa180degreephasereversaloftheR-REVERBsignalandprovidesatimingmarktosignalthereceiverindicatingthatactualdatasignalwillbetransmittednext.4.Next,gointoanendlessloopandtransmitdatasymbolsincludingacyclicprefix.Thedatablocksforthesymbolsshouldbegeneratedbythe23-stagescramblerwithall1’sasitsinput.UseQPSKforallthesubcarriers.Sendthesyncsymboldescribedonpage290afterevery68datasymbols.5.OnceyougetyourreceivertoworkwithQPSK,youcanuse16-QAMforthesubcarriers.YoumightwanttosendQPSKforsomeknowtimeperiodinitially,andthenswitchto16-QAM.Sendasyncsymbolafterevery68datasymbols.17.5.5MakingtheReceiverReceiversareusuallymuchmoredifficulttomakethantransmitters.Theyrequirefunctionstodetectsignalpresence,doautomaticgaincontrol,acquireandtracksampleandsymbolclocks,performadaptiveequalization,implementalgorithmsforoptimumdetectionofsignalsinnoise,andimplementsophisticateddecodersforerrorcorrection.Forsystemswherethesignalismodulatedonahighfrequencycarrier,thereceiveroftenmustalsoincludecomponentstoacquireandtrackthecarrierfrequencyandphase,anddemodulatethesignaltobaseband.Inthisexperiment,youwillimplementthereceiverinadifferentDSKthanthetransmittersosampleclockacquisitionandtracking,andsymbollocationissuesmustbeaddressed.YoumightfinditusefultosimulatesomeofthealgorithmsyouwillhavetoimplementforthereceiverinMATLABbeforetryingtogetthemtoworkinreal-timeon 302Multi-CarrierModulationtheDSK.ConnecttheLineOutofyourtransmitterDSKtotheLineInofthereceiverDSK.PerformthetaskslistedbelowtomakeyourADSLreceiver.1.MakeafunctiontodetectwhenanADSLsignalispresentatthereceiverinput.Oneapproachistodetectsignalenergybysquaringtheinputsamplesandaveragingthesquareswithafirst-orderexponentialaverager.Letd(n)betheaverageroutputandr(n)thereceivedsignal.Thenthepowerdetectionsystemshouldcompute2d(n)=βd(n−1)+(1−β)r(n)(17.57)whereβisapositiveconstantslightlylessthan1thatdeterminestheaveragingtimeconstant.Thecloserβisto1,theslowertheaveragerwillrespondbutthesmootheritsoutputwillbe.Whend(n)risesaboveathresholdforseveralsamples,decideanADSLsignalispresent.Thethresholddeterminesthefalsedetectionprobabilitywhenthechannelisnoisy.Whenthethresholdislow,anADSLsignalwillbedetectedquicklybutfalsealarmswillalsobefrequent.Whenthethresholdishigh,falsealarmswillberarebutitwilltakelongertodetectthesignal.Ofcourse,ifthethresholdistoohightherewillbenofalsealarmsbutthesignalwillneverbedetected.ExperimentallyselectvaluesforβandthethresholdsothestartofareceivedADSLsignalisreliablydetectedbytheendofoneortwo64-samplesymbols.Onchannelswithverylittlenoise,quickdetectioncanbeachievedbydetectingwhentheabsolutevalueoftheinputexceedsathresholdforthefirsttimeand,possibly,severalnearbytimes.ThisquickdetectionapproachcouldbeusedforaninitialestimateoftheDMTsymboltiming.Beforeasignalisdetected,keepthereceiverfunctionsresetandwaiting.Whenasignalisdetected,startacountertokeeptrackofhowmanyR-REVERBsymbolshavebeenreceived.2.ThereceivermusttracksampleclockfrequencyoffsetandDMTsymbolalignment.Also,theFFTyouimplementeddoesanin-placecomputationandoverwritestheinputarraywiththeoutputarray.Theseconsiderationsmakeitinconvenienttousetheping-pongbufferapproachinthereceiver.Anapproachyoucanuseistosetupacircularbufferoffloatsforreceivedsampleswhoselengthistwosymbolslong,thatis,2N=2(64+ν)elements.Thereceivedsamplesshouldbeconvertedtofloatswhenstoredinthecircularbuffer.Avariablepointingtothestartofasymbolcanbedefined.Sampleclockadjustmentsandsymbolalignmentcanbemadebymodifyingthispointer.The64samplesforasymbol,excludingthecyclicprefix,canbecopiedtoaseparateinputarrayfortheFFT.3.Begincollectingsamplesinthecircularbufferonceasignalisdetected.Declarea64-elementcomplexarrayfortheFFTinput.Copysuccessiveblocksof64samplestotherealpartofthisarrayandzerotheimaginarypart.FormtheFFT’softheblocks.Duringthefirst200R-REVERBsymbols,estimatethesampleclockfractionalperioderror,,usingthe“openloop”methoddescribedonpage294using(17.43). 17.5MakingaSimplifiedADSLTransmitterandReceiver3034.Forthenextseveralsymbols,computeanestimateofthereciprocalofthechannelfre-quencyresponse,1/Hk,foreachsubcarrier.Thesewillbeusedastheinitialfrequencydomainequalizer(FEQ)coefficients.YoualreadyknowtheFFTvaluesfortheR-REVERBsymbolfromthedefinitionofthissignal.LetRk,ibethereceiver’sFFToutputatindexkforsymboli,andZkbethetransmittedFFTvalue.TheestimateforonereceivedsymbolisZkZkRk,iWk(i)==(17.58)Rk,i|Rk,i|2Thearithmeticaverageoftheseestimatesoverseveralsymbolscanbecomputedtoreducenoise.YoucandothedivisionsusingthestandardCfloating-pointdivisionoperator.Computetheseestimatesfork=1,...,31.5.InitializetheFEQcoefficientstothevaluescomputedintheprevioustask.ThenbeginadaptivelyupdatingtheequalizercoefficientsusingtheLMSalgorithmgivenby(17.29)inSection17.4.1.BeginrunningtheFEQtocomputetheequalizedvaluesZ˜k,i=Wk(i)Rk,i.Useanupdateconstantµlargeenoughtotrackphaserotationscausedbysampleclockfrequencyoffsetbutsmallenoughtohaverelativelysmallcoefficientjitter.YouwillhavetoturnontheslicerthatquantizesFEQoutputstothenearestidealconstellationpoints.Donotstartthesampleclocktrackingalgorithmyet.Runinthismodefor256symbols.TheconstellationsyouobserveattheequalizeroutputshouldbetheQPSKinputconstellations.Youmightaskwhythisworkswithnocyclicprefix?TheansweristhattheR-REVERBsymbolisbeingrepeated.Theendofonesymbolactsasthecyclicprefixforthenext.6.Agooddiagnostictoolandinformativewayofobservingthereceiveroperationisaconstellationdisplay.ThisdisplayshowstherealversusimaginarypartsoftheFEQoutputsfortheequalizedsymbolstreamforaparticularsubcarrierinanX-Ydisplayonanoscilloscope.Whenthechannelnoiseissmallandtheequalizationisgood,welldefinedconstellationpointswillbeobserved.IfadditivenoisewithapproximatelyGaussiancharacteristicsispresent,theidealconstellationpointswillsmearintocircularclusters.Poorequalizationwillalsocauseclusters.Whensampleclockfrequencyoffsetispresentandtheequalizerupdatesareveryslow,theobservedconstellationwillslowlyrotate.Tomakeaconstellationdisplay,sendtherealpartoftheequalizeroutputforasubcarriertotheleftchanneloftheDACandtheimaginaryparttotherightchannelforeachofthe64+νoutputsamplesduringasymbol.DisplaythetwochannelsasanX-Yplotontheoscilloscope.FreezetheequalizercoefficientsbymakingµzeroandrepeatR-REVERBsymbolscontinuously.Lookataconstellationdisplaytoseeifthereisconstellationrotationcausedbysampleclockfrequencyoffset.7.Afterthe256symbolsofLMSequalizerupdating(456symbolsafterthestartofsignaldetection)settheequalizerupdatescalefactortoasmallvalueandturnonthesampleclockalgorithmspecifiedby(17.49)and(17.50)andperformtheconstellationcounter-rotations.Initializeδiaccordingtotheopenloopvaluecomputedduringthefirst200receivedsymbols.TheclockPLLshouldtracksignificantlyfasterthantheequalizer.Adjustthetimingphasewhen|τi|exceedsitsthresholdbyshiftingthe64-samplerecord 304Multi-CarrierModulationcopiedfromthecircularbufferforwardorbackwardbyonesampleandcorrectingτiasdiscussedonpage296.8.ContinuerunningtheFFT,FEQ,clocktracker,andsymbolcounter.Whenthecountergetscloseto1024,beginlookingforthe180degreephaseshiftthatoccurswhenR-SEGUEbegins.Useyouringenuitytocomeupwithanalgorithmfordetectingthephaseshift.Youralgorithmshouldoperateonthereceivedsamplesequenceanddetectthephaseshiftwithin4samples.Countfor10symbolsfromthistimingmarktodeterminewhenregulardatatransmissionbeginswithsymbolsincludingacyclicprefix.Thetimingmarkshouldallowyoutodeterminewithreasonableaccuracywhenthecyclicprefixofthefirstdatasymbolstarts.9.TurnonthecyclicprefixcorrelationalgorithmpresentedinSection17.4.3fordeterminingsymbolalignmentwhenthereceptionofregulardatasymbolsbegins.Youshouldalreadyhaveaballparkestimateofwhenasymbolbegins.Searcharoundthispointinthecircularbufferforthephasingthatgivesanullintheperiodicitymetricorapeakinthecyclicprefixcorrelation.Foreachreceivedsymbol,skipoverthecyclicprefixandcopy64goodsymbolsamplestotheFFTinputarray.PerformtheFFT,FEQ,sampleclocktracking,slicing,inversemaptoabitsequence,anddescrambling.Ifeverythingisworkingproperly,thedescrambleroutputshouldbeall1’s.10.Additionaloptionaltasksyoucanperformare:(a)AddGaussiannoisetothetransmittedsamplesandmakeaplotofthebit-errorrateasafunctionofsignal-to-noiseratio.(b)ImplementtheCRCgeneratorinthetransmitterandCRCcheckerinthereceiver.(c)Implementtheinterleaverinthetransmitteranddeinterleaverinthereceiver.(d)PassthetransmitteroutputsamplesthroughafiltersimulatingaworsechannelbeforesendingthemtotheDACinthetransmitterandobservesystemperformance.(e)Comeupwithaschemeforestimatingthesignal-to-noiseratioatthereceiverforeachsubcarrierwhenthereisnoiseonthechannelandtheamplituderesponsevariessignificantly.Dosomeresearchandimplementanalgorithmforoptimallyassigningthenumberofbitstoeachsubcarriertoachieveadesirederrorprobability.(f)ImplementtheReed-Solomonencoderinthetransmitteranddecoderinthereceiver.Thisisamajortaskandisworthyofbeingcountedasanentireexperiment.(g)BrowsethroughtheADSLstandardsandimplementadditionalfeaturestheycon-tain.17.6AdditionalReferencesTherearemanybooksonwirelesssystemsandDSLthathavesectionsonmulti-carriermodulation.SeeGolden,etal.,[E.3]foraveryup-to-dateandtechnicallyin-depthtreatmentofDSL.OtherbooksonDSLincludeBingham[E.2]andStarr,etal.,[E.16].Haykinand 17.6AdditionalReferences305Moher[E.5]isawellwrittenbookonwirelesscommunicationsthatdiscussesmulti-carriermodulation.Goldsmith[E.4],Schwartz[E.15],andSt¨uber[E.17]havetechnicalsectionsonmulti-carriersystems.TheITU-TRecommendationsG.992.3,G.992.4,andG.992.5forADSLcanbedownloadedfreeofchargeasPDFfilesfromtheITU-Twebsite:http://www.itu.int/rec/T-REC-G/eTheIEEE802.11standardsforWi-Ficanbedownloadedfreeofchargefrom:http://standards.ieee.org/getieee802/802.11.htmlandtheIEEE802.16standardsforWiMaxfrom:http://standards.ieee.org/getieee802/802.16.html Chapter18SuggestionsforAdditionalExperimentsItwouldtakealongtime(maybeacoupleofyears?)tocompletealltheexperimentsinthisbook.However,inlightoftherecentABETrequirementinengineeringeducationforcapstonedesignprojects,severaladditionaltopicsforexperimentsrelatedtocurrentcommunicationtechniquesareverybrieflydescribedbelow.Referencestogetyoustartedoneachprojectareincluded.18.1ElementaryModemHandshakeSequenceAsanintroductiontomodemhandshakeprocedures,implementtheV.22bistransmitterandreceiverhandshakesequences.Buildthetransmitterinonestationandthereceiverinanother.SeetheITU-TV.22bisrecommendation[II.D.4]foradetailedspecificationofthesesequences.Youwillhavetofigureoutmethodsfordetectingcriticalpointsinthesequences.AfteryouhavetheV22.bistransmitterandreceiverworkinginseparateDSP’s,integratethetwointoasingleDSP.Thechallengewillbetofigureouthowtotime-sharetheDSPbetweenthetransmitterandreceiverprograms.Rememberthatthetransmitterandreceiverinasinglemodemmustoperateindependentlyinafullduplexfashion,soassumethatthetransmitandreceivesymbolclockswillbedifferentinphaseandslightlydifferentinfrequency.Implementasecondtransmitterandreceiveronanotherstation.Connectthetwotogetherinafull-duplexmodeandmakethemtalktoeachotherwithouterrors.YoucanconnectthemodemsthroughtheTAStelephonelinesimulatorandcheckthatyourmodemsworkwithavarietyoflinesandimpairments.Aftercompletingthisproject,youwillhavebuiltalmostacompleteV.22bismodem.18.2MakeanITU-TV.21FrequencyShiftKeyed(FSK)ModemTheV.21modemtransmitsdataat300bpsusingbinary,continuousphasefrequencymod-ulation.Thisisoneoftheoldestandsimplesttypesofmodems.Eachinputdatabitselects307 308SuggestionsforAdditionalExperimentsoneoftwofrequenciestobetransmitted.Theoriginateandanswermodemsusedifferentfrequencypairstoachievefull-duplextransmission.ThetransmittedsignalisgeneratedbyusinganFMmodulatorliketheonedescribedinChapter8withatwolevelinputandhascontinuousphasebetweenbittransitions.Databytesareusuallytransmittedinaasyn-chronousmodeusingstartandstopbits.Tasksyoucouldperformforthisprojectinclude:1.MakeatransmitterononeDSKtakingthebinarydatainputfromtheBERTtestset.2.MakeareceiverincludingtimingrecoveryonanotherDSK.Noelaboratetimingrecoverysystemisneededforasynchronousbytetransmissions.Thestartofabyteissignaledbyatransitionfromastopbittoastartbit.Thedatabitsforthebytearespacedby1/300secondssothecenterofeachbitcanbefoundbysimplycountingsamples.Thetimingstartreferencecanberesetwiththestoptostartbittransitionforeachbyte.3.YoucanusetheTAStelephonelineemulatortomakebiterrorratevs.SNRtestsalongwithasecondBERTtester.4.MakeafullduplexmodembyimplementingthetransmitterandreceiverononeDSKandhavetwomodemstalktoeachotherinfull-duplexmode.5.ComputethetheoreticalspectrumfortheFSKsignalandcompareitwiththespectrumforyourFSKmodulatoroutput.Lucky,Salz,andWeldon[II.D.29]hasadetailedchapteronFSKincludingaderivationofthepowerspectraldensity.ITU-TRecommendationV.21specifiesalltherequirementsforthismodem.Theclasswebpagewww.ee.umd.edu/courses,Fall1999,ENEE429W,LectureNotesandHandouts,ContinuousPhaseFrequencyShiftKeyingshouldbeuseful.18.3FastEqualizerTrainingUsingPeriodicSequencesEqualizertrainingusingtheLMSalgorithmwithanidealreferencesequencetakesasignifi-cantamountoftime.ThetrainingtimecanbereducedverysignificantlybytransmittingasequencewithaperiodequaltotheequalizerdurationinsymbolsandusingFFTmethodstocomputetheoptimumequalizercoefficients.Thetrainingsignalprobesthechannelwithabankofsinusoidswhosefrequenciesaremultiplesoftherepetitionrateofthesequence.TheequalizerisswitchedtotheLMSdecisiondirectedmodeaftertheinitialfasttraining.ThisfasttrainingmethodwasincludedinamodemstandardforthefirsttimeintheV.34recommendation.AclearanddetailedexplanationofthemethodispresentedbyChevillat,Maiwald,andUngerboeckin[II.D.5].AlsoseeTretter[II.D.39,Chapter11].Asaproject,youcouldincorporatethisfasttraintechniqueintothemodemtransmitterandreceiveryoubuiltinChapters13,14,and15. 18.4TrellisCodedModulation30918.4TrellisCodedModulationUngerboeck[II.F.14]madeamajorbreakthroughincodingfornarrow-bandchannelsinthelate1970’snowcalledtrelliscodedmodulation.IthasbeenincludedineveryVseriesmodemrecommendationsinceitsdiscoveryandsomeADSLstandards.Themethodinvolvesdoublingthenormalnumberofpointsintheconstellation,usingaconvolutionalcodeinthetransmittertoselectconstellationpoints,andperformingsoft-decisionViterbidecodinginthereceiver.Performancegainsof4to5dBarereadilyachieved.SeeUngerboeck[II.F.15]foramorerecentandtutorialversionofhisoriginalpaper.ThebookbyBiglieri,etal.,[II.F.3]givesadetailedpresentationoftrelliscoding.OtherreferencestotrelliscodingandsoftdecisionViterbidecodingcanbefoundinLeeandMesserschmitt[II.D.26,Section7.4andChapter12],Gitlin,Hayes,andWeinstein[II.D.11,Sections3.5and5.7],Proakis[II.D.32,Sections5.3.2and5.4],andTretter[II.D.39,Chapter3].Asaproject,youcouldimplementtheV.32trelliscodeandasoftdecisionViterbidecoder.SeetheITU-TV.32recommendation[II.D.4],LeeandMesserschmitt[II.D.26,p.517],orProakis[II.D.32,p.504]forcompletedetailsontheV.32encoder.ThisencoderwasinventedbyLee-FangWei[II.F.17]atBellTelephoneLaboratories.Toavoidprocessingtimeproblemsinthereceiver,youcouldimplementthesystemusingtheV.22symbolrateof600baud.Thiswouldalsoallowyoutousemostoftheprogramsyouhavepreviouslygenerated.Ifyouareinterestedinpursuingtrelliscodingfurther,implementoneormoreoftheV.344-dimensional16,32,or64statecodes.SeeWei[II.F.18]foradiscussionofmulti-dimensionaltrelliscodes.SeeTretter[II.D.39]fortheV.34codes.18.5Reed-SolomonEncoderandDecoderReed-Solomoncodesarecyclicblockcodesthatareusedinmanyapplications.Applicationsincludeerrorcorrectionforcompactdisks,digitalsubscriberlinemodems,manytypesofwirelesssystems,andsatellitecommunicationsystems.TheycanbeviewedasatypeofBCHcodewithcodesymbolsthatareblocksofbits.Thesecodesaregoodforcorrectisolatedrandomerrorsaswellaserrorbursts.Encodingisrelativelyeasy.Efficientalgorithmsexistfordoingthemuchmoredifficultdecodingtask.SeebooksonerrorcorrectingcodeslikeGallager[F.7]andWicker[F.19]fordetails.Asaproject,youcouldmakeaReed-SolomonencoderanddecoderforanADSLtransceiver.Thiscodehassymbolsconsistingofeightbits(abyte)andanaturalblocklengthof255bytes.Thecodeshaveawiderangeoferrorcorrectingcapabilities.Theyrequire2tchecksymbolstocorrecttsymbolerrorsandhave255−2tinformationsymbols.18.6TurboCodesTurbocodeswerefirstdisclosedatapublicconferencein1993byBerrou,Glavieux,andThitimajshima[F.1].Theypresentedsimulationresultsshowingperformanceoftheiren-coderanddecodingalgorithmremarkablyclosetotheShannoncapacitylimitwithareason- 310SuggestionsforAdditionalExperimentsablecomputationalcomplexity.Theirresultswereinitiallymetwithskepticism,butothersquicklyduplicatedthemandturbocodeswererapidlyusedinapplicationsandincludedinstandards.Turbocodesuseparallelconcatenationofrecursivesystematicconvolutionalcodeswithinterleavedinputstreamsandsoft-decisioniterativedecoding.Averygoodref-erenceforthesecodesisVucetic[F.16].AsubstantialprojectwouldbetolearnaboutturbocodesandimplementanencoderanddecoderforthecodespecifiedintheWiMaxIEEErecommendation802.16[E.8].18.7LowDensityParityCheckCodesRobertG.Gallagerinventedandstudiedlow-densityparity-checkcodes(LDPCcodes)duringhisdoctoralresearchintheDepartmentofElectricalEngineeringattheMassachusettsInsti-tuteofTechnologyandpublishedhisworkinhisdoctoraldissertationin1960.AnexpandedversionofhisdissertationwaspublishedasanM.I.T.Pressmonographin1963[F.6].Thesecodeswereignoredformanyyearsbecausethedecodingalgorithmwastoocomputationallycomplextobeeconomicallyjustifiablegiventhehardwaretechnologyofthetimes.Theywererediscoveredinthelate1990’sandshowntohaveperformanceneartotheShannonca-pacitylimitwithreasonablecomplexityandcostforthecurrentdigitalprocessortechnology.Thedecodingalgorithmisaniterativeoneandcanbeviewedasmessagepassingonagraphusingasum-productalgorithm.Thecomplexityiscomparabletoorlessthanthatofturbocodesandtheperformanceisatleastasgood.LDPCcodesareattheforefrontofcurrentresearchonerrorcorrectingcodes.AgoodreferenceforLDPCcodesisFan[F.4].Thewebsite,www.inference.phy.cam.ac.uk/mackay/CodesGallager.html,ofDavidMacKayisagoodsourceofarticlesonLDPCcodesandsoftwarefordesigningandsimulatingthem.LDPCcodeshavebeenusedinsomecommercialproductsandareincludedinthemobileWiMax802.16estandard[E.9]asoptionalcodes.AgoodprojectwouldbetolearnaboutthetheoryofLDPCcodes,implementencodersanddecodersfortheIEEE802.16eLDPCcodes,andperformsimulationstogeterrorprobabilityversussignal-to-noiseratiocurves.18.8V.34ConstellationShapingbyShellMappingAdditionalperformancecanbegainedbyshapingtheconstellationtominimizetheaveragesignalpowerwhilemaintainingtheminimumdistancebetweenpoints.Forexample,intwodimensionsacirclewiththesameareaasasquarehaslessaveragepower.InNdimensions,aspherehaslessaveragepowerthananyotherfigurewiththesamevolume.TheV.34rec-ommendationspecifiesa16-dimensionalshapingtechniquecalledshellmappingthatcloselyapproximatesthegainsofidealsphericalshaping.InpreviousVseriesmodems,thetwo-dimensionalconstellationpointsareusedwithequallikelihood.Withshellmapping,thepointsinthetwo-dimensionalconstellationnearesttheoriginaremorelikelythantheouterpoints.Thetwo-dimensionalpointsapproximatelyhaveacircularGaussiandistribution.SeetheITU-TV.34recommendation[II.D.21]foracookbookformulaforshellmapping.AnexplanationofthetheorycanbefoundinLaroia,Farvardin,andTretter[II.F.9][II.F.10]andinTretter[II.D.39,Chapter8]. 18.9NonlinearPrecodingforV.34311Asaproject,youcouldimplementtheV.34shellmappingalgorithmanditsinverse.Youshouldweighusingpre-computedtablesagainston-the-flycomputationtoachievetherequiredprocessingspeed.Thistrade-offbetweenmemoryandcomputationoftenarisesinDSPapplications.18.9NonlinearPrecodingforV.34TheV.34modemcanuseanoisewhiteningfilterinthereceivertoimprovetheViterbidecoderperformance.Theintersymbolinterferenceintroducedbythenoisewhiteningfilteriscompensatedforatthetransmitterbyanonlinearprecodingtechnique.Nonlinearpre-codingwasfirstsuggestedbyTomlinson[II.D.36]andHarashima[II.D.16].ThemethodwasgeneralizedtoQAMsystemsandimprovedbyLaroia[II.D.25]andquicklyfurtherimprovedbyLaroiaandBettsofAT&Tand,independently,byColeofGeneralDataCommduringdevelopmentoftheV.34recommendation.TheresultwaspresentedataTIAmeetinginJuly1993[II.D.15].ThefinalversionofthenonlinearprecodercanbefoundintheV.34recommendation[II.D.21]andinTretter[II.D.39,Chapter5].Asaproject,implementtheV.34shellmapper,nonlinearprecoder,and4D16-statetrellisencoderinthetransmitter.SeeTretter[II.D.39,Chapters9and10]tolearnhowthesecomponentsareconnected.Implementtheinversesinyourreceiver.TransmitthesignalthroughtheTASchannelsimulatorwithadditivenoiseandcomparethebit-errorrateperformanceofthesystemwithandwithoutprecoding.Alsocomparetheperformancewithandwithoutshellmapping.18.10SpeechCodecsDSP’sareusedextensivelyforspeechcodecsintelephonesfordigitalexchanges,codecsatthelocaloffice,inwirelesstelephones,andinsecuremilitaryapplications.TheITUhasgeneratedaGseriesofrecommendationsforspeechcodecswithvariousdegreesofcomplexity.Thesimplestisthepulsecodemodulation(PCM)RecommendationG.711.ThenextincomplexityisG.726foradaptivedifferentialpulsecodemodulation(ADPCM).Thenthereareseveralcodeexcitedlinearprediction(CELP)recommendationslikeG.729thatarequitecomplex.Thereareavarietyofcellularphonestandardsthateachhavetheirownuniquespeechcodecs.ThereareCreferenceprogramsavailablefromITUandonthewebforimplementingmanyofthesecodecs.YoucouldeasilyworkforseveralsemestersmakinganarrayofspeechcodecstoworkontheDSK. AppendixAGeneratingGaussianRandomNumbersThisappendixdescribeshowtoconvertasequenceofuniformlydistributedrandomnumbersintoapairofsequencesthatapproximateapairofwhite,uncorrelated,Gaussianrandomsequences.Thesesequencescanbeusedtosimulatetheinphaseandquadraturenoisecom-ponentsinpassbandcommunicationsystems.Thismethodisconvenientbecausemanyprogramminglanguageshaveafunctionforgeneratinguniformlydistributedrandomnum-bers.Limitationsofthe’C6713Ccompilerrandomnumbergeneratorarediscussed.A.1The’C6713CCompilerPseudoRandomNumberGeneratorThe’C6713optimizingCcompilerlibrarycontainsthefunctionsintrand(void)andvoidsrand(unsignedintseed)forgeneratingarandomsequenceofintegersuniformlydis-tributedovertherange[0,RANDMAX]whereRANDMAXisdefinedtobe215−1=32767instdlib.h.Thesenumbersoccupyonlytheleastsignificant15bitsoftheDSP’s32-bitword.ThesourcecodeforthesefunctionsisshowninProgramA.1below.Thefunctionsrandsetsthevalueoftherandomnumbergeneratorseedsothatsubsequentcallsofrandproduceanewsequenceofpseudo-randomnumbers.Thesrandfunctiondoesnotreturnavalue.Ifrandiscalledbeforesrandiscalled,itgeneratesthesamesequenceasifsrandwascalledfirstwithaseedvalueof1.Thefunctionrandgeneratesthesamesequencewheneversrandsetsthesameseed.Thisrandomnumbergenerationtechniqueisoftenreferredtoasthemultiplicativecongruentialmethod.ProgramA.1’C67xCCompilerProgramsrand()andsrand()#includeunsignedlongnext=1;313 314GeneratingGaussianRandomNumbersintrand(void){intr;next=next*1103515245+12345;r=(int)((next/65536)%((unsignedlong)RAND_MAX+1));returnr;}voidsrand(unsignedseed){next=seed;}A.2ABetterUniformRandomNumberGeneratorItisshowninSectionA.4thatafiniteword-lengthuniformrandomnumbergeneratorcausesalimitonthepeakvalueoftheapproximatelyGaussianrandomvariablesgeneratedbythemethodpresentedinthisappendix.Thisputsanupperlimitonthesignal-to-noiseratio(SNR)thatwillcausebiterrorsinasimulationofadigitalcommunicationsystem.AtSNR’sabovethislimit,noerrorswilloccur.Therandomnumbersgeneratedbythe’C6713Ccompilerfunctionuseonly15bitsofthe32-bitDSPword.Thefunctionrand()showninProgramA.2generates31-bitrandomnumbersuniformlydistributedovertheintegersintherange[0,RANDMAX]wherenowRANDMAX=231−2andincreasestheSNRlimit.ThisfunctionwasusedintheoldTMS320C3x/4xCcompilerlibrary.ProgramA.232-bitUniformPseudoRandomNumberGeneratorFunction/***************************************************************************//*rand.cforTMS320C3x/4x*//**//*NOTE:Thisfileshouldbecompiledwiththe-mm(shortmultiply)*//*switchforbestresults.*//***************************************************************************/#includestaticunsignednext=1;/****************************************************************************//*rand()-COMPUTETHENEXTVALUEINTHERANDOMNUMBERSEQUENCE.*//**//*Thesequenceusedisx’=(A*x)modM,(A=16807,M=2^31-1).*//*Thisisthe"minimalstandard"generatorfromCACMOct1988,p.1192.*//*Theimplementationisbasedonanalgorithmusing231-bitregisters*//*torepresenttheproduct(A*x),fromCACMJan1990,p.87.*/ A.2ABetterUniformRandomNumberGenerator315/**//****************************************************************************/#defineA16807u/*MULTIPLIERVALUE*/intrand(){unsignedx0=(next<<16)>>16;/*16LSBsOFSEED*/unsignedx1=next>>16;/*16MSBsOFSEED*/unsignedp,q;/*MSW(31bits),LSWOFPRODUCT(31bits)*//*---------------------------------------------------------------------*//*COMPUTETHEPRODUCT(A*next)USINGCROSSMULTIPLICATIONOF*//*16-BITHALVESOFTHEINPUTVALUES.THERESULTISREPRESENTEDAS2*//*31-BITVALUES.SINCE’A’FITSIN15BITS,ITSUPPERHALFCANBE*//*DISREGARDED.USINGTHENOTATIONval[m::n]TOMEAN"BITSnTHROUGH*//*mOFval",THEPRODUCTISCOMPUTEDAS:*//*q=(A*x)[0::30]=((A*x1)[0::14]<<16)+(A*x0)[0::30]*//*p=(A*x)[31::60]=(A*x1)[15::30]+(A*x0)[31]+C*//*WHEREC=q[31](CARRYBITFROMq).NOTETHATBECAUSEA<2^15,*//*(A*x0)[31]ISALWAYS0.*//*---------------------------------------------------------------------*/q=((A*x1)<<17>>1)+(A*x0);/*q[31]isthecarry*/p=((A*x1)>>15)+(q>>31);/*q>>31movesthecarrytothelsb*/q=q<<1>>1;/*CLEARCARRYwhichisq[31]*//*---------------------------------------------------------------------*//*IF(p+q)<2^31,RESULTIS(p+q).OTHERWISE,RESULTIS*//*(p+q)-2^31+1.Thiscanbeprovedasfollows:*//*A*x=[p,q]=p*2^31+q=p*[(2^31-1)+1]+q*//*=p*(2^31-1)+(p+q)*//*Thusmod(a*x,2^31-1)=mod(p+q,2^31-1)*//*=p+qforp+q<2^31-1*//*=p+q-2^31+1otherwise*//*Thelastlinefollowsbyobservingthatp+qisalwayslessthan*//*2^32.*//*---------------------------------------------------------------------*/p+=q;/*formp+qandnowpisp+q*//*Nowphasthevalueofp+q.Ifp[31]=1,p+q>2^31-1andif*//*p[31]=0,p+q<=2^31-1.Thusp>>31adds0or1asneeded.*//*((...)<<1)>>1clearsbit31whichdoesnothingifitis*//*already0butsubtracts2^31ifitis1.*/returnnext=((p+(p>>31))<<1)>>1;/*ADDCARRY,THENCLEARIT*/ 316GeneratingGaussianRandomNumbers}/****************************************************************************//*srand()-SETTHEINITIALSEEDFORrand().*//****************************************************************************/voidsrand(unsignedseed){next=seed;}A.3TurningUniformlyDistributedRandomVariablesintoaPairofGaussianRandomVariablesThefirststepistoconvertarandomvariableVwhichisuniformlydistributedover[0,1)intoarandomvariableRthathastheRayleighprobabilitydensityfunction2r−rfR(r)=e2σ2u(r)(A.1)σ2andcumulativedistributionfunction2−rFR(r)=1−e2σ2u(r)(A.2)Vcanbegeneratedbycallingrand,convertingthereturnedintegertoafloating-pointnumber,anddividingtheresultbyRANDMAX+1=32768=215forthe’C6713compiler.TherandomvariableVcanbeconvertedintoRbythetransformationR=−2σ2loge(1−V)(A.3)NoticethatthisfunctionistheinverseofthecumulativedistributionfunctionFR(r).Aproofthatthisgivesthedesiredresultcanbefoundinmostintroductoryprobabilitytextbooks.ThennumberreturnedbyrandisdividedbyRANDMAX+1ratherthanRANDMAXso1−Vcanneverbecomezeroandcauseanumericalcomputationproblemforthelogefunction.ThenextstepistoconvertVintoapairofuncorrelatedGaussianrandomvariables.LetΘbearandomvariableuniformlydistributedover[0,2π)andindependentofV.Θcanbegeneratedbycallingrandagain,dividingtheresultbyRANDMAX+1togetarandomnumberuniformlydistributedover[0,1),andthenmultiplyingtheresultby2π.Finally,itcanbeshownthatX=RcosΘ(A.4)andY=RsinΘ(A.5)aretwouncorrelatedGaussianrandomvariables,eachwithzeromeanandvarianceσ2.Thatis,theyeachhaveaprobabilitydensityfunctionoftheform21−xf(x)=√e2σ2(A.6)σ2π A.4LimitonthePeakoftheSimulatedGaussianRandomVariables317Thismethodisgoodforsimulatingnoiseincommunicationsystemsbecauseitapprox-imatesthetailsoftheGaussiandistributionwell.NoticethatasVapproaches1,R,X,andYapproachinfinityinmagnitude.OthermethodsthatarebasedontheCentralLimitTheoremandinvolvetakingthesumofafixednumberofuniformindependentrandomvariablesapproximatethepeakofthepdfwellbutapproximatethetailspoorly.Problemsincommunicationsystemsareusuallycausedbyinfrequentlyoccurringlargevaluesofthenoise,thatis,thetailsofthepdf.A.4LimitonthePeakMagnitudeoftheApproximatelyGaussianRandomVariablesGeneratedbyThisMethodToaddalittlegenerality,considerarandomnumbergeneratorthatoutputsN-bitwordsintherange[0,RANDMAX]withRANDMAX=2N−1.ThelargestvalueofVthatcanbereachedin(A.3)isRANDMAX−NVmax==1−2(A.7)RANDMAX+1Then,thelargestvaluethatR,X,orYcanreachisR[N]=X[N]=Y[N]=−2σ2log(1−V)=σ2Nlog2(A.8)maxmaxmaxemaxeForthe’C6713compilertheresultis[15][15][15]Rmax=Xmax=Ymax=σ30loge2=4.56009σ(A.9)andforthe’C30oldcompileritis[31][31][31]Rmax=Xmax=Ymax=σ62loge2=6.55554σ(A.10)Theratioofthesetwonumbersis-R[31]31max==1.4376(A.11)R[15]15max AppendixBATTL/RS-232CInterfaceforMcBSP0ThepinsfortheDSPperipheralsincludingtheMcBSPserialportsandtimersareavailableontheperipheralexpansionconnectorontheTMS320C6713DSK.ThesignallevelshavetheTTLvaluesof0and5volts.TheexperimentsforChapter10requiretheuseofMcBSP0andTimer0toexchangeserialdatawiththeNavtelbit-errorratetesterwhichusesRS-232Clevels.IntheRS-232Cprotocol,alogical0iscalledaspaceandisrepresentedby+12vwhilealogical1iscalledamarkandisrepresentedby−12v.TheRS-232CinterfaceprotocolisdescribedindetailinChapter10.ThecircuitdiagramforaTTLtoRS-232CconverterforusewiththeNavteltesterisshowninFigureB.1.McBSP0wasselectedfortheRS-232CchannelbecauseMcBSP1isnormallyconnectedtotheAIC23codecontheTMS320C6713DSK.ThisallowsacommunicationsystemtobemadewhereanexternaldeviceliketheNavtelbit-errorratetestersuppliesandreceivesbinarydatasimulatingaterminal,andthecodeccanbeusedtotransmitandreceivetheanalogmodulatedsignalstransmittedoverachannel.TheconverterusesaMAXIMMAX238RS-232Driver/Receiverchip.TheMAX238justrequiresasingle+5vpowersourceandthreeexternalcapacitors.Itcontainsavoltagedoublerandinvertertogeneratethe±12vlevels.ThepackagecontainsfourTTLtoRS-232CdriversandfourRS-232CtoTTLreceivers.ADB25connectorfortheRS-232CcableisattachedtoabracketforaPCcardslotonthebackofthePC.TheReceivedData,TransmittedData,ReceiverClock,andTransmitterClockleadsareconnectedtotheMAX238chip.RequesttoSend(RTS)isloopedbacktoCleartoSend(CD)andDataCarrierDetect(DCD)ontheconnector.Also,DataTerminalReady(DTR)isloopedbacktoDataSetReady(DSR).Inthisway,whentheNavteltesteristurnedonandabit-errorratetestisselected,itraisesRTSandDTRwhichautomaticallyraiseCTS,DCD,andDSR.TransmittedDataontheRS-232CsideissenttotheReceiveDatapinofMcBSP0.Similarly,TransmitDataofMcBSP0isroutedtoReceivedDataoftheRS-232Cconnector.Asimilarnameswapoccurswiththeclocks.ThisisbecausetheRS-232CconnectorontheconverterisconfiguredtolooklikeamodemorDCE.Inthiscase,pin3isdatareceivedbythemodemandpin2isdatatransmittedbythemodem.319 320ATTL/RS-232CInterfaceforMcBSP0TheTimer0outputpinTOUT0isloopedbacktothesamplerategenerator1externalclockinputpinCLKS0.Thissignalisdivideddowninthesamplerategeneratortoformthebitclocksandframesyncs.ThetransmitandreceivebitclocksshouldbeoutputontheCLKXandCLKRpinstodrivetheNavteltester.DetailsonhowtosettheMcBSP0andTimer0controlregistersareprovidedinSection10.4. ATTL/RS-232CInterfaceforMcBSP0321910µf10C1+Vcc+8.3v4.7µf++5vto+10vV+8.3v1211C1−VoltageDoubler10µf13C2+16v4.7µf++10vto−10v9V−+5v16v14VoltageInverter15+C2−24DX05T1inT1out2ReceivedDataRD327CLKR018T2in+5vT2out1TransmitterClockTC1521CLKX019T3in+5vT3out24ReceiverClockRC1721T4in+5vT4out2030DR06+5vR1in7TransmittedDataTD2R1out4R2in3R2out22R3in23R3out17R4in16R4outGND45TOUT0RequesttoSendRTS48CleartoSendCTS522CLKS0MAXIMMAX238DataCarrierDetectDCD832GNDRS−232Drivers/ReceiversSignalGroundSG7DataTerminalReadyDTR20DataSetReadyDSR6PeripheralExpansionConnectorDB25RS-232ConnectoroptocouplerHCPL-2601FigureB.1:TTLtoRS-232CConverter AppendixCEquipmentListforEachStationThisequipmentlistwasincludedtoprovideguidancetothosesettingupasimilarlabo-ratoryandisnotintendedtobeanendorsementofanyparticularmanufacturer.Clearly,manycompaniesmakeequipmentwithequivalentcapabilitiesthatcanbesubstitutedforthespecificitemslistedbelow.•AmodernPCrunningWindowsXP•TexasInstrumentsTMS320C6713DigitalStarterKit(TMS320C6713DSK)32-bitfloatingpointDSPmodulewhichincludesstereoADCandDACforeachPC•NetworkcardsinstalledineachPC•Tektronix2205OscilloscopeDualchanneloscilloscope•GWINSTEKFunctionGenerator,ModelGFG-3015Sine,triangular,andsquarewaveoutputs;frequencycounter;AMandFMmodulatedsignals•NavtelDATATEST3–biterrorratetesterUofMDhomemadeRS232/TTLconvertertointerfaceNavtelwithTMS320C6713McBSP0andTimer0ontheDSK•PenrilAllianceV.32modemAV.32andV.22bismodemwithbuiltindiagnosticconstellationX-Youtputs.Thesearenotmadeanymoreanditisunlikelyyouwillfindthem.SubstitutearecentV.90or92modem.•Microphoneandspeaker(ThesecanbepartofthePCsystem.)323 324EquipmentListforEachStation•3footcableswith3.5-mmstereoaudioplugsononeendandleftandrightRCAconnectorsontheotherend.•RCAtoBNCadapterstohooktheleftandrightchannelstotheoscilloscopesandsignalgenerators.•TwoBNCtoalligatorclipcables•ThreeBNCTconnectors•ThreeBNCfemaletobanana/screwconnectorsAdditionalSharedEquipment•TwoTAS111TelephoneNetworkEmulatorsEmulateamplitudeandphasedistortion,nonlineardistortion,additivenoise,frequencytranslationandcarrierphasejitter•TwoTektronix495PSpectrumAnalyzers•HPlaserprinter ReferencesI.ListofManuals1.BrianW.KernighanandDennisM.Ritchie,TheCProgrammingLanguage,secondedition,PrenticeHall(1988).2.SpectrumDigital,TMS320C6713DSKTechnicalReference,2004.3.TexasInstruments,CodeComposerStudioUser’sGuide,SPRU328B.4.TexasInstruments,TLV320AIC23StereoAudioCODECDataManual,SLWS106C,July2001.5.TexasInstruments,TMS320C6000AssemblyLanguageToolsUser’sGuide,SPRU186.6.TexasInstruments,TMS320C6000ChipSupportLibraryAPIReferenceGuide,SPRU401.7.TexasInstruments,TMS320C6000CPUandInstructionSetReferenceGuide,SPRU189F.8.TexasInstruments,TMS320C6000DSP/BIOS,SPRU303.9.TexasInstruments,TMS320C6000OptimizingCompilerUser’sGuide,SPRU187k.10.TexasInstruments,TMS320C6000PeripheralsReferenceGuide,SPRU190D.11.TexasInstruments,TMS320C6000Programmer’sGuide,SPRU198F.12.TexasInstruments,TMS320C6713BFloating-PointDigitalSignalProcessor,SPRS294B.II.SelectedReferenceBooksandPapersA.DSPLaboratoryBooksUsingDSPHardware1.RulphChassaing,DigitalSignalProcessingwithCandtheTMS320C30,Wiley-Interscience(1992).2.RulphChassaing,DigitalSignalProcessingLaboratoryExperimentsUsingCandTheTMS320C31DSK,Wiley-Interscience(1999).325 326References3.RulphChassaing,DSPApplicationsUsingCandtheTMS320C6xDSK,Wiley-Interscience(2002).4.RulphChassaing,DigitalSignalProcessingandApplicationswiththeC6713andC6416DSK,WileyInter-Science(2005).5.RulphChassaingandDarrellW.Horning,DigitalSignalProcessingwiththeTMS320C25,Wiley-Interscience(1990).6.VinayK.IngleandJohnG.Proakis,DigitalSignalProcessingLaboratoryUsingtheADSP-2101Microcomputer,PrenticeHall(1991).7.DouglasL.JonesandThomasW.Parks,ADigitalSignalProcessingLaboratory,PrenticeHall(1988).8.NasserKehtarnavazandMansourKeramat,DSPSystemDesignUsingtheTMS320C6000,PrenticeHall(2001).9.NasserKehtarnavazandBurcSimsek,C6x-BasedDigitalSignalProcessing,Prentice-Hall(2000).10.SenM.Kuo,BobH.Lee,andWenshunTian,Real-TimeDigitalSignalProcessing,Im-plementationsandApplications,JohnWiley&Sons(2006).11.HenrikV.SorensenandJianpingChen,ADigitalSignalProcessingLaboratoryUsingtheTMS320C30,PrenticeHall(1997).B.DSPLaboratoryBooksUsingSoftwareSimulation1.OktayAlkin,PC-DSP,PrenticeHall(1990).2.OktayAlkin,DigitalSignalProcessing,ALaboratoryApproachUsingPC-DSP,PrenticeHall(1993).3.JohnR.Buck,MichaelM.Daniel,andAndrewC.Singer,ComputerExplorationsinSignalsandSystemsUsingMATLAB,PrenticeHall(2002).4.C.SidneyBurrus,JamesH.McClellan,AlanV.Oppenheim,ThomasW.Parks,RonaldW.Schafer,andHansW.Schuessler,Computer-BasedExercisesforSignalProcessingUsingMATLAB,PrenticeHall(1994).5.AlanKamasandEdwardA.Lee,DigitalSignalProcessingExperimentsUsingaPersonalComputerwithSoftwareProvided,PrenticeHall(1989).6.RussellM.MersereauandMarkJ.T.Smith,DigitalFiltering:AComputerLaboratoryTextbook,Wiley(1994).7.SanjitK.Mitra,DigitalSignalProcessingLaboratoryUsingMATLAB,McGraw-Hill(1999). References3278.JohnG.ProakisandMasoudSalehi,ContemporaryCommunicationSystemsUsingMAT-LAB,PWSPublishingCompany(1998).9.JohnG.Proakis,MasoudSalehi,ndGerhardBauch,ContemporaryCommunicationSys-temsUsingMATLABandSimulink,2ndEd.,Thomson-Brooks/Cole(2004).10.MarkJ.T.SmithandRussellM.Mersereau,DigitalSignalProcessing,AComputerLab-oratoryTextbook,Wiley(1992).C.BooksandPapersonDigitalSignalProcessing1.S.Banerjee,H.R.Sheikh,L.K.John,B.L.Evans,andA.C.Bovik,“VLIWDSPvs.SuperscalarImplementationsofaBaselineH.263VideoEncoder,”Proc.IEEEAsilomarConferenceonSignals,Systems,andComputers,Oct.29–Nov.1,2000,Vol.2,pp.1665–1669.2.MauriceBellanger,DigitalProcessingofSignals,2nded.,Wiley(1989).3.CharlesSidneyBurrusandThomasW.Parks,DFT/FFTandConvolutionAlgorithms,Wiley-Interscience(1985).4.RonaldE.CrochiereandLawrenceR.Rabiner,MultirateDigitalSignalProcessing,Prentice-Hall(1983).5.PaulM.EmbreeandBruceKimble,CLanguageAlgorithmsforDigitalSignalProcessing,PrenticeHall(1991).6.C.W.Farrow,“AContinuouslyVariableDigitalDelayElement,”Proceedingsofthe1988IEEEInternationalSymposiumonCircuitsandSystems,Helsinki,Finland,June1988,pp.2641–2645.7.IEEEPress,ProgramsforDigitalSignalProcessing(1979).8.LelandB.Jackson,DigitalFiltersandSignalProcessing,KluwerAcademicPublishers(1986).9.G.M.JenkinsandD.G.Watts,SpectralAnalysisandItsApplications,Holden-Day(1968).10.StevenM.Kay,ModernSpectralEstimation:TheoryandApplication,PrenticeHall(1988).11.DimitrisG.Manolakis,VinayK.Ingle,andStephenM.Kogon,StatisticalandAdaptiveSignalProcessing,McGraw-Hill(2000).12.AlanV.OppenheimandRonaldW.Schafer,DigitalSignalProcessing,PrenticeHall(1975). 328References13.AlanV.OppenheimandRonaldW.Schafer,Discrete-TimeSignalProcessing,PrenticeHall(1989).14.T.W.ParksandC.S.Burrus,DigitalFilterDesign,Wiley-Interscience(1987).15.JohnG.ProakisandDimitrisG.Manolakis,DigitalSignalProcessing,Macmillan(1992).16.LawrenceR.RabinerandBernardGold,TheoryandApplicationofDigitalSignalPro-cessing,PrenticeHall(1975).17.StevenA.Tretter,IntroductiontoDiscrete-TimeSignalProcessing,Wiley(1976).D.BooksandPapersonCommunications1.JohnB.AndersonandSeshadriMohan,SourceandChannelCoding,KluwerAcademicPublishers(1991).2.AlbertBenvenisteandMauriceGoursat,“BlindEqualizers,”IEEETransactionsonCom-munications,Vol.COM-32,No.8,August1984,pp.871–883.3.JohnA.C.Bingham,TheTheoryandPracticeofModemDesign,Wiley-Interscience(1988).4.CCITTBlueBook,VolumeVIII–FascicleVIII.1,DataCommunicationOvertheTele-phoneNetwork,SeriesVRecommendations,IX-thPlenaryAssembly,November1988.5.PierreR.Chevillat,DietrichMaiwald,andGottfriedUngerboeck,“RapidTrainingofaVoicebandData-ModemReceiverEmployinganEqualizerwithFractional-TSpacedCoefficients,”IEEETransactionsonCommunications,Vol.COM-35,No.9,September1987,pp.869–876.6.G.J.Foschini,“EqualizationWithoutAlteringorDetectingData,”BellSystemTechnicalJournal,Vol.64,October1985,pp.1885–1911.7.L.E.FranksandJ.P.Burbrouski,“StatisticalPropertiesofTimingJitterinaPAMTim-ingRecoveryScheme,”IEEETransactionsonCommunications,Vol.COM-22,No.7,July1974,pp.913–920.8.FloydM.Gardner,PhaselockTechniques,2nded.,Wiley-Interscience(1979).9.JerryD.Gibson,PrinciplesofDigitalandAnalogCommunications,2nded.,Macmillan(1993).10.R.D.GitlinandJ.F.Hayes,“TimingRecoveryandScramblersinDataTransmission,”TheBellSystemTechnicalJournal,Vol.54,No.3,March1975,pp.569–593. References32911.RichardD.Gitlin,JeremiahF.Hayes,StephenB.Weinstein,DataCommunicationsPrinciples,Plenum(1992).12.R.D.Gitlin,H.C.Meaders,Jr.,andS.B.Weinstein,“TheTap-LeakageAlgorithm:AnAl-gorithmfortheStableOperationofaDigitallyImplemented,FractionallySpacedAdap-tiveEqualizer,”TheBellSystemTechnicalJournal,Vol.61,No.8,October1982,pp.1817–1839.13.DominiqueN.Godard,“PassbandTimingRecoveryinanAll-DigitalModemReceiver,”IEEETransactionsonCommunications,Vol.COM-26,No.5,May1978,pp.517–523.14.DominiqueN.Godard,“Self-RecoveringEqualizationandCarrierTrackinginTwo-DimensionalDataCommunicationSystems,”IEEETransactionsonCommunications,Vol.COM-28,No.11,November1980,pp.1867–1875.15.YuriGoldstein,VedatEyuboglu,andS.Olafsson,“PrecodingforV.fast,”SubcommitteeContribution,TechnicalSubcommitteeTR30.1,TIAmeeting,Newton,MA,July1993.16.HiroshiHarashimaandH.Miyakawa,“Matched-TransmissionTechniquesforChannelswithIntersymbolInterference,”IEEETransactionsonCommunications,Vol.COM-20,No.4,August1972,pp.774–780.17.SimonHaykin,CommunicationSystems,3rded.,Wiley(1994).18.SimonHaykin,AdaptiveFilterTheory,2nded.,Prentice-Hall(1991).19.SimonHaykin,DigitalCommunications,Wiley(1988).20.ITU-TRecommendationV.32,“AFamilyof2-WireDuplexModemsOperatingatDataSignallingRatesupto9600bit/sforuseontheGeneralSwitchedTelephoneNetworkandonLeasedTelephone-TypeCircuits,”www.itu.ch,March1993.21.ITU-TRecommendationV.34,“AModemOperatingatDataSignallingRatesofUpto33600bit/sforuseontheGeneralSwitchedTelephoneNetworkandonLeasedPoint-to-Point2-WireTelephone-TypeCircuits,”www.itu.ch,February1998.22.ITU-TRecommendationV.90,“ADigitalModemandAnalogueModemPairforuseonthePublicSwitchedTelephoneNetwork(PSTN)atDataSignallingRatesofupto56000bit/sDownstreamandupto33600bit/sUpstream,”www.itu.ch,September1998.23.ITU-TRecommendationV.92,“EnhancementstoRecommendationV.90,”www.itu.ch,November2000.24.NeilK.Jablon,“JointBlindEqualization,CarrierRecovery,andTimingRecoveryforHigh-OrderQAMSignalConstellations,”IEEETransactionsonSignalProcessing,Vol.40,No.6,June1992,pp.1383–1398.25.RajivLaroia,“ISICoder–CombinedCoding&Precoding,”SubcommitteeContribution,TechnicalSubcommitteeTR30.1,TIAmeeting,Baltimore,MD,June1993. 330References26.EdwardA.LeeandDavidG.Messerschmitt,DigitalCommunication,KluwerAcademicPublishers(1988).27.F.LingandS.U.H.Qureshi,“ConvergenceandSteady-StateBehaviorofaPhase-SplittingFractionallySpacedEqualizer,”IEEETransactionsonCommunications,Vol.38,No.4,April1990,pp.418–425.28.R.W.Lucky,“AutomaticEqualizationforDigitalCommunication,”TheBellSystemTechnicalJournal,Vol.XLIV,No.4,April1965,pp.547–588.29.RobertW.Lucky,J.Salz,andE.J.Weldon,Jr.,PrinciplesofDataCommunication,McGraw-Hill(1968).30.K.H.Mueller,andJ.J.Werner,“AHardwareEfficientPassbandEqualizerStructureforDataTransmission,”IEEETransactionsonCommunications,Vol.COM-30,No.3,March1982,pp.538–541.31.G.PicchiandG.Prati,“BlindEqualizationandCarrierRecoveryUsingaStop-and-GoDecisionDirectedAlgorithm,”IEEETransactionsonCommunications,Vol.COM-35,September1987,pp.877–887.32.JohnG.Proakis,DigitalCommunications,2nded.,McGraw-Hill(1989).33.Y.Sato,“AMethodofSelf-RecoveringEqualizationforMultilevelAmplitude-Modula-tionSystems,”IEEETransactionsonCommunications,Vol.COM-23,June1975,pp.679–682.34.J.J.Stiffler,TheoryofSynchronousCommunications,Prentice-Hall(1971).35.GaryL.SugarandStevenA.Tretter,“ConvergencePropertiesofOptimalAdaptiveCar-rierPhaseJitterPredictorsofSinusoidalJitter,”IEEETransactiononCommunications,Vol.43,Nos.2/3/4,February1995,pp.225–228.36.M.Tomlinson,“NewAutomaticEqualiserEmployingModuloArithmetic,”ElectronicsLetters,Vol.7,Nos.5/6,March25,1971,pp.138–139.37.J.R.TreichlerandB.G.Agee,“ANewApproachtoMultipathCorrectionofConstantModulusSignals,”IEEETransactionsonAcoustics,Speech,andSignalProcessing,Vol.ASSP-31,April1983,pp.459–472.38.JohnR.Treichler,C.RichardJohnson,Jr.,andMichaelG.Larimore,TheoryandDesignofAdaptiveFilters,Wiley-Interscience(1987).39.StevenA.Tretter,ConstellationShaping,NonlinearPrecoding,andTrellisCodingforVoicebandTelephoneChannelModemswithEmphasisonITU-TRecommendationV.34,KluwerAcademicPublishers(2002). References33140.J.J.Werner,“AnEcho-Cancellation-Based4800Bit/sFull-DuplexDDDModem,”IEEEJournalonSelectedAreasinCommunications,Vol.SAC-2,No.5,September1984,pp.722–730.41.B.WidrowandS.D.Stearns,AdaptiveSignalProcessing,Prentice-Hall(1985).E.ReferencesforWirelineandWirelessMulti-CarrierModulation1.AmericanNationalStandardsInstitute(ANSI),T1.413-1998,“NetworkandCustomerInstallationInterfaces–AsymmetricDigitalSubscriberLine(ADSL)MetallicInterface,”November1998.2.JohnA.C.Bingham,ADSL,VDSL,andMulticarrierModulation,JohnWiley&Sons,(2000).3.PhilipGolden,Herv´eDedieu,andKristaS.Jacobsen,Ed.’s,FundamentalsofDSLTech-nology,AuerbachPublications(2006).4.AndreaGoldsmith,WirelessCommunications,CambridgeUniversityPress(2005).5.SimonHaykinandMichaelMoher,ModernWirelessCommunications,PearsonPrenticeHall(2003).6.IEEEStd802.lla,“WirelessLANMediumAccessControl(MAC)andPhysicalLayer(PHY)specifications,High-speedPhysicalLayerinthe5GHzBand,”(1999).7.IEEEStd802.llg,“WirelessLANMediumAccessControl(MAC)andPhysicalLayer(PHY)specifications,Amendment4:FurtherHigherDataRateExtensionsinthe2.4GHzBand,”(2003).8.IEEEStd802.16,“AirInterfaceforFixedBroadbandWirelessAccessSystems,”(2004).9.IEEEStd802.16e,“AirInterfaceforFixedandMobileBroadbandWirelessAccessSys-tems,AmendmentforPhysicalandMediumAccessControlLayersforCombinedFixedandMobileOperationinLicensedBands,”(June2005).10.ITU-TRecommendationG.992.3,“Asymmetricdigitalsubscriberlinetransceivers2(ADSL2),”(01/2005).11.ITU-TRecommendationG.992.4,”Splitterlessasymmetricdigitalsubscriberlinetransceivers2(splitterlessADSL2),”(07/2002).12.ITU-TRecommendationG.992.5,“AsymmetricDigitalSubscriberLine(ADSL)transceivers–ExtendedbandwidthADSL2(ADSL2+),”(01/2005). 332References13.HyungG.Myung,JunsungLim,andDavidJ.Goodman,“SingleCarrierFDMAforUplinkWirelessTransmission,”IEEEVehicularTechnologyMagazine,Sept.2006,pp.30–38.14.JohnG.ProakisandMasoudSalehi,FundamentalsofCommunicationSystems,PearsonPrenticeHall(2005).15.MischaSchwartz,MobileWirelessCommunications,CambridgeUniversityPress(2005).16.ThomasStarr,JohnM.Cioffi,andPeterJ.Silverman,UnderstandingDigitalSubscriberLineTechnology,Prentice-Hall(1999).17.GordonL.St¨uber,PrinciplesofMobileCommunication,KluwerAcademicPublishers(1996).18.Wikipedia,“3GPPLongTermEvolution,”http://en.wikipedia.org/wiki/3GPP_Long_Term_Evolution.F.BooksandPapersonErrorCorrectingCodes1.ClaudeBerrou,AlainGlavieux,andPunyaThitimajshima,“NearShannonLimitError-CorrectingCodingandDecoding:Turbo-Codes(1),”IEEEInternationalConferenceonCommunications’93,Geneva,Switzerland,TechnicalProgram,ConferenceRecord,Vol-ume2/3,pp.1064–1070.2.EzioBiglieri,CodingforWirelessChannels,SpringerScience+BusinessMedia(2005).3.EzioBiglieri,PariushDivsalar,PeterJ.McLane,andMarvinK.Simon,IntroductiontoTrellis-CodedModulationwithApplications,Macmillan(1991).4.JohnL.Fan,ConstrainedCodingandSoftIterativeDecoding,KluwerAcademicPublish-ers(2001).5.G.DavidForney,Jr.,“Burst-CorrectingCodesfortheClassicBurstyChannel,”IEEETransactionsonCommunicationsTechnology,Vol.COM-19,No.5,October1971,pp.772–781.6.RobertG.Gallager,Low-DensityParity-CheckCodes,MITPress(1963).7.RobertG.Gallager,InformationTheoryandReliableCommunication,J.Wiley(1968),Chapter6.8.S.W.Golomb,ShiftRegisterSequences,Holden-Day(1967).9.RajivLaroia,NarimanFarvardin,andStevenTretter,“OnSVQShapingofMultidi-mensionalConstellations–High-RateLarge-DimensionalConstellations,”Proceedingsofthe26thAnnualConferenceonInformationSciencesandSystems,PrincetonUniversity,March1992,pp.527–531. References33310.RajivLaroia,NarimanFarvardin,andStevenA.Tretter,“OnOptimalShapingofMul-tidimensionalConstellations,”IEEETransactionsonInformationTheory,Vol.40,No.4,July1994,pp.1044–1056.11.ToddK.Moon,ErrorCorrectionCoding,Wiley-Interscience(2005).12.W.W.PetersonandE.J.Weldon,Jr.,ErrorCorrectingCodes,MITPress(1972).13.JohnL.Ramsey,“RealizationofOptimumInterleavers,”IEEETransactionsonCommu-nicationsTheory,Vol.IT-16,No.3,May1970,pp.338–345.14.GottfriedUngerboeck,“ChannelCodingwithMultilevel/PhaseSignals,”IEEETransac-tionsonInformationTheory,Vol.IT-28,No.1,January1982,pp.55–67.15.GottfriedUngerboeck,“Trellis-CodedModulationwithRedundantSignalSets,”Pts.IandII,IEEECommunicationsMagazine,Vol.25,February1987,pp.5–21.16.BrancaVuceticandJinhongYuan,TurboCodes,PrinciplesandApplications,KluwerAcademicPublishers(2000).17.L.-F.Wei,“RotationallyInvariantConvolutionalChannelCodingwithExpandedSignalSpace–PartII:NonlinearCodes,”IEEEJournalonSelectedAreasinCommunications,Vol.SAC-2,No.5,September1984,pp.672–686.18.L.-F.Wei,“Trellis-CodedModulationwithMultidimensionalConstellations,”IEEETrans-actionsonInformationTheory,Vol.IT-33,No.4,July1987,pp.483–501.19.StephenB.Wicker,ErrorControlSystemsforDigitalCommunicationandStorage,Pren-ticeHall(1995).III.InterestingWebSites1.www.ee.umd.edu/~tretter,StevenA.Tretter,UniversityofMarylandwebsiteforENEE428CommunicationsDesignLaboratory.2.www.ti.com,TexasInstrumentswebsite.3.www.ece.utexas.edu/~bevans,Papers,classlecturenotes,andprojectreportsandsug-gestionsbyDr.BrianEvansattheUniversityofTexasatAustinonapplicationsusingTMS320C6000DSP’sforwirelineandwirelesssystems. Index3GPP,277asm6x.exe,23assemblyoptimizer,79adaptiveequalizer,seeequalizerinvoking,80AddressModeRegister(AMR),75ATU-C,277addressingmoderegister,14ATU-R,278ADDSP,81autocorrelationfunction,112ADSL,274automaticgaincontrol,229,231–232C-REVERBsignal,288C-SEGUE,289balancedmixer,134QUIETsignal,288basebandshapingfilterR-REVERBsignal,289inPAMtransmitter,188subcarrierfrequencies,288inQAMtransmitter,216syncsignal,290raisedcosine,191–192AGC,229excessbandwidthfactor,191AIC23codec,20frequencyresponse,191DSK6713_AIC23_setFreq(),35impulseresponse,191samplingfrequencies,35splittingbetweentransmitandreceivealiasingformula,205filters,192AM,seeamplitudemodulationsquare-rootofraisedcosine,192amplitudemodulation,121–132inV.22bismodem,224carrierfrequency,121baud,187carrierwave,121Baudot,187complexenvelope,127BERTtest,177envelope,121biasedexponent,9envelopedetector,123BK0,75square-law,124–125BK1,75usingHilberttransform,127blindequalization,253–256modulationindex,122BoardSupportLibrary,21overmodulated,123BSL,21pre-envelope,127butterfly,105sidebands,123singletone,122CCER,61spectrum,123ChannelChainEnableRegister,61AMR,14ChannelInterruptEnableRegister,62analyticsignal,126ChannelInterruptPendingRegister,62Fouriertransformof,126ChipSupportLibrary,22ar6x.exe,26CIER,62335 336IndexCIPR,62constellationshaping,310circularbuffersconvolution,67AMR,75convolutionalinterleaver,282assemblylanguageinstructions,75Costasloop,136–138blocksizeregisters(BK0,BK1),75linearizedlooptransferfunction,138BUFLEN,75CPE,278Cimplementation,73CRC,278hardwarecircularaddressing,75CSLLibrary,22mailboxforPAMtransmitsamples,CSR,50200CTL,43cl6x.exe,23cyclicconvolution,288CLKG,179cyclicprefix,287CLKGDV,179cyclicredundancycheck,278CLKR,179CLKS,179datapagepointer(DP),81CLKSM,179DataTransmitRegister,38CLKSP,179DCE,174CLKSRG,179decimation-in-time,104CLKX,179deinterleaver,283CNT,43delayslots,17CodeComposerStudio,22forbranchinstructions,18COFFfile,23forloadinstructions,18coherentreceiverforMPYinstructions,18forDSBSC-AM,134forstoreinstructions,18complexenvelope,126denormalizednumbers,9Fouriertransformof,126DFT,seediscreteFouriertransforminfrequencydiscriminator,156differentialencodinglowersidebandSSB,144forV.22bisandV.32modems,220ofQAMsignal,217digitalfilterSSBFouriertransform,144amplituderesponse,68uppersidebandSSB,144FIRfilters,68withCostasloop,136designprogramremez87.exe,70constellation,215designprogramwindow.exe,69a16-pointQAMexample,218–220Type1DirectForm,6890◦rotationalinvariance,218frequencyresponse,68mappinginputbitstoconstellationIIRfilters,89points,219–220designprogramIIR.EXE,92a4-pointQAMexample,220–221type0directform,89mappinginputbitstoconstellationtype1directform,90points,220–221type2directform,91forADSL,286phaseresponse,68inphasecomponent,216digitalsubscriberline,274quadraturecomponent,216discretemulti-tonemodulation,274constellationdisplay,303discreteFouriertransform,104 Index337discrete-timeFouriertransform,101CIPR,62DMA,11EDMAINT,62DMT,274EventClearRegister,58dottingsequence,201EventEnableRegister,58double-sidebandsuppressedcarrierEventRegister,58AM,seeDSBSC-AMEventSetRegister,58downsampling,212features,57DRR,39LINK,61DSBSC-AM,133–141OPT,59Fouriertransformofsignal,133PaRAM,59idealcoherentreceiver,134–135selectorregisters,57signalequation,133EDMAINT,62DSK,18EER,58dsk6713.cmdEIA,173programlisting,30ELECNT,60,61DSK6713_AIC23_read(),35ELEIDX,57,60DSK6713_AIC23_write(),34ELERLD,60,61dsk6713bsl.lib,21enhanceddirectmemoryaccess,11dsk6713.cmd,29envelopedskstart32.c,31complex,126programlisting,32ofAMsignal,121DSL,274pre-envelope,126DSLAM,277real,127DSPStarterKit,18envelopedetector,123DSP/BIOS,26square-law,124–125DST,60usingHilberttransform,127DTE,173equalizerDXR,38blind,253–256decisiondirectedtraining,231,245echocanceler,263–272fasttraining,308blockLMSadaptation,269fractionallyspaced,passband,complex,data-driven,Nyquist,in-band,265–271230–231,241–248far-endcanceler,269–271idealreferencetraining,245far-endechosource,264minimummean-squarederrortapval-far-endfrequencyoffsettracking,270–ues,242–245271phase-splittingfractionallyspaced,249–LMSadaptation,268250near-endcanceler,267–269tapleakage,248near-endechosource,264theLMSadaptationalgorithm,245–subcanceler,267248ECR,58forADSLFEQ,291EDMA,11,56theoreticalbehavior,247–248CCER,61ER,58CIER,62ESEL0,57 338IndexESEL1,57frequencysensitivity,151ESEL2,57instantaneousfrequency,151ESR,58linearizedmodelforPLL,159EventClearRegister,58modulationindex,152EventEnableRegister,58narrowbandFM,154EventRegister,58phase-lockedloopdemodulator,157–EventSetRegister,58160executepackets,6,16signalpre-envelope,156eyediagram,192–193singletoneexample,152–153Besselfunctionseries,152Farrowinterpolator,208frequencytranslation,146–147fastFouriertransform,104–111FRMCNT,60,61butterfly,105FRMIDX,57,60computationalcomplexity,107FSG,180decimation-in-timealgorithm,104FSR,39,179bitreversedinputorder,107FSX,38,179radix-2Cfunction,107fullduplex,224toestimateapowerspectrum,112–113FWID,180FEC,281Galoisfield,281FEQ,291Gaussiannoisefetchpacket,6,16approximationfortailprobability,177FFT,seefastFouriertransformGaussiannoise,176–177ADSLdemodulator,291additiveGaussiannoisechannel,176FIRfilters,68bit-errorprobabilityforbinarysym-floating-pointnumberformat,8bols,177FM,seefrequencymodulationGIE,46foregroundtask,46globalinterruptenablebit(GIE),46,50forwarderrorcorrection,281GodardFouriertransformblindequalization,253discrete,104QAMclockrecoverymethod,233discrete-time,101GPIO,13fastFouriertransform,104–111GPIOexternalpinselection,46FPER,180Graycoding,199framepointer(FP),81frequencydiscriminator,154–156Hammingwindow,69,103usingthecomplexenvelope,156Hanningwindow,103usingthepre-envelope,155Harashima,311frequencydivisionmultiplexing,146,224Hilberttransform,125–126frequencydomainequalizer,291atCostasloopinput,136frequencymodulation,151–162atPLLinput,157Carson’sruleforbandwidth,154filterdesignbyremez87.exe,131demodulationbyfrequencydiscrimina-filterdesignbyremez87.exe,71tor,154–156filterdesignbywindow.exe,69formulaforFMsignal,152filterdesignbywindow.exe,132 Index339inenvelopedetector,127servicetable(IST),50infrequencydiscriminator,156servicetablepointer(ISTP),50infrequencytranslator,146InterruptClearRegister,47inQAMdemodulator,223interruptcontroller,46inSSBdemodulator,145InterruptFlagsRegister,47inSSBmodulator,144InterruptReturnPointer,47HostPortInterface,13InterruptSelector,46HPI,13InterruptServiceTablePointer,47Huffmantransform,164InterruptSetRegister,47hybrid,264interrupts,11interruptkeyword,51I2Cserialports,13CSR,50ICR,47GIE,46,50IEEEfloating-pointnumbers,8IER,50double-precision,9IFR,50single-precision,8IRP,50IER,50ISFP,50IFR,47,50IST,50IIRfilters,89ISTP,50type0directform,89NMIE,50iir.exe,27PGIE,50impulsemodulatorwithCSLandDSP/BIOS,51inPAMtransmitter,188intersymbolinterference,190–193inQAMtransmitter,216inADSL,287instantaneousfrequency,151time-domaincriterionfornoISI,188instructionset,13intrinsics,23integerformat,7IRP,47,50interleaverISFP,50convolutional,282ISI,seeintersymbolinterferenceinterleaving,282ISR,47depth,282IST,50interp.exe,208ISTP,47,50interpolationfilterbank,194,209Kaiserwindow,69forQAMpassbandshapingfilter,222interpolatorLaroia,311continuouslyvariablephase,205LDPCcodes,310quantizephasesteps,208LDW,76interruptlinearassembly,17,25,79controlstatusregister(CSR),50LINK,60enableregister(IER),50linker,25flagsregister(IFR),50commandfile,25pragma,51example,30returnpointer(IRP),50memorymap,30servicefetchpacket(ISFP),50sectionallocation,30 340IndexLissajousfigure,95modemLMS,seeequalizerandechocanceleranswer,224LMSalgorithmcallingororiginate,224forADSLFEQequalizer,292V.22bis,218,224–225lnk6x.exe,23,25carrierfrequencies,224localloop,264S1sequence,227localoscillator,134V.32,218low-densityparity-checkcodes,310V.32bis,263LTE,277V.34,263LTIsystem,67modulationindexforAM,122Lucky,241MPYSP,81msequence,164NaN,9mailbox,200NMIE,47,50mantissa,9nonmaskableinterruptenablebit(NMIE),matchedfilter,17647,50maximallengthsequence,164,166NonmaskableInterruptReturnPointer,47McASP,12NOP,17NRP,47McBSP,12NyquistcriterionfornoISI,190–191CLKG,179Nyquistfrequency,191,286CLKGDV,179CLKR,179OFDM,275CLKS,179OFDMA,276CLKSM,179orthogonalfrequencydivisionmultiplexing,CLKSP,179275CLKSRG,179CLKX,179p-bit,16DRR,39PAM,seepulseamplitudemodulationDXR,38paralleloperations,16FPER,180PaRAM,59FSG,180DST,60FSR,39,179ELECNT,60,61FSX,38,179ELEIDX,60FWID,180ELERLD,60,61RBR,39FRMCNT,60,61RINT,41FRMIDX,60RRDY,41LINK,60RSR,39OPT,59SPCR,39ParameterRAM,59SRG,38,179passbandshapingfilter,221–222XINT,39periodogram,112XRDYflag,38PGIE,50XSR,38phasesplitter,230memorymapinlinkercommandfile,30phasedetector,158 Index341phase-lockedloop,136NyquistcriterionfornoISI,190–191forFMdemodulation,157–160raisedcosine,191–192forQAMcarriertracking,251–253splitbetweentransmitandreceivefil-forsymbolclocktracking,209,232–235ter,192fortrackingfrequencyoffsetoffar-endsquare-rootofraisedcosine,192echo,270blockdiagramofPAMsystem,189pilotcarrier,289dottingsequence,201pilottone,148exampleofuniformlyspacedsymbollev-ping-pongbuffers,200els,188pipeline,16eyediagram,192–193plainoldtelephoneservice,278formulafortransmittedsignal,188PLL,seephase-lockedloopimpulsemodulator,188PNsequence,164intersymbolinterference,190–193inADSL,289receivefilter,188polling,42symbolclockrecovery,196–198postdetectionfilter,135symbolerrorprobability,194–196POTS,275,278transmitfilter,188powermeter,131implementingbyinterpolationfilterpowerspectraldensityestimation,112–113bank,194pragmaQformat,8DATAALIGN,75QAM,seequadratureamplitudemodula-interrupt,51tionPRD,43QDMA,57pre-envelope,126quadratureamplitudemodulationforFMsignal,156abasictransmitter,215–217FouriertransformforSSBsignal,144basebandinphaseandquadraturesig-inFMPLLdemodulator,157nalcomponents,216infrequencydiscriminator,155areceiverblockdiagram,230ofDSBSC-AMsignal,135automaticgaincontrol,231–232ofQAMsignal,216basebandshapingfilter,216previousglobalinterruptenablebit(PGIE),carrierdetectblock,22950carrierdetectsubsystem,232primitivepolynomial,166carrierfrequencyrequirement,216primitivepolynomialchannelsymbolrate,215twodegree23primitivepolynomials,constellations16890◦rotationalinvariance,218productmodulator,13416-pointexample,218–220projectfiles,224-pointexample,220–221PSK,220differentialencodingforV.22bisandPSTN,278V.32,220pulseamplitudemodulation,187–202mappinginputbitstoconstellationbasebandshapingfilter,188points,219–221criterionofnointersymbolinterfer-decisiondirectedcarriertracking,251–ence,188253 342IndexequalizerREVT,41decisiondirectedtraining,245Riciandensity,275fractionallyspacedcomplex,230–231,RINT,41241–248RRDY,41idealreferencetraining,245RS-232Cinterface,173–174minimummean-squarederrortap25-pinconnectorsignals,174values,242–245markvoltagelevel,174phase-splittingfractionallyspaced,249–spacevoltagelevel,174250RSR,39tapleakage,248RTDX,26theLMSalgorithm,245–248equationfortransmittedsignal,216S1sequence,227idealdemodulators,223–224samplerategenerator,179usingHilberttransform,223CLKG,179usingproductmodulators,223–224CLKGDV,179impulsemodulator,216CLKS,179inLTE,277CLKSM,179inWiMax,276CLKSP,179modulatorintermsofcomplexsignals,CLKSRG,179218FPER,180passbandshapingfilter,221–222FSG,180pre-envelopeofsignal,216FWID,180receivefilter,229SampleRateGenerator(SRG),38slicersamplingratechange,211for4-pointV.22bisconstellation,257samplingtheorem,206symbolclockrecovery,232–235SC-FDMA,277randomwalkfilter,237–238scrambler,selfsynchronizing,167–168QUIET,288connectionpolynomialsforV.32,168,219raisedcosinebasebandshapingfilter,191–descrambler,169192forADSL,281excessbandwidthfactorα,191forV.22bismodem,219frequencyresponse,191input/outputequation,168impulseresponse,191lock-upcondition,168Ramseyinterleaver,283serialportinterrupt,39randomwalkfilter,237–238serialports,12rascos.exe,27I2C,13Rayleighdensity,275McASP,12RBR,39McBSP,12rectangularwindow,102shellmapping,310Reed-Solomonencoder,281shiftregistersequencegenerator,164–167registerfile,7connectionpolynomial,165–166remez87.exe,27formaximallength,166REVERB,288forV.32scramblers,168 Index343maximallength,166tapleakage,248period,166TCINT,62propertiesofmaximallengthsequencesTEQ,290frequencyof1’sand0’s,166time-domainequalizer,290propertiesofmaximallengthsequences,timers,13,42166–167control(CTL)register,43correlationproperty,167counter(CNT)register,43runsof1’sand0’s,167internalclockfrequency,42recurrenceformula,165period(PRD)register,43sidebandTINPinputpin,42lower,134TOUTfrequency,179upper,134TOUToutputpin,42single-sidebandmodulation,143–148TINP,42coherentdemodulation,145–146TMS320C6000complexenvelopeCPU,6lowersidebandcase,144DSPcore,6uppersidebandcase,144serialports,12complexenvelopeFouriertransform,144timers,13forlowersidebandcase,144Tomlinson,311foruppersidebandcase,144TOUT,42demodulationusingapilottone,148frequency,179lowersidebandfilter,144TransferCompleteCode,61lowersidebandsignalusingHilberttrans-TransmitEventNotice,39form,144TransmitShiftRegister,38mixerandfiltermodulator,143trelliscodemodulatorusingHilberttransform,144Wei16-state4-dimensional,286pre-envelopeFouriertransform,144trelliscodedmodulation,309uppersidebandfilter,143TTC,61turbocodes,309uppersidebandsignalusingHilberttrans-two’scomplementformat,8form,144slicer,231V.22bismodemfor4-pointV.22bisandV.32constella-carrierfrequencies,224tions,257V.22bismodem,218,224–225SPCR,39S1sequence,227sqrtraco.exe,27V.32modem,218square-rootofraisedcosineshapingfilter,V.32bismodem,263192V.34modem,263inV.22bismodem,224VCO,seevoltagecontrolledoscillatorSRG,38,179vectoredinterruptcontroller,46SSBmodulation,seesingle-sidebandmod-VLIW,6ulationvoltagecontrolledoscillator,151,157stackpointer,76,81statevariables,90Wei,286symbolclockinADSL,296Wi-Fi,275 344IndexWidrow,241WiMax,276window.exe,27windowfunctions,102–104Hamming,69,103Hanning,103Kaiser,69rectangular,102XEVT,39XINT,39XRDY,38XSR,38

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。
关闭