psim tutoria l - psim software...spi comman rmally, one f28335 spi in f2803x spi in 3x target lib...
TRANSCRIPT
Usi
Png SP
PSIMPI in F2
Ja
- 1 -
M Tut2833x/
anuary 2015
toria/F2803
5
al 3x Tar
Powwww.powers
rget
wersim Inc. simtech.com
With the run codeInterfacecommunconvenieWith the implemen
This tutoseveral e
1. SPI
There areF2803x Dcommun
For the F
To use P
To use P
For the F
To use P
To use P
To use P
SimCoder Ms for DSP bo (SPI) blockicate with ex
ently. Writincapability tontation proc
orial describexamples wit
in TI F283
e one set of SDSP. They hicate with SP
F2833x hardw
orts GPIO16
- GPIO- GPIO- GPIO- GPIO
orts GPIO54
- GPIO5- GPIO5- GPIO5- GPIO5
F2803x hardw
orts GPIO16
- GPIO- GPIO- GPIO- GPIO
orts GPIO3,
- GPIO3- GPIO5- GPIO- GPIO
orts GPIO12
- GPIO- GPIO- GPIO
Usin
Module and oards that usks in the F28xternal SPI dg code manuo support SPess.
es how SPI bth SPI D/A c
33x/F2803
SPI module have differenPI devices. T
ware target:
6-GPIO19:
16 as SPI da17 as SPI da18 as SPI cl19 as SPI sla
4-GPIO57:
54 as SPI da55 as SPI da56 as SPI clo57 as SPI sla
ware target:
6-GPIO19 of
16 as SPI da17 as SPI da18 as SPI cl19 as SPI sla
5, 18 and G
3 as SPI data5 as SPI data18 as SPI clo19 as SPI sla
2-GPIO15 of
12 as SPI da13 as SPI da14 as SPI cl
ng SPI in F2
the F2833x/se TI F2833x33x/F2803xdevices (suchually for SPIPI, PSIM gre
blocks and dconverter and
3x
in TI F2833nt sets of GPThe GPIO po
ata output piata input pinock SPICLKave transmit
ata output pinata input pinock SPICLKave transmit
f SPIA:
ata output piata input pinock SPICLKave transmit
GPIO19 of SP
a input pin a output pinock SPICLKave transmit
f SPIB:
ata output piata input pinock SPICLK
2833x/F2803
- 6 -
/F2803x Harx/F2803x serx Target librah as externalI devices is oeatly simplifi
defined and ud A/D conve
x DSP and 2PIO ports. PSorts used by
n n K t-enable pin
n
K -enable pin S
n n K t-enable pin
PIA:
K -enable pin S
n n K
3x Target
rdware Targeries DSP. Byary, one can l A/D and Doften a time-fies and spee
used in PSIMerters are pro
2 sets of SPISIM supports SPI module
SPISTE
SPISTE
SPISTE
SPISTE
et, PSIM cany using the Simplement t
D/A converte-consuming eds up the co
M. To illustraovided.
I modules (Ss the use of tes are listed b
Powewww.powersi
n generate reSerial Periphthe function
ers) easily anand non-triv
oding and ha
ate the proce
SPIA and SPthese GPIO below.
ersim Inc. imtech.com
eady-to-heral s to
nd vial task. ardware
ess,
PIB) in ports to
To use P
There areConfiguraccessed
The func
1.1 SP
The SPI The SPI in the ma
The para
-
-
If there ischip sele
In the exand Pin1
-
- GPIO
orts GPIO24
- GPIO- GPIO- GPIO- GPIO
e four types ration, SPI D
by going to
ctions and de
PI Configura
ConfiguratioConfiguratioain schemati
meters of th
SPI Port: GPIO16-1
Chip Seledevices, wPin3. Thegenerate t
s only one Sct signal. If
amples in th, will be suff
SPI Buffebuffer sav
CCCC
F28
SPI
CCCC
F28
SPI C
Usin
15 as SPI sla
4-GPIO27 of
24 as SPI da25 as SPI da26 as SPI cl27 as SPI sla
of SPI librarDevice, SPI I Elements >
efinitions of
ation
on block defon block muc.
e SPI Config
Define the S19, GPIO3, 5
ect Pin0 to Pwhich requirese GPIO porthe chip sele
SPI device, oa chip select
his tutorial, thfficient. The
r Size: Definves the index
CS0CS1CS2CS3
8335
Config
CS0CS1CS2CS3
803x
Config
ng SPI in F2
ave transmit
f SPIB:
ata output piata input pinock SPICLKave transmit
ry elements Input, and SP>> SimCode
f these eleme
fines chip seust be present
guration blo
SPI port as e5, 18, 19, GP
Pin3: Both F2res four GPIOrts and the S
ect signal for
ne can use jution pin is no
here are up tother pins, P
ne the bufferx of a SPI co
CS0CS1CS2CS3
Sync
In
SPI De
F283
CS0CS1CS2CS3
Sync
In
SPI De
F280
2833x/F2803
- 7 -
t-enable pin
n n K t-enable pin
in PSIM's F2PI Output. Ter >> F2833
ents are desc
lection pins t in a schem
ck are:
either GPIO1PIO12-15 or
2833x and FO pins for chSPI slave tranr SPI devices
ust the SPI sot used, set i
to three SPI Pin2 and Pin
r size of the ommand. No
ntr
evice
35
ntr
evice
3x
3x Target
SPISTE
SPISTE
2833x/F280Their images3x Target or
cribed in the
and the buffmatic if SPI is
16-19 or GPr GPIO24-27
F2803x Targehip select as nsmit-enables.
slave transmit to Not Use
devices. Thun3, are not us
SPI commanormally, one
F28335
SPIin
F2803x
SPIin
03x Target lib are shown b
r F2803x Ta
following se
fer size for ths used, and t
PIO54-57 for7 for F2803x
ets support u defined by e pin SPIST
mit-enable pined.
us two chip sed.
nds. Each mcan specify
F
F
Powewww.powersi
brary: SPI below. Theyarget in PSIM
ections.
he SPI commthis element
r F2833x; orx.
up to 16 SPIChip Select E are used to
n SPISTE as
select pins, P
memory cell othe buffer s
SPI28335
out
SPI
2803x
out
ersim Inc. imtech.com
y can be M.
mands. must be
r
I Pin0 to o
s the
Pin0
of the ize as 1
plus the nCommandelements.
PI Device
evice block device blocks
meters of th
Chip SeleSPI devic
matic, the chfiguration ble, however, o
amples in thd to Pins CS
Communidifferent S
Clock Typedge withpicture be
t PSIM onlyge or falling
Usin
number of SPd, Sending D
defines the ins in the schem
e SPI Devic
ect Pins: Spece. When the
hip select pinlock, withoutone would n
his tutorial, PS0 and CS1 o
ication SpeedSPI devices
pe: F2833x Dh delay, fallinelow.
supports theg edge of the
ng SPI in F2
PI commandData Comma
nformation omatic must b
e block are:
ecify the state chip select
ns of all the t defining ho
need to imple
Pins CS0 andof the SPI C
d (MHz): Spcan have dif
DSP supportng edge with
e situation wSPI clock si
2833x/F2803
- 8 -
ds (i.e. Start Cand, and Syn
of the corresbe same as th
e of the chippins are at th
SPI devicesow the chip ement the co
d CS1 of extonfiguration
pecify the SPfferent comm
ts four SPI chout delay, a
where the DSignal SPICL
3x Target
Conversion nc. Comman
sponding SPhe number o
p select pins his state, thi
s are connectselect logic
orresponding
ternal A/D ann element.
PI communicmunication s
clock types: rand falling ed
SP and SPI dLK.
Command, Rnd) in all SPI
PI hardware dof SPI hardw
correspondiis SPI device
ted to the chis implemen
g chip select
nd D/A conv
cation speedspeeds.
rising edge wdge with del
device latch d
Powewww.powersi
Receiving DI Input/Outpu
device. The ware devices.
ing to the pae is selected.
hip select pinnted. In the alogic accord
verters are
d, in MHz. N
without delalay, as show
data at the sa
ersim Inc. imtech.com
Data ut
number .
articular .
ns of the actual dingly.
Note that
ay, rising wn in the
ame
-
-
A SPI deconverterthe devicsignal is
A SPI inpenter the
On the otmultiple the conve
-
-
-
-
-
A SPI coonly the
CommandSPI comm
Sync. Actidevice. It
evice can be r is an input
ce, and then reset at the n
put device uinterrupt ser
ther hand, anD/A converersion. The s
SPI Initia
Hardwaregeneratesthe input interrupt,
- Interrupt conversio
No inSPI incomm
Multiconveinputdevicgenerfetchsame
One-This requedevicconve
Command
Conversiothat determSPI devic
ommand conlower bits ar
Usin
d Word Lengmunication c
ive Mode: Spcan be eithe
either an inpdevice. Ususet the synchnext comman
using the synrvice routine
n external Dsion commasynchronizat
al Command
e Interrupt M. This is valiof a digital o Rising edge
Timing: Speon. It can be
nterrupt: No nput device.
mand.
iple interrupersion. This t channels. Ince starts the crate an interrthe convers
e SPI input d
time interrupis for a SPI
est. In this cace completesersions are c
d Gaps (ns):
on Sequencemine the con
ce generates
sists of a serre the signifi
ng SPI in F2
gth: Define tcommands. It
pecify the trer Rising edg
put device orually DSP wihronization snd of the sam
nchronizatione.
/A converterands to the detion signal is
: Define the
Mode: Specifid only whenoutput elemee, or Falling
ecify how a Sone of the fo
interrupt is . This device
pt in series: Mis for a SPI
n this case, Dconversion. rupt. In the ision result, andevice.
pt: Only onedevice that case, DSP sens the converscomplete, the
Define the g
e: Define thenversion seqmultiple inte
ries of 16-biticant bits use
2833x/F2803
- 9 -
the word lent can be from
iggering moge or Falling
r an output dill send one signal to starme device.
n signal usua
r are an outpevice, and ths reset at the
SPI comman
fy the type on the SPI devent. It can beedge.
SPI input deollowing:
generated. Ine starts the c
Multiple intedevice that h
DSP send theWhen the co
interrupt servnd start a ne
e interrupt iscan perform nds the commsion of multie SPI device
gap between
names of thquence. Noteerrupts in se
t numbers seed by the com
3x Target
ngth, or the lem 1 to 16 bit
ode of the syng edge.
device. For eor multiple Art the conver
ally needs an
put device. Uhen sets the se next comm
and that initia
of the interruvice's interrue one of the f
evice generat
n this case, Donversion an
errupts are ghas one A/De first conveonversion is vice routine,
ew conversio
s generated amultiple cha
mand to the iple input che will genera
n two SPI co
he SPI input e that this paeries.
eparated by cmmand. For
ength of the ts.
nchronizatio
example, an A/D conversrsion. The sy
n interrupt pi
Usually DSPsynchroniza
mand of the sa
alizes the SP
upt signal thaupt output nofollowings: N
tes interrupt
DSP sends tnd returns th
generated in D conversionersion comm
complete, th, DSP will seon of another
at the end of annel conveSPI input de
hannels. Wheate an interru
ommands, in
elements, searameter is v
comma. In thr example, if
Powewww.powersi
significant b
on signal of t
external A/Dsion commanynchronizati
in to trigger
P sends one oation signal tame device.
PI device.
at the SPI deode is conneNo hardwar
when it com
the commandhe result in th
series after en unit and mumand, and the
he SPI devicend a commr channel of
f the conversrsions in oneevice, and then all the upt.
nsec.
eparated by calid only wh
he 16-bit nuf the Comma
ersim Inc. imtech.com
bits, of
the SPI
D nds to ion
DSP to
or o start
evice ected to re
mpletes
d to a he same
each ultiple e SPI ce will
mand to f the
ion. e
he SPI
comma hen the
umber, and
Word Le"0x12, 7,
1.3 SP
A SPI inppropertieinput cha
The para
- -
-
-
where -
-
- -
This formthat the dthe 3rd w
-
-
In the DC- -
In the AC- -
The para-
ength is 8, Bi, 0" is a com
PI Input
put device mes of an inpuannel.
meters of th
Device NaStart Conseparated Receivingseparated Data Bit Pis:
ElementNuse y inste{} means
xn is the nMSB..LSB
mula definesdata length isword. If the r
- Input Ranvalid onlDC, the iranges fr
- Scale Fadevice isreceives the result
C conversionIn simulatIn hardwa
C conversionIn simulatIn hardwa
meter Data_- ADC Mo
Note that
Usin
its 0 to 7 aremmand with 3
may have mut channel for
e SPI Input b
ame: Definenversion Com
by comma (g Data Comm
by comma (Position: De
Name is the nead. that the item
nth word receB defines the
the data lens 12, and thereceived data
nge: Specifyly when the Sinput rangesrom –Vmax/2
ctor: Specify not an A/D from SPI cot is scaled ba
n mode: tion: Output are: Output =
n mode: tion: Output are: Output =
_Length is caode: Define tt this parame
ng SPI in F2
e the comman3 command
ultiple input r SPI commu
block are ex
e the name ofmmand: Defi(for examplemand: Defin(for exampleefine where t
ElementNa
name of the S
m in the brac
eived from te position of
ngth of a SPIe result is thea string is 0x
y the parameSPI device i from 0 to Vto Vmax/2.
fy the output converter, a
ommunicatioased on the f
= Input * K= Result * V
= Input * K= (Result - 2
alculated frothe A/D conveter is valid
2833x/F2803
- 10 -
nd, and Bitswords.
channels. Thunication, an
xplained belo
f the SPI inpine the start e, 0x23, 0x4
ne the receivie, 0x23, 0x4the data bits
me={xn[MS
SPI input ele
cket repeats m
the SPI inputf the significa
I input device lower 4 bitx12, 0x78, 0x
eter Vmax thas an A/D con
Vmax; if the de
scale factorand the resulon. Otherwisfollowing:
Kscale Vmax * Kscale
Kscale 2Data_Length-1)
om the Data version modonly when th
3x Target
8 to 15 are
he SPI Inputnd one SPI I
ow:
put device. conversion c3, 0x00). ing data com3, 0x00). are in the re
SB..LSB]}
ement. If it i
multiple tim
t device, andant bits in th
ce. For examts of the 2ndxAF, then th
at defines thenverter. If thevice conver
r Kscale. If thelt will be exae, the SPI de
e / 2Data_Length
* Vmax * K
Bit Positionde of the devhe device is
not used. As
t block is useInput block c
command, in
mmand, in he
eceiving data
is the current
mes.
d n starts frohe word.
mple, y=x1[3d word and thhe result will
e input rangehe device conrsion mode i
e scale factoractly the samevice is an A
h
Kscale / 2Data_L
n formula. vice. It can be
an A/D con
Powewww.powersi
s an example
ed to define corresponds
n hex numbe
ex numbers,
a string. The
t SPI input e
om 0.
..0]x2[7..0], he lower 8 bl be 0x8AF.
e. This paramnversion mois AC, the in
r is 0, the SPme as what DA/D converte
Length-1
e either DC nverter.
ersim Inc. imtech.com
e,
the to one
ers,
e format
element,
means its of
meter is ode is nput
PI DSP er, and
or AC.
-
1.4 SP
A SPI oupropertieone outpu
The para--
In the DC--
In the AC--
The paraOutput R
-
-
-
-
where
For exambe 0x8, a
-
- Initial Va
PI Output
utput device es of an output channel.
meters of th- Device N- Scale FaC conversion- In simula- In hardwC conversion- In simula- In hardw
meter Data_Range.
- Output Rparametemode is Dthe outpu
- DAC Moparamete
- Sending Da series o
Data Bit Pis:
Elemeeleme
{} me
xn is t MSB..
mple, if y=x1and the lowe
- Sync. Codevice. It0x23,0x4synchron
Usin
alue: Define
may have mut channel fo
e SPI OutpuName: Define
ctor: Specifyn mode: ation: Ou
ware: Oun mode: ation: Ou
ware: Ou
_Length is ca
Range: Specier is valid onDC, the output ranges fro
ode: Define ter is valid on
Data Commof hex numb
Position: De
entName is thnt, use y inst
eans that the
the nth word LSB defines
1[3..0]x2[7..0r 8 bits of th
ommand: Deft consists of 43,0). This cnization sign
ng SPI in F2
the initial v
multiple outpufor SPI comm
ut block are ee the name o
fy the output
utput = Inpuutput = Resu
utput = Inpuutput = 2Data
alculated fro
ify the paramnly when theput ranges frm –Vmax/2
the D/A convnly when the
mand: Defineers separated
efine where t
ElementNa
he name of Stead. item in the b
sent to the Ss the position
0] and if the he 3rd word w
fine the comf a series of hcommand is unal.
2833x/F2803
- 11 -
value of the i
ut channels. munication, a
explained beof the SPI ou
scale factor
ut * Kscale ult * Kscale *
ut * Kscale Length-1 + Res
om the Data
meter Vmax e SPI device rom 0 to Vm to Vmax/2.
version mode device is a
e the command by comma
the data bits
me={xn[MS
SPI output e
bracket repe
SPI output dn of the sign
result is 0x8will be 0xAF
mmand to synhex numbersused when th
3x Target
input.
The SPI Ouand one SPI
elow: utput device.r Kscale. The o
2Data_Length /
sult * Kscale *
Bit Position
that defines is a D/A con
max; if the de
de. It can be D/A convert
nd to send tha (for examp
are in the se
SB..LSB]}
element. If it
eats multiple
device, and nnificant bits i
8AF, the lowF.
nchronize ous separated bhe SPI outpu
utput block iI Output bloc
. output is cal
Vmax
* 2Data_Length-
n formula, an
the output rnverter. If thevice conver
either DC orter.
he output daple, 0x23,0x4
ending data s
t is the curren
times.
n start from 0in the word.
wer 4 bits of
utput channeby comma (fut device do
Powewww.powersi
s used to defck correspon
lculated as fo
-1 / Vmax
nd Vmax is t
range. This he device consion mode is
r AC. Note th
ata. The com43,0x00).
string. The f
nt SPI outpu
0.
f the 2nd wor
els of the SPIfor example, es not have
ersim Inc. imtech.com
fine the nds to
ollows:
the
nversion s AC,
hat this
mmand is
format
ut
rd will
I output
the
2. SPI
A typical- - - - -
A typical- - -
3. Lim
There are
-
-
-
4. Exam
To illustr
Command
l sequence foSend the dSend the sSet the sySend the rReceive th
l sequence foSend the dSend the sSet the sy
mitations
e several lim
SPI Opera
PSIM onllinks to on
Data Latc
TI F2833xlatch timethe same tdata at a dF2833x/FOther Lim- SPI co
PSIM doeactions. Fcommand
- Check
PSIM doeto accept same com
- Daisy
PSIM doe
mples
rate how SPI- Extern- Extern- Extern
Usin
d Sequenc
or a SPI inpudevice initiastart comma
ynchronizatioreceiving dahe result and
or a SPI outpdevice initiasending data
ynchronizatio
mitations in th
ation Mode:
ly supports Sne or more S
ch Timing:
x/F2803x De can be eithtiming to latdifferent tim
F2803x. mitations: ommand com
es not suppoFor example,d or a display
king the SPI
es not suppothe next com
mmand or it t
y chain
es not suppo
I elements arnal D/A convnal A/D convnal A/D conv
ng SPI in F2
ces
ut device is sal command and and wait on signal andata commandd call a funct
put device isal command a command.on signal to
he SPI funct
SPI in the maSPI devices,
SP assumes er the fallingtch data. A S
ming than the
mbined with
rt the type o a SPI LCD y character I
device busy
rt the type ommand. The triggers an in
rt daisy chai
re used, threverter MCP4verter MCP3verter TLV1
2833x/F2803
- 12 -
shown below(optional). for interrup
d wait for ind. tion to conti
s shown belo(optional).
enable the n
tionality in P
aster operatiand all SPI
that input/oug edge or risSPI device w
DSP. Note
h GPIO port a
of SPI devicedisplay may/O.
y status
of SPI devicedevice can b
nterrupt whe
in.
ee examples 4922 3204 (withou1548 (with in
3x Target
w:
pt (optional).nterrupt (opti
nue the next
ow:
new value (op
PSIM.
ion mode. It devices are
utput data arsing edge of will be not su
that this lim
actions
e if its commy need a GPI
e that needs tbe supporteden conversio
are provided
ut interrupt)nterrupt)
ional).
t action.
ptional).
assumes thain the slave
re active at tthe SPI cloc
upported if itmitation is fro
mand is combIO port to de
to check if thd if it returns
on is complet
d in PSIM:
)
Powewww.powersi
at only one Dmode.
the same timck. SPI devict latches the om the TI
bined with Gefine if the d
he device is s the result inte.
ersim Inc. imtech.com
DSP
me. The ces use input
GPIO data is a
ready n the
These exSimCode
4.1 Ex
MCP492informati
- -
- - - -
4.1.1 Cir
This examtarget is iin DSP. TThe files"example
The hard
xamples are ler\F2803x Ta
xternal D/A
22 is a D/A cion that PSIM
The SPI cThe serialDSP SPI cconversio
There is nThere is nThere is aThe sendi0xF000. T
rcuit Schema
mple is implidentical excThey are the of this exames\F2803x T
dware circuit
Usin
located in tharget\” in the
Converter U
converter froM needs fromclock frequenl interface timclock type is
on command
no device inino interrupt pa synchronizaing data comThe result wi
atic
lemented in cept the DSPen sent to themple are in thTarget\DAC w
t diagram for
ng SPI in F2
e folder “exae PSIM dire
Using MCP
om Microchipm the manufncy is up to 2ming diagrams rising edges is 15ns.
itial commanport. ation port to
mmand of Chill be placed
both F2833xP is differente external D/he folder "exwith SPI" fo
r the F2833x
2833x/F2803
- 13 -
amples\SimCctory.
P4922
p Technologfacturer data20MHz. m of MCP49e with delay,
nd nor start c
o synchronizehannel A is 0d in the last 1
x and F2803t. In this exam/A converterxamples\F28or F2803x.
x Target is sh
3x Target
Coder\F2833
gy Inc. It hasasheet is liste
922, as show, and the tim
conversion c
e output tim0x7000, and 12 bits of the
x Targets, ample, two sir MCP4922 v833x Target\
hown below
3x Target” o
s two D/A ched below:
wn below, inme interval be
command.
ming. the comman
e command.
and the impleine wave sigvia SPI as tw\DAC with S
w.
Powewww.powersi
or “examples
hannels. The
ndicates that etween two
nd of Chann
ementation ignals are genwo analog ouSPI" for F28
ersim Inc. imtech.com
s\
e
the
el B is
in each nerated utputs.
833x and
Similarly
In both stransmissslave tranPort GPIoutputs.
The corre
The corre
y, the hardwa
chematic, Dsion; SPICLnsmit-enableO14 is conn
esponding P
esponding P
Usin
are circuit di
SP's SPIDOK pin (GPIOe pin SPISTEnected to MC
SIM schema
SIM schema
ng SPI in F2
iagram for th
OUT pin (GPO18) is connE (GPIO19)
CP4922’s LD
atic for the F
atic for the F
2833x/F2803
- 14 -
he F2803x T
IO16) is connected to MC
is connectedDAC. This co
F2833x Targ
F2803x Targ
3x Target
Target is sho
nnected to MCP4922's SCd to MCP49onnection is
get is shown
get is shown
wn below.
MCP4922's SCLK pin as S922’s chip ses to synchron
below.
below.
Powewww.powersi
SDI pin for dSPI clock; thelect pin CS;nize two D/A
ersim Inc. imtech.com
data e SPI and
A
In both sthe sync
With the chip sele
Note thatbetween needed.
4.1.2 Def
Three typSPI Devi
-
-
chematic, thinput of MC
use of the Sct signal. Th
t in PSIM, itthe SPI Con
efining SPI E
pes of SPI elice, and SPI
SPI ConfiSince therin this cas
SPEx
Ch SP
SPI Devicparameter
Ch Co Cl Co Sy SP Ha
Usin
he output D0CP4922 for s
SPISTE signahat is why in
t is implied tnfiguration b
Element Par
lements are uOutput. The
iguration: Thre is only onse. The paramPI Port: GPIxperiment's Khip Select PiPI Buffer Siz
ce MCP4922rs are definehip Select Piommunicatiolock Type: "ommand Woync. Active MPI Initial Co
Hardware Inte
ng SPI in F2
0 of the Digitynchronizat
al, this circun the circuit,
that SPISTEblock and the
rameters
used in the Peir parameter
here should bne SPI devicemeters of theIO16-19. NoKit. in0 to Pin3: ze: 32. In thi
2: Accordinged as below:ins: 0000. Non Speed (M"Rising edgeord Length: Mode: "Higmmand: Noerrupt Mode
2833x/F2803
- 15 -
tal Output blion.
uit does not nthe chip sele
, SPICLK, Se SPI Device
PSIM schemrs are set as
be only one e in this casee SPI Configote that this i
"Not used"is example, t
g to the datas
No chip selecMHz): 20 e without del
8 bits gh to low" o initial comme: "No hardw
3x Target
lock is set to
need any othect pins CS0
SPIDIN, ande block. Thu
matic in this efollows:
SPI Configue, SPISTE isguration blocis the only g
the minimum
sheet inform
ct pin is used
lay"
mand ware interrup
o GPIO14 an
her GPIO por0 to CS3 are
d SPIDOUT us no externa
example: SP
uration elems used as theck are define
group allowe
m length is 4
mation of MC
d.
pt"
Powewww.powersi
nd is connect
rts to generanot used.
pins are conal connection
PI Configura
ment in a schee chip select ed as followed in the TI
4.
CP4922, the
ersim Inc. imtech.com
ted to
ate the
nnected n is
tion,
ematic. signal
ws:
Accordin
- - - - - -
- -
The defin"0xF000
4.1.3 Ge
User can
-
-
- -
For CCS
-
-
-
-
With the PSIM's Dlab digita
In Co Co SP
ng to the data
Device NaScale FacOutput RaDAC ModSending DData Bit Ptwo 8-bit Sync. ComSPI Outpu
nitions are th".
enerating an
simulate an
Select Filor "exampSelect SimSCI InputSelect SimConnect tcable is ussure to disnot be abl
v5.5, upload
Start CCSthe generafolder. In project to Right clicfrom the pSelect Vieand link thClick the select RunCCS will
code runninDSP Oscillosal oscilloscop
Usin
terrupt Timiommand Gaonversion SePI Output M
asheet inform
ame: “SP_Dtor: 1 ange: 3.3 de: DC Data CommaPosition: y =words. mmand: Nout MCP4922
he same as fo
nd Running
nd generate c
e >> Open tples\F2803x mulate >> Rt will not chamulate >> Ghe DSP boarsed to connesconnect thele to connect
d the genera
S v5.5. In CCated project the dialog wCCS v5.1. T
ck on the propop-up menuew >> Targhe corresponproject namn >> Debugstop at the m
ng, connect tscope featurepe to observ
ng SPI in F2
ing: Set to “Naps (ns): 15equence: No
MCP4922 Cha
mation of M
DAC”
and: 0x7000= x0[3..0]x1
ne 2 Channel B
for Channel A
Code on DS
code in the fo
to load the eTarget\DAC
Run Simulatange during
Generate Cord to the comect the DSP be RS-232 cabt to the comp
ated code and
CS, select Prfrom the sub
window, clickThe project noject name inu to build thiet Configurnding user d
me in the Projg to upload pmain() functi
the RS-232 ce to display
ve the SPI sig
2833x/F2803
- 16 -
No Interrupt
one annel A
MCP4922, the
0 [7..0]. The r
A above, exc
SP
ollowing ste
xample fromC with SPI".tion to run ththe simulati
ode to generamputer physiboard with thble from the puter proper
d run this ex
roject >> Imbfolder "DAk on Next anname will ben the Projectis example.
rations to opefined confiject Explorerprogram to thion. Select R
cable betweethe variablesgnals and the
3x Target
t”
e parameters
result will be
cept that the
eps:
m "examples. he simulatioon. ate the code.ically throughe computercomputer. O
rly.
xample follow
mport LegacAC with SPI (
nd then Finie displayed it Explorer pa
pen the targeiguration (.ccr panel to sehe target. AfRun >> Free
en the DSP bs inside the De D/A outpu
s are defined
e placed in th
Sending Da
s\F2833x Tar
n. Note that
. gh a USB car for SCI datOtherwise th
wing the step
cy CCSv3.3 (C code)" ofish to transfein the Projecanel, and sel
et configuratcxml file) to
et it as the cufter the progre Run to run
board and thDSP. At the
uts.
Powewww.powersi
d as below:
he last 12 bi
ata Comman
rget\DAC w
the value of
able. If a RS-ta monitorin
he DSP board
ps below.
project andf the schemaer the CCS vct Explorer pect Build Pr
tion dialog wo this projecturrent projecram is uploan the program
he computer, same time,
ersim Inc. imtech.com
its of
nd is
with SPI"
f the
-232 ng, be d may
d load atic v3.3 panel. roject
window t. t, and
aded, m.
and use use a
The figurclock sigDSP Oscoutput w
(a) Chip SPICLK
(c) D/A o
4.2 E
MCP320receives PSIM ne
- T- T
clco
res below shgnal SPICLKcilloscope scaveforms.
select signal
outputs Vout
External A/D
04 is an A/D a conversioneds from the
The SPI clockThe serial intlock type is ommands is
SPIST
SPIC
VoutB
Vout
Usin
how the oscilK, and D/A ocreen with th
l SPISTE vs
tA and Vout
D Converte
converter frn command e manufactur
k frequency erface timinrising edge w500ns.
TE
CL
tA
ng SPI in F2
lloscope wavoutputs Vouthe two sine si
. SPI clock
tB
r Using MC
rom Microchand returns trer datasheet
is up to 1MHg diagram owith delay, a
2833x/F2803
- 17 -
veforms of thtA and VoutBignals from
(b) SP
(d) Tw
CP3204
hip Technolothe result in t is listed be
Hz f MCP3204,and the time
3x Target
the SPI chip B. The figurinside the D
PI clock SPI
wo sine wav
ogy Inc. It hathe same colow:
, as shown b interval bet
SP
SP
select signare on the low
DSP, which v
ICLK vs. SP
veforms insid
as four inputommand. Th
below, indicatween two co
PICL
PIDOU
Powewww.powersi
al SPISTE, thwer right shovalidate the a
PI output
de DSP
t channels, ae informatio
ates that the onversion
ersim Inc. imtech.com
he SPI ows the analog
and it on that
SPI
There is nThere areThe sameThe receivChannel 2command
rcuit Schem
xample, two files of this
and "exampl
dware circuit
dware circuit
Usin
no device ini no interrupt
e receiving dving data co2 is 0x06,0x8d.
matic
analog voltaexample are
les\F2803x T
t diagram for
t diagram for
ng SPI in F2
itial commant port and sy
data commanommand of C80,0x00. Th
age signals ae in the foldeTarget\ADC
r the F2833x
r the F2803x
2833x/F2803
- 18 -
nd nor start cynchronizationd is used to Channel 0 is he result will
are converteder "exampleswith SPI" fo
x Target is sh
x Target is sh
3x Target
conversion con port. start conver0x06,0x00,0 be placed in
d by MCP32s\F2833x Ta
for F2803x.
hown below
hown below
command.
rsion and get0x00, and thn the last 12
204, and are arget\ADC w
w.
w.
Powewww.powersi
t the result.he command
bits of the
sent to DSPwith SPI" for
ersim Inc. imtech.com
of
P via r
In this exGPIO30,converter
The corre
The corre
xample, inste together wir.
esponding P
esponding P
Usin
ead of using ith the decod
SIM schema
SIM schema
ng SPI in F2
only the SPder chip 74H
atic for F283
atic for the F
2833x/F2803
- 19 -
ISTE signalHCT138, to g
335 target is
F2803x Targ
3x Target
l, it will use generate the
shown belo
get is shown
SPISTE as wchip select s
w.
below.
Powewww.powersi
well as GPIOsignal for the
ersim Inc. imtech.com
O32 and e A/D
Note thatSPI Conf
4.2.2 Def
Paramete
-
Two chip
- - - - - -
Accordin
- - - - - - - - - - -
Accordin
- - -
t since two Gfiguration bl
fining SPI E
ers of the SP
SPI Confi
p select pins
SPI Port: Chip SeleChip SeleChip SeleSPI BufferSPI Devic
ng to the data
Chip SeleCommuniClock TypCommandSync. ActSPI InitiaHardwareInterrupt CommandConversioSPI Input
ng to the data
Device NaStart ConvReceiving
Usin
GPIO pins arlock and the
Element Par
PI blocks are
iguration
are used in
GPIO16-19ect Pin0: GPect Pin1: GPect Pin2 and r Size: 32. Ice MCP3204
asheet inform
ct Pins: 000ication Speepe: "Rising ed Word Lengtive Mode: Dl Command:
e Interrupt MTiming: "Nod Gaps (ns): on SequenceMCP3204 C
asheet inform
ame: "MCPversion Com
g Data Comm
ng SPI in F2
re used to geSPI Device
rameters
set as follow
this example
9 PIO32 PIO30 Pin3: "Not
In this examp4
mation of M
01. It means d (MHz): 2edge with degth: 8 bits Do not care : No initial c
Mode: Do noo interrupt" 0
e: None Channel 0
mation of M
3204" mmand: Nonmand: 0x06
2833x/F2803
- 20 -
enerate the care connecte
ws:
e.
used" ple, the mini
MCP2304, the
that GPIO32.8 elay"
command. ot care
MCP3204, the
ne , 0x00, 0x00
3x Target
chip select sied.
imum is 4.
e parameters
2 = 1 and GP
e parameters
0
ignal, nodes
s are defined
PIO30 = 0.
s are defined
Powewww.powersi
CS0 and CS
d as below:
d as below:
ersim Inc. imtech.com
S1 of the
- - - - - -
The defin0x06,0x8
4.2.3 Ru
The procBelow ar
(a) Signa
(c) SPI c
Data Bit PInput RanScale FacADC ModInitial ValSPI Input
nitions are th80,0x00.
unning the C
cess to generre some osci
al SPISTE v
lock SPICLK
SPIS
SPIC
Usin
Position: y=nge: 3.3V tor: 1 de: DC lue: 0 MCP3204 C
he same as fo
Code
rate, compilelloscope wav
vs. SPI clock
K vs. A/D co
S
S
TE
CL
ng SPI in F2
=x1[3..0]x2[7
Channel 2
for Channel 0
e, and run theveforms from
k SPICLK
onversion co
SPIDOU
SPICL
2833x/F2803
- 21 -
7..0]
0, except tha
e code is simm lab experi
(b) SP
ommand
3x Target
at the Receiv
milar to whatiments.
I clock SPIC
SPIC
SPID
ving Data Co
t is described
CLK vs. A/D
CL
DIN
Powewww.powersi
ommand is
d in Section
D output
ersim Inc. imtech.com
4.1.3.
4.3 E
TLV1548commandreceives the same
The infor
- T- T- T
clco
- - - -
-
-
4.3.1 Cir
In this exSPI. The for F2833
The hard
External A/D
8 is an 8-chad to start conthe next chacommand s
rmation that
The SPI clockThe commandThe serial intlock type is ommands is
There is nFor the faThe hardwSince therchannels, This examTLV1548The conve
rcuit Schema
xample, two files of this
3x and "exam
dware circuit
Usin
D Converte
annel A/D conversion, andannel conversequence.
PSIM needs
k frequency d word lengterface timinrising edge w0ns.
no synchroniast conversioware interrupre is only onconversion
mple only us8_CH0, TLVersion comm
atic
analog voltaexample are
mples\F2803
t diagram for
ng SPI in F2
r with Inter
onverter fromd it generatesion comma
s from the m
is up to 2MHth is found tg diagram owith delay, a
ization signaon mode, thept is triggere
ne 10-bit ADneeds to be es Channel 0
V1548_CH2.mand is 0x00
age signals ae in the folde3x Target\AD
r the F2833x
2833x/F2803
- 22 -
rrupt Using
m Texas Instes an interrupand and send
manufacturer
Hz o be 14 bits f TLV1548,and the time
al. e command ied at the risin
DC unit in TLdone one ch0 and Chann
000 for Chan
are converteder "examplesDC (interrup
x Target is sh
3x Target
g TLV1548
truments. It pt when con
ds the result f
r datasheet is
(either 10 or as shown b interval bet
s 0x2400. ng edge of ELV1548, if thhannel at a tinel 2, and the
nnel 0; and i
d by TLV15s\F2833x Tapt) with SPI"
hown below
receives a cnversion comfrom the pre
s listed below
r 12 bits wouelow, indicatween two co
EOC (end of here are mulime. e conversion
s 0x1000 for
548, and are arget\ADC (" for F2803x
w.
Powewww.powersi
onversion mpletes. Thenevious conve
w:
uld not workates that the onversion
f conversion)ltiple input
n order is
r Channel 2.
sent to DSP interrupt) wx.
ersim Inc. imtech.com
n it ersion in
k). SPI
).
.
via ith SPI"
The hard
This examsignal. T
The corre
dware circuit
mple uses thLV1548 gen
esponding P
Usin
t diagram for
he SPISTE pnerates interr
SIM schema
ng SPI in F2
r the F2803x
in as well asrupt through
atic for the F
2833x/F2803
- 23 -
x Target is sh
s GPIO30 anh Port GPIO1
F2833x targe
3x Target
hown below
nd GPIO32 t15.
et is shown b
w.
to generate th
below.
Powewww.powersi
he chip selec
ersim Inc. imtech.com
ct
The corre
In the schconnectebetween
The interblock, an
When TLOnce theinterrupt,send back
4.3.2 Def
Paramete
-
Two chip
esponding P
hematic, nodd. Again, it the SPI Con
rrupt output nd D0 is defi
LV1548 recee conversion , and send ank the conver
efining SPI E
ers of the SP
SPI Confi
p select pins
Usin
SIM schema
des CS0 and is implied th
nfiguration b
of the SPI dined as GPIO
eives the staris complete
nother commrsion result o
Element Par
PI blocks are
iguration
are used in
ng SPI in F2
atic for the F
CS1 of the hat SPISTE, block and the
evice TLV1O15.
rt conversion, TLV1548 w
mand. TLV1of Channel 0
rameters
set as follow
this example
2833x/F2803
- 24 -
F2803x Targ
SPI ConfiguSPICLK, SP
e SPI Device
548 is conne
n command,will generate548 will star
0.
ws:
e.
3x Target
get is shown
uration blockPIDIN, and e, and no ext
ected to the
it will start e an interruprt the conver
below.
k and the SPSPIDOUT pternal conne
D0 pin of th
the conversipt. DSP will rsion on Cha
Powewww.powersi
PI Device blopins are connction is need
he digital inp
ion on Chanrespond to t
annel 2, and
ersim Inc. imtech.com
ock are nected ded.
put
nnel 0. this will
- - - - - -
Accordin
- - - - - - - - - - -
Accordin
- - - - - - - - -
The paraThe ReceReceive D
4.3.3 Ge
The proc
Below ar
SPI Port: Chip SeleChip SeleChip SeleSPI BuffeSPI Devic
ng to the data
Chip SeleCommuniClock TypCommandSync. ActSPI InitialHardwareInterrupt CommandConversioSPI Input
ng to the data
Device NaStart ConvReceivingData Bit PInput RanScale FacADC ModInitial ValSPI Input
meters are theive Data CoData Comm
enerating an
cess to gener
re some osci
Usin
GPIO16-19ect Pin0: GPect Pin1: GPect Pin2 and er Size: 32 ce TLV1548
asheet inform
ct Pins: 001ication Speepe: "Rising ed Word Lengtive Mode: Dl Command:
e Interrupt MTiming: "Md Gap (ns): on SequenceTLV1548 C
asheet inform
ame: "TLV1version Com
g Data CommPosition: y=nge: 3.3 tor: 1 de: DC lue: 0 TLV1548 C
he same as fommand of C
mand is 0x200
nd Running
rate, compile
lloscope wav
ng SPI in F2
9 PIO32 PIO30 3: "Not use
8
mation of TL
11. That is, Gd (MHz): 2edge with degth: 14 bitsDo not care : 0x2400
Mode: "RisinMultiple inter
0 : "TLV1548
Channel 0
mation of TL
1548" mmand: 0x0mand: 0x080=x0[13..4]
Channel 2
for Channel 0Channel 0 is00, and this
Code on DS
e, and run the
veforms from
2833x/F2803
- 25 -
ed"
LV1548, the
GPIO32 = 1
elay"
ng edge" rrupt in serie
8_CH0,TLV
LV1548, the
0000 00. This is a
0, except thas also the conis a dummy
SP
e code is sim
m lab experi
3x Target
e parameters
and GPIO30
es"
V1548_CH2"
e parameters
also the conv
at there is nonversion comcommand.
milar to what
iments.
are defined
0 = 1.
"
are defined
version comm
o Start Convmmand of Ch
t is described
Powewww.powersi
as below:
as below:
mand of Cha
ersion Commhannel 2. Al
d in Section
ersim Inc. imtech.com
annel 2.
mand. lso, the
4.1.3.
(a) S
(b) S
ignal SPIST
PI clock SPI
SPIC
SP
SPISTE
Usin
TE vs. SPI cl
ICLK vs. A/
CL
PICL
ng SPI in F2
ock SPICLK
/D result
2833x/F2803
- 26 -
K (b) D
(d) SP
3x Target
Detailed view
PI clock SPI
SPIS
SPIC
w of SPISTE
ICLK vs. co
STE
CL
SP
Powewww.powersi
vs. SPICLK
nversion com
ICL
ersim Inc. imtech.com
K
mmand