Sunteți pe pagina 1din 14

TUTORIAL

UsingSCIforWaveformMonitoring
November2016

1
UsingSCIforWaveformMonitoring

WiththeSimCoderModuleandtheF2833x/F2803x/F2802x/F2806xTargets,PSIMcangenerate
readytoruncodesforDSPboardsthatuseTIF2833x/F2803x/F2802x/F2806xseriesDSP.Byusing
theSerialCommunicationInterface(SCI)blocksintheTargetlibrary,PSIMoffersthecapabilityto
displaywaveformsandchangeparametersinsidetheDSPinrealtime.Thismakesitextremely
easytotest,debug,andadjustDSPcontrolcodeinanondisruptiveandnonintrusiveway.
ThistutorialdescribestheSCIblocks,SCIcable,andthesetupprocedureinthePSIMschematic
andinhardwaretoachieverealtimemonitoring.
Toillustratetheprocess,wewillusethecircuit3phsinewavewithSCImonitoring.psimsch"in
thefolder3phsinewavewithSCIasanexample.Thisfolderislocatedinexamples\SimCoder\
F2833xTargetfortheF2833xTarget.Wewillgeneratethecodefromthiscircuitandrunitonthe
TIExperimenter'sKitTMS320F28335(PartNumberTMDSDOCK28335).
Tokeeptheoriginalexampleunchanged,wewillcopythewholefoldertoc:\TISCI,andusethis
folderastheworkingfolderinthistutorial.
ThesameexamplealsoexistsforF2803x/F2802x/F2806xTargets,andthewaytorunitisthesame
asfortheF2833xTarget.

1.SCIinTIF2833x/F2803x/F2802x/F2806x
PSIMsDSPOscilloscopesupportsF2833x/F2803x/F2802x/F2806xTargets.

ForF2833xTarget:
TIF2833xseriesDSPhas3SCIports:SCIA,SCIB,andSCIC.EachSCIportcanusethefollowingGPIO
portsforcommunication:
ForSCIA:
GPIO28astheSCIreceiving(Rx,orinput)pin,andGPIO29astheSCItransmitting(Tx,or
output)pin.
GPIO35asthereceivingpin,andGPIO36asthetransmittingpin.
ForSCIB:
GPIO9asthereceivingpin,andGPIO11asthetransmittingpin.
GPIO14asthereceivingpin,andGPIO15asthetransmittingpin.
GPIO18asthereceivingpin,andGPIO19asthetransmittingpin.
GPIO22asthereceivingpin,andGPIO23asthetransmittingpin.
ForSCIC:
GPIO62asthereceivingpin,andGPIO63asthetransmittingpin.

ForF2803xTarget:
TIF2803xseriesDSPhasoneSCIAport.ItcanusethefollowingGPIOportsforcommunication:
GPIO28astheSCIreceivingpin,andGPIO29astheSCItransmittingpin.
GPIO7asthereceivingpin,andGPIO12asthetransmittingpin.

2
UsingSCIforWaveformMonitoring

ForF2802xTarget:
TIF2802xseriesDSPhasoneSCIAport.ItcanusethefollowingGPIOportsforcommunication:
GPIO28astheSCIreceivingpin,andGPIO29astheSCItransmittingpin.
GPIO7asthereceivingpin,andGPIO12asthetransmittingpin.
GPIO18asthereceivingpin,andGPIO19asthetransmittingpin.

ForF2806xTarget:
TIF2806xseriesDSPhas2SCIports:SCIAandSCIB.EachportcanusethefollowingGPIOportsfor
communication:
ForSCIA:
GPIO28astheSCIreceivingpin,andGPIO29astheSCItransmittingpin.
GPIO15asthereceivingpin,andGPIO14asthetransmittingpin.
ForSCIB:
GPIO19asthereceivingpin,andGPIO18asthetransmittingpin.
GPIO23asthereceivingpin,andGPIO22asthetransmittingpin.
GPIO41asthereceivingpin,andGPIO40asthetransmittingpin.
GPIO44asthereceivingpin,andGPIO58asthetransmittingpin.
PSIMsupportsonlyoneoftheaboveSCIportcombinationsatanytimeasRS232.

