FreescaleSemiconductorApplicationNoteDocumentNumber:AN3333Rev.0,11/2006Contents©FreescaleSemiconductor,Inc.,2006.Allrightsreserved.1IntroductionTheXGATEsignalgatewaypackageisacollectionofheaderandsourcefilesintheCprogramminglanguage,enablingyoutocreateaCANandLINsignallevelautomotivebodygateway.Thegatewaystructuredetailedinthisapplicationnoteisflexibleenoughtoallowextensionsand/ormodificationstosatisfyaparticularenvironment’srequirements.2SignalGatewayTheoryNoindustry-widestandardcurrentlyexistsforautomotivebodygateways.Eachvehiclemanufacturermaintainshisorherownsetofevolvingspecificationsofthetrafficagatewayhandles.Thissectionoutlinesonesetofspecifications.Thesespecificationsarenotbasedonrequirementssetbyanyspecificvehiclemanufacturer.TogaininsightintotheXGATEperformance,thissetrepresentsmeaningfulbasicbodygatewayrequirementsenablingareal-worldgatewaytobeimplemented.1Introduction...................................12SignalGatewayTheory..........................12.1ThePurposeofGateways....................22.2DataRepresentation........................32.3GatewayDataFlow.........................43GatewayImplementation.........................73.1DataStructures............................73.2Algorithms...............................143.3LimitationsofThisGatewayImplementation.....234PerformanceAnalysis..........................234.1XGATELoad.............................234.2RequiredMemorySize.....................325GeneratingtheDescriptors......................345.1GeneratedFiles...........................345.2NodeDataWorksheet......................355.3RxFramesWorksheet......................355.4TxFrameWorksheet.......................375.5GeneratingtheSourceFiles.................386References..................................38XGATELibrary:SignalGatewayImplementingCANandLINSignalLevelGatewayby:DanielMalikMCDApplicationsEastKilbride,ScotlandXGATELibrary:SignalGateway,Rev.0SignalGatewayTheoryFreescaleSemiconductor22.1ThePurposeofGatewaysInthepastdecade,theautomotiveindustryhasseenincreaseddemandforsafetyfeatures,increasedpressuretoreduceenvironmentaleffectscausedbyde-processingvehicles,andincreasedexpectationsformoderntechnology(suchasnavigationsystemsormobilecommunications)tobecomestandardeveninlower-endmodels.Thesechangesarepartiallycausedandpartiallyenabledbythedecreasingcostofsemiconductorsolutionsofferedtoautomotivemanufacturers.Keyautomotivetechnologieshavedevelopedfromnetworkedsystemstodistributedsystems.Thedifferentin-vehiclesystemsusedifferentnetworkingtechnologies;however,thetraditionalcontrollerareanetwork(CAN)developedbyRobertBoschGmbHin1986isstillattheheartofmany.Theneedforcost-optimized,low-speedbuseshasledtothedevelopmentofalocalinterconnectnetwork(LIN)typicallyusedforseatmanagementanddoorsub-systems(locks,windows,mirrors,etc.).Independentbuses(asopposedtoasinglebusinterconnectingallsystemsinthewholevehicle)areusedinindividualvehiclesystemsforseveralreasons:•Applicationrequirementsmayresultindifferentcommunicationspeedsfordifferentsystems(500kbpsforpowertrainvs.125kbpsfordashboard).•Thephysicallayerofthebusesmaynotbecompatible(LINvs.CAN,low-speedCANvs.high-speedCAN,etc.).•Physicalseparationofthebusesmayberequiredforsecuritypurposes.•Systemssharinglittleinformationmayusephysicallyseparatebusestolowertheamountofunnecessarytraffic.Thegatewayapplication’spurposeistotransferinformationamongthevehicle’sdifferentbusestoensureallsystemsreceivetherequiredinformationinatimelymanner.Forexample,thedashboardisdesignedtodisplay(amongotherinformation)thecurrenttemperatureoftheenginecoolant.Itisthegateway’sresponsibilitytoensurethetemperatureinformationpresentonthepowertrainbusisre-transmittedonthebodybus(seeFigure1).Figure1.GatewayApplicationExampleCANPHYHCS12XXGATECANPHYCANPHYCANPHYCANPHYLSCANBodyHSCANTelematicsHSCANPowertrainHS/LSCANChassisHSCANDiagnosticLINPHYLINPHYDoormodules-rightsideDoormodules-leftsideDirectloadsSwitchpanelFrontlightingSteeringcolumnSwitchpanelsWipersPowerseatsRainsensorandsunroofLINPHYLINPHYSignalGatewayTheoryXGATELibrary:SignalGateway,Rev.0FreescaleSemiconductor32.2DataRepresentationToassessthetaskofthegatewayapplication,theusermustunderstandhowinformationisrepresentedonthedifferentbuses.2.2.1MessageGatewayingThecommonpropertyofLINandCANframesisthattheycantransportuptoeightdatabytes.Thesimplesttaskforthegatewayistoreceiveaframeononebusthenre-senditonanotherbusinitsentirety.Thisprocessisusuallyreferredtoasmessagegatewayingoras1:1frameforwardingandistypicallyusedfordiagnosticpurposes.Indiagnosticmode,thegatewayextractsasetofframesfromthedifferentbusestowhichitisconnected.Theseframesarethenre-transmittedonthediagnosticbustowhichthegaragediagnosticequipmentisconnected.Thegatewayalsoreceivesframesfromthediagnosticequipmentandforwardsthemtothedifferentvehiclesystems(foradjustmentofengineparameters,firmwareupgrade,etc.).2.2.2SignalsMessagegatewayingisefficient;however,itcanbeusedonlyifthedestinationapplicationcanprocesstheoriginalframewithoutanytransformation.Anotheraspectisthebusload.Apieceofin