2.CommunicationviaUSBCable
TherearetwowaystocommunicatewiththeDSP.OneistousetheUSBcable,thesamecable
usedbyCodeComposerStudiotouploadcodetoDSP.TheotheristouseaseparateRS232cable.
Inthissection,thefirstapproachisdescribed.Inthenextsection,thesecondapproachis
described.
DependingontheDSPhardwareboarddesign,SCIportscanbeaccessedviatheUSBcable.
However,hardwaremustbeconfiguredforthecommunicationtowork.TakethepairGPIO28/29
asanexample.InthecaseofcommunicationviatheUSBcable,GPIO28/29mustreceivesignals
thatcanbetracedbacktotheUSBRX/TXports,notfromtheISORX/ISOTXports.
ChangestotheTIcontrolCARDare:
F28335controlCARD: SetSwitchSW1toOFF(bydefault,itison).
F28035controlCARD: SetSwitchSW1toOFF(bydefault,itison).
F28027controlCARD: RemoveResistorR10(bydefault,R10ispresent).
F28069orF28069McontrolCARD:Thereisnochange.
ChangestotheDSPhardwareare:
PowersimsDSPDevelopmentBoard:ForallcontrolCARDSexceptF28069M,settheDIP
switchS7position4toON.ForF28069M,settheswitchpositionto
OFF.

3
UsingSCIforWaveformMonitoring

TIExperimenterKit: ForallcontrolCARDSexceptF28069M,shortcircuitJumperJ9(by
default,J9isopen).ForF28069M,setthejumpertoopen.
TILowVoltageMotorControlandPFCKit(part#TMDS2MTRPFCKIT):ForallcontrolCARDS
exceptF28069M,shortcircuitJumperJ4(bydefault,J4isshort
circuited).ForF28069M,setthejumpertoopen.
NotethatwhentheF28069Mcardisused,acomputerisconnectingtotheF28069Mcarddirectly
throughtheminiUSBportonthecard.ThesamecomputershouldNOThaveanotherconnection
totheUSBportontheDSPhardwareboard.Doingsowillmakethecomputernotabletoestablish
connectiontothecontrolCARDandwillresultinanerrorintheCodeComposerStudio.
Thismeansthat,fortheTIExperimenterKit,whentheF28069Mcardisused,thepowertothe
boardshouldbeprovidedthroughtheconnectorJP1byanexternal5Vpoweradapter.
Alternatively,ifthepowerisprovidedfromtheUSBport,theUSBportshouldbeconnectedtoa
differentcomputerotherthantheoneconnectingtotheF28069Mcard.
AfterthesechangesontheTIExperimenterKitandcontrolCARDs,onecanconnectthecomputer
totheExperimenterKitviaaUSBcable,andthehardwareisreadyforcommunication.

3.CommunicationviaRS232Cable
Alternatively,onecanusetheSCIportontheDSPhardwareifavailable.Notethatthisapproach
doesnotworkforF28069orF28069McontrolCARDasthecardsdonotprovideconnectiontothe
SCIport.
Tousethisapproach,hardwaremustbeconfiguredforthecommunicationtowork.Takethepair
GPIO28/29asanexample.InthecaseofcommunicationviatheRS232cable,GPIO28/29must
receivesignalsthatcanbetracedbacktotheISORX/ISOTXports,nottheUSBRX/TXports.
ChangestotheTIcontrolCARDare:
F28335controlCARD: SetSwitchSW1toON(bydefault,itison).
F28035controlCARD: SetSwitchSW1toON(bydefault,itison).
F28027controlCARD: MakesureResistorR10ispresent(bydefault,R10ispresent).
F28069orF28069McontrolCARD:Notsupported.
ChangestotheDSPhardwareare:
PowersimsDSPDevelopmentBoard:SettheDIPswitchS7position4toOFF.
TIExperimenterKit: SetJumperJ9open(bydefault,J9isopen).
TILowVoltageMotorControlandPFCKit(part#TMDS2MTRPFCKIT):SetJumperJ4open(by
default,J4isshortcircuited).

4
UsingSCIforWaveformMonitoring

Tocommunicatewiththecomputer,aRS232cableisneededtoconnecttheDSPboardtothe
computer.Thiscableneeds3wires:Oneforreceiving(Rx),onefortransmitting(Tx),andanother
forground(Gnd).Theconnectionsoneachendofthecableareshownbelow:
On DSP board side Cable On computer side

TxRx
RxTx
GndGnd
A9pinDB9connector(female)isusedonthecablesothatitcanbeconnectedtothecomputer
serialport.Ifacomputerdoesnothavetheserialport,anUSB/RS232serialadapterwiththeDB9
connector(male)needstobeused.
ThefigurebelowshowstheconnectiondiagramofthecablemadefortheTIevaluationkits.The
DSPendconsistsofa4pinheaderconnector,andthecomputerendusesa9pinDB9connector
(female)toconnecttothecomputerserialport.Ifacomputerdoesnothaveaserialport,an
USB/RS232serialadapterwiththeDB9connector(male)canbeused.
To DSP
board Tx
Tx
To computer or
V33
Gnd
Gnd USB/RS-232
Rx
Rx
adaptor

TI Exp. Kit

ApictureoftheTIExperimenterkit,thecable,andtheUSB/RS232serialadaptorisshownbelow.
OntheExperimenterkit,the4pinconnectorislabelledas"TxV33GndRx".

NotethatiftheUSB/RS232adaptorisused,oneneedstofirstinstallthedriverthatcomeswith
theadaptorordownloadthelatestdriverfromtheadaptormanufacturerwebsite.

5
UsingSCIforWaveformMonitoring

AftertheUSB/RS232adaptordriverisinstalled,plugintheadaptortothecomputerandopen
computerDeviceManagerfromtheControlPaneltofindtheRS232portnumber,asshown
below.ThefigureshowsthattheRS232serialportisCOM3.


Iftherearemultipleserialdevicesconnectedtothecomputer,trytounplugtheUSB/RS232
adaptorandplugitbackintofindouttheportnumber.Rememberthisportnumberasitis
neededinPSIMwhendefiningthecommunicationwithDSP.

4.TestingCommunicationbetweenDSPandComputer
TotestifthecommunicationbetweenDSPandthecomputerworks,ortoisolateanddebugthe
problemifthecommunicationdoesnotwork,performthethreetestsbelow.
NotethatthetestprocedureiswrittenfortheRS232cableapproach.
Test1:DSPOnly
ThistestwillruntheprogramDSP_Rx_Tx_Test.outonDSPboard.
FortheF2833xTarget,thisprogramislocatedinthePSIMfolder"examples\SimCoder\F2833x
Target\DSPRxTxTest".Thetestprogrammakesthefollowingassumptions:
- TheDSPexternalfrequencyis30MHz.
- TheDSPinnerfrequencyis150MHz(PLLis10times)
- ThebaudrateofRS232communicationis115200bps.
FortheF2803xTarget,thisprogramislocatedinthePSIMfolder"examples\SimCoder\F2803x
Target\DSPRxTxTest".Thetestprogrammakesthefollowingassumptions:
- TheDSPusestheinnerclockandthefrequencyis60MHz.
- ThebaudrateofRS232communicationis115200bps.

6
UsingSCIforWaveformMonitoring

PleasecontactPowersimforanalternativetestprogramiftheDSPyouareusinghasadifferent
innerclockfrequency.
ThisprogramsendsoutthedatathroughtheDSPSCIport.TheRS232cablewillbeshortedsothat
thedatawillbeloopedbackandtheDSPwillreceivethesamedatathatitsendsout.Ifthetestis
successful,itmeansthattheserialcommunicationontheDSPsideisworking.
Followthestepsbelowtoperformthetest:
- ConnecttheTIExperimenter'skittothecomputerthroughtheUSBcable.Turnonthe
powerontheExperimenter'skit.
- Connectthe4pinconnectorendoftheRS232cabletothe4pinconnector(labelledas
"TxV33GndRx")ontheExperimenterkitboard.
- UseawiretoshorttheRxpin(pin2)andTxpin(pin3)oftheDB9connector,asshown
here:

ThefollowingstepsaredifferentdependingontheCCSversion.IfCCSv5.5isused:
- Launch CCS. Assume that the target configuration for F28335 or F28035 has already
beencreatedinCSS.Ifthereisnotargetconfigurationsuityourtarget,referto4.Set
TartgetConfigurationinTutorialAutoCodeGenerationforF2833xTargettocreatea
newtargetconfiguration.InCCS,selectView>>TargetConfigurations.Inthe"Target
Configurations"panel,rightclickatthecorrespondingtargetconfigurationfile(.ccxml)
andselectLaunchSelectedConfigurationinthepopupmenu.
Select Run >> Connect Target to connect to the target board
Select Run >> Load >> Load Program to load DSP_RxTx_Test.out file.
Select Run >> Free Run to run the program in the target board.
Ifthecommunicationworks,thetworedLEDlightsLD2andLD3ontheF28335/F28035
controlCardwillbeon.ThelocationsofthesetwoLED'sareshownbelow(circledinred):



F28335controlCard

F28035controlCard

7
UsingSCIforWaveformMonitoring

F28027controlCard

F28069controlCard



Test2:ComputerOnly
Thistestwillrunaprogramonthecomputertosendoutthedatathroughthecomputerserial
port.TheRS232cablewillbeshortedsothatthedatawillbeloopedbackandthecomputerwill
receivethesamedatathatitsendsout.Ifthetestissuccessful,itmeansthattheserial
communicationonthecomputersideisworking.
Followthestepsbelowtoperformthetest:
- ConnecttheUSBadaptertothecomputer,andtheDB9endoftheRS232cabletothe
USBadapter.
- UseawiretoshorttheRxpinandTxpinofthe4pinconnectoroftheRS232cable.
- LaunchPSIM.SelectUtilities>>DSPOscilloscope.Setthecorrectserialportnumber.Set
thebaudrateas115200,andparityasNone.
Click on the Test button. If the communication works, the dialog will show "The test is successful".

Test3:DSPandComputer
ThistestwillrunboththeDSPtestprogramandthecomputertestprogramatthesametime.
DatasentbyDSPwillbereceivedbythecomputer,anddatasendbythecomputerwillbe
receivedbytheDSP.Ifthetestissuccessful,itmeansthattheserialcommunicationbetweenthe
DSPandthecomputerisworking.
Followthestepsbelowtoperformthetest:
- SetupinthesamewayasinTest1.ButinsteadofshortingtheRxandTxpinsofthe
DB9connector,connecttheDB9connectortotheUSBadapter,andconnecttheUSB
adaptertothecomputer.
- RunthetestprograminTest1.
- OntheDSPOscilloscope,clickontheTestbutton.Ifthecommunicationworks,thetwo
redLEDlightsontheDSPcontrolCardwillblinkforaround3sec.beforetheyareoff,
andthecomputerprogramwillreport"Thetestissuccessful".

8
UsingSCIforWaveformMonitoring

IfTest1andTest2aresuccessful,butTest3isunsuccessful,thereareseverallikelycausesofthe
problems:
- RS232Cable:DoublechecktomakesurethatthecableiscrossedsothattheRxpinon
the computer side is connected to the Tx pin on the DSP side, and the Tx pin on the
computersideisconnectedtotheRxpinontheDSPside.
- DSPclockfrequency:ThetestprogramassumesthattheDSPboardclockfrequencyis
30MHz.Ifitisnot30MHz,thecommunicationwillnotwork.
- Baudrate:ThebaudrateonthecomputerinPSIM'sDSP Oscilloscopemustbesetto
115200bps.

5.SettingupinPSIM
InPSIM,loadtheschematicfile3phsinewavewithSCImonitoring.psimschinthefolder"C:\TI
SCI",asshownontheleftbelow.


Inthecircuit,thereare3typesofSCIlibraryelements:SCIConfiguration(highlightedingreen),SCI
Input(highlightedingrey),andSCIOutput(highlightedinyellow),asexplainedinthesections
below.TheseelementscanbeaccessedbygoingtoElements>>SimCoder>>F2833xTarget.

SCIConfiguration
TheSCIConfigurationelementhasfourparameters:
SCIPort: ForF2833x,definestheSCIportfromthefollowinglist:
SCIA(GPIO28,GPIO29)
SCIA(GPIO35,GPIO36)
SCIB(GPIO9,GPIO11)
SCIB(GPIO14,GPIO15)
SCIB(GPIO18,GPIO19)
SCIB(GPIO22,GPIO23)
SCIC(GPIO62,GPIO63)
ForF2803x/F2802x/F2806x,thelistingwillbedifferent.
- Speed(bps): DefinetheSCIcommunicationspeed,inbps(bitspersecond).Alist
ofpresetspeedsisprovidedat200000,115200,57600,38400,
19200,or9600bps.Oronecanspecifyanyotherspeedmanually.

9
UsingSCIforWaveformMonitoring

- ParityCheck: Definetheparitychecksettingforerrorcheckincommunication.It
canbeNone,Odd,orEven.
- OutputBufferSize: DefinethesizeofthedatabufferallocatedinDSPforSCI.The
bufferislocatedintheRAMarea,andeachbufferelementstores
onedatapointwhichconsistsofthree16bitwords(thatis,6
bytes,or48bits,perdatapoint).

SCIInput
ToadjustaparameterinsidetheDSPatruntime,onecanuseaSCIInputelementinthe
schematic.TheSCIInputelementbehavesasasignalsource,andcanbeusedinboththemain
schematicandsubcircuits.AninitialvaluecanbesetfortheSCIInputelement,andthisvaluewill
beuseduntilitischanged.Userscanchangetheparameteronthecomputer.Thechangewillbe
senttotheDSPthroughtheSCIcommunication,andtheparameterwillbeupdatedontheDSPat
runtime.
Inaschematic,upto127SCIInputelementscanbeused.

SCIOutput
TomonitoranddisplaythewaveformofasignalinsidetheDSPatruntime,onecanplaceaSCI
Outputelementontheschematic.TheSCIOutputelementbehavesasanoutputprobe,andcan
beusedinboththemainschematicandsubcircuitsotherthaneventsubcircuitsandinterrupt
subcircuits.ThewaveformofaSCIOutputelementwillbeincorrectiftheelementisinsidean
eventorinterruptsubcircuit.
Inaschematic,upto127SCIOutputelementscanbeused.
TheSCIOutputelementhasoneparameter:DataPointStep.Itdefineshowfrequentthedatais
sentout.IftheDataPointStepissetto5,forexample,only1pointsoutofeveryavailable5points
willbesentfromDSPtothecomputer.
Tocalculatethetimethatittakestosendonedatapoint,adatapointhas6bytes,andthe
commandandotherinformationtake2bytes,makingit8bytesintotalforonedatapoint.When
sendingoutonebyteofdata,onestartbitandonestopbit,andpossiblyoneparitycheckbit,
needtobeadded.
Withtheparitycheck,thetotalbitlengthforonedatabytewillbe11(1startbit,8databits,1
paritycheckbit,and1stopbit),andwithouttheparitycheck,thetotalbitlenghtforonedatabyte
willbe10(1startbit,8databits,and1stopbit).
Thetimethatittakestosendonedatapointcanbecalculatedasfollows:
TotalBitLength*8/SCISpeed
Forexample,iftheSCIcommunicationspeedis115200bps,andnoparitycheckisused,sending
outonedatapointwilltake10*8/115200,or0.000694sec.Inanotherword,DSPcansendout
upto1/0.000694=1440datapointsinonesecond.

10
UsingSCIforWaveformMonitoring

6.GeneratingandRunningCodeonDSP
OnecansimulatethecircuitbyselectingSimulate>>RunSimulation.Inthesimulation,thevalues
ofSCIInputelementswillbefixedattheirinitialvalues.
Togeneratethecode,anduploadandrunitontheDSPunderCCSv5.5,followthestepsbelow:
- GeneratecodebyselectingSimulate>>Generatecode.
- Connect the DSP board to the computer with the USB cable. In this example, the TI
Experimenter'sKithasanonboardXDS100USBemulator,andcanbeconnectedtothe
computerdirectlywithoutanexternalJTAGemulator.
- Also,makesurethattheUSB/RS232adaptorisdisconnectedfromthecomputer.For
somereason,ifthecomputerisconnectedtotheDSPboardviatheRS232cable,the
CodeComposerStudiocannotestablishtheconnectionwiththeDSP.
- Start CCS. Select Project >> Import Legacy CCSv3.3 project and load the generated
project from the subfolder 3ph sine wave with SCI monitoring (C code)of the
schematicfolderinthepopupdialogwindow.Inthedialogwindow,clickonNextand
FinishtotransferCCSv3.3projecttoCCSv5.5.Theprojectnamewillbedisplayedinthe
ProjectExplorer.
- Right click on the project name in the Project Explorer panel and select Build Project
fromthepopupmenutobuildthisexample.
- Select View >> Target Configurations to open the target configuration, and link the
correspondinguserdefinedconfiguration(.ccxmfile)tothisproject.Ifthereisnotarget
configuration suit your target, refer to 4. Set Target Configuration in Tutorial Auto
CodeGenerationforF2833xTargettocreateanewtargetconfigurationandlinkitto
yourproject.
- Click on the project name in the Project Explorer panel, and select Run >> Debug to
upload program to the target. After the program is uploaded, CCS will stop at the
main()function.SelectRun>>FreeRuntoruntheprogram.

7.MonitoringWaveformsandAdjustingParameters
AsthecodeisnowrunningintheDSP,wecanmonitorwaveformsandchangeparameters
followingthestepsbelow.NotethattheDSPwillnotsendoutanydatauntilitisrequested.
- Connect the RS232 cable to the DSP board on one end, and to the computer on the
otherend.Ifthecomputerdoesnothavetheserialport,useanUSB/RS232adapter.
- InPSIM,selectUtilities>>DSPOscilloscope.Thedialogwindowisshownbelow.
- UnderPortsettings,settheserialportnumbertobethesameasonefoundinStep2.
Forexample,iftheserialportisCOM3,settheserialportnumberto3.
Also,setthebaudrateandtheparitychecktobethesameasdefinedintheSCIConfiguration
elementinPSIM.Inthisexample,thebaudrateissetto115200bps,andtheparitycheckissetto
None.
UnderOperationmode,chooseContinuous.IntheContinuousoperationmode,dataaresent
fromDSPtothecomputercontinuously.Inthecasewherethecommunicationspeedisnotfast
enoughtosendoutallthedata,somedatawillbelostandtheDataIntegrity(shownatthelower
leftcorner)willbelessthan100%.

11
UsingSCIforWaveformMonitoring

Ontheotherhand,intheSnapshotoperationmode,everydatapointintheDSPbufferwillbe
sentout,andthecompletedatasetwillbedisplayedontheDSPOscilloscope.Afterallthedatain
thebufferaresentout,thebufferwillberefilled.Inthismode,thedataisnotcontinuous,buta
snapshotiscapturedeverytime.
Click on the Connect button in the lower left corner to connect the computer to the DSP. If
connection is successful, all output and input variables will be displayed in the left side of the
window, as shown in the figure below.


Ifconnectioncannotbeestablished,pleasecheckthefollowing:
- Makesurethattheserialportnumberiscorrect.
- MakesurethatthecommunicationspeedandparitychecksettingsintheDSPOscilloscope
arethesameasintheSCIConfigurationelementinPSIM.
- IftheUSBcableapproachisused,makesurethatthecorrectUSBportisselected.

12
UsingSCIforWaveformMonitoring

If the RS232 cable approach is used, make sure that the RS232 cable is connected
properlyonbothends.Also,makesurethatthecorrectdriverfortheUSB/RS232adaptor
isinstalledproperlyasinstructed.
- MakesurethattheDSPexternalclockontheDSPhardwareissameasthesettinginthe
DSPClockelementinPSIM.
- MakesurethattheDSPcodeisrunning.
TodisplaywaveformsofoutputvariablesdefinedbytheSCIOutputelements,selectthevariables
fromtheAllVariablescolumn,andclickonthe>>buttontomovethemtotheSelectedvariables
column.Thewaveformsoftheselectedvariableswillbedisplayedinthescope,asshownbelow.


Toremoveavariablefromdisplay,highlightitintheSelectedvariablescolumn,andclickonthe
<<button.
Input variables are the parameters that can be changed in the DSP code. Input variables are
defined either by the SCI Input elements (such as the SCI Input element AngleStep in this
example), or if a parameter is defined as a global variable (such as the variable Amp in this
example).
Tochangeaninputvariable,enterthenewvalueintheeditbox,andclickonUpdate.Thenew
valuewillbesenttoDSP.Forexample,whentheinputvariableAngleStepischangedfrom1to
0.5,thefrequencyofthewaveformswillbereducedbyhalf.
The lower left corner of the oscilloscope shows Data Integrity. If the data integrity is 100%, it
means that all the data collected have been successfully transmitted and displayed. If the data
integrity is less than 100%, it means that some data points are lost due to the fact that the
requesteddataamountistoolargeandtheDSPdoesnothaveenoughresourcetosendit.Ifthis
occurs, show a fewer number of waveforms, or increase the Data Point Step value in the SCI

13
UsingSCIforWaveformMonitoring

Output elements, so that fewer number of data points need to be transmitted and displayed.
Alternatively,onecanchangetheOperationModefromContinuoustoSnapshot.
ClickonthePausebuttontohaltthedataacquisition,ortheDisconnectbuttontodisconnectthe
computerfromtheDSP.
8.DecidingtheSCICommunicationBufferSize
TherearetwooperationmodesinDSPOscilloscope:continuousmodeandsnapshotmode.Inthe
continuousmode,thebuffersizedoesnotmatterasthedataintegrityisdeterminedbythe
communicationspeed.However,inthesnapshotmode,thebuffersizedeterminestheamountof
datadisplayedintheDSPOscilloscope.Therefore,thebuffersizeshouldbeselectedbasedonthe
considerationofthesnapshotmode.
Inthesnapshotmode,dataaresavedtotheDSPbuffer,andaresenttothecomputeratthe
sametime.Newdatawillcontinuetobesavedtotheavailablebuffercellsuntilnomorefreecells
areavailable.Thiswillhappeniftherateofreceivingdataisfasterthantherateofsendingdata.
Atthispoint,DSPwillstopcollectingthedata,anditwillresumedatacollectionafterallthedata
inthebufferaresentout.
Inthesnapshotmode,sincetheDSPOscilloscopewilldisplayonlythecompletesetofdatainthe
bufferatatime,ifthebuffersizeistoosmall,thedisplayedwaveformwillbeveryshort.Onthe
otherhand,thebuffersizecannotbetoolargeasitislimitedbythephysicalRAMmemory
availableintheDSP.
Tocalculatetheproperbuffersize,assumethatthereisonlyonevariabletodisplay.LetNstepbe
theDataPointStepoftheSCIoutputblock,fsbethesamplingfrequencyofthevariables,Ndisplay
bethenumberofdatapointsoneintendstodisplay,NscibenumberofdatapointsthatSCIsends
outinonesecond,andNbufferbethebuffersize,wehave:
N step N sci
N buffer N display (1 ) 1
fs
Forexample,ifthebaudrateis115200bps,basedonthecalculationinSection4.3,thenumberof
pointsthatSCIcansendoutinonesecondisNsci=1440.Also,iftheDataPointStepNstepis5,the
samplingratefsis10kHz,andthenumberofpointsfordisplayNdisplayis1000,wecancalculated
therequiredbuffersizeas:
5 1440
N buffer 1000 (1 ) 1 281
10000
IfthebuffersizeistoobigtobeallocatedintheRAMmemory,CCSwillreportalinkerroras
below:
"C:\TISCI\3phsinewavewithSCImonitoring(Ccode)\F28335_RAM_Lnk.cmd",line47:
error:runplacementfailsforobject".ebss"
WhenCCSreportsalinkerrorlikethis,trytoreducethebuffersize,orcompileandrunthe
generatedcodeinthe"FlashRelease"mode.

14

S-ar putea să vă placă și