18
8 - 8 - 1 Texas Instruments Incorporated Module 8 : Serial Communication Interface C2 Module 8 : Serial Communication Interface C2 32-Bit-Digital Signal Controller TMS320F2812

8 - 1 Texas Instruments Incorporated Module 8 : Serial Communication Interface C28x 32-Bit-Digital Signal Controller TMS320F2812

Embed Size (px)

Citation preview

Page 1: 8 - 1 Texas Instruments Incorporated Module 8 : Serial Communication Interface C28x 32-Bit-Digital Signal Controller TMS320F2812

8 - 8 - 11

Texas Instruments Incorporated

Module 8 : Serial Communication Interface C28xModule 8 : Serial Communication Interface C28x

32-Bit-Digital Signal ControllerTMS320F2812

Page 2: 8 - 1 Texas Instruments Incorporated Module 8 : Serial Communication Interface C28x 32-Bit-Digital Signal Controller TMS320F2812

8 - 8 - 22

SCI Pin Connections SCI Pin Connections

Transmitter-databuffer register

Transmittershift register

SCI Device #1

SCIRXD

SCITXD SCITXD

SCIRXD

SCI Device #2

8

Receiver-databuffer register

Receivershift register

8

Transmitter-databuffer register

Transmittershift register

8

Receiver-databuffer register

Receivershift register

8

(Full Duplex Shown)

RX FIFO_0

RX FIFO_15

RX FIFO_0

RX FIFO_15

TX FIFO_0

TX FIFO_15

TX FIFO_0

TX FIFO_15

Page 3: 8 - 1 Texas Instruments Incorporated Module 8 : Serial Communication Interface C28x 32-Bit-Digital Signal Controller TMS320F2812

8 - 8 - 33

SCI-A Programmable Data FormatSCI-A Programmable Data Format

Start LSB 2 3 4 5 7 MSB Parity Stop 1Addr/Data6

This bit present only in Address-bit mode

Stop 2

NRZ (nonreturn to zero) format

Start Bit LSB of Data

MajorityVote

Falling Edge Detected

SCIRXD

SCICLK(Internal)

1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2

Note: 8 SCICLK periods per data bit

Page 4: 8 - 1 Texas Instruments Incorporated Module 8 : Serial Communication Interface C28x 32-Bit-Digital Signal Controller TMS320F2812

8 - 8 - 44

Multiprocessor Wake-Up ModesMultiprocessor Wake-Up Modes

Allows numerous processors to be hooked up to Allows numerous processors to be hooked up to the bus, but transmission occurs between only the bus, but transmission occurs between only two of themtwo of them

Idle-line or Address-bit modesIdle-line or Address-bit modes Sequence of OperationSequence of Operation

1. Potential receivers set SLEEP = 1, which disables RXINT except 1. Potential receivers set SLEEP = 1, which disables RXINT except when an address frame is receivedwhen an address frame is received

2. All transmissions begin with an address frame2. All transmissions begin with an address frame

3. Incoming address frame temporarily wakes up all SCIs on bus3. Incoming address frame temporarily wakes up all SCIs on bus

4. CPUs compare incoming SCI address to their SCI address4. CPUs compare incoming SCI address to their SCI address

5. Process following data frames only if address matches5. Process following data frames only if address matches

Page 5: 8 - 1 Texas Instruments Incorporated Module 8 : Serial Communication Interface C28x 32-Bit-Digital Signal Controller TMS320F2812

8 - 8 - 55

Idle-Line Wake-Up ModeIdle-Line Wake-Up Mode

Idle time separates blocks of framesIdle time separates blocks of frames Receiver wakes up with falling edge after SCIRXD was Receiver wakes up with falling edge after SCIRXD was

high for 10 or more bit periodshigh for 10 or more bit periods Two transmit address methodsTwo transmit address methods

deliberate software delay of 10 or more bitsdeliberate software delay of 10 or more bits set TXWAKE bit to automatically leave exactly 11 set TXWAKE bit to automatically leave exactly 11

idle bitsidle bits

Last Data ST SPST DataSCIRXD/SCITXD

Block of Frames

SP SP Last DataST Addr SP

IdlePeriod10 bits

or greater

IdlePeriod10 bits

or greater

Address framefollows 10 bitor greater idle

1st data frame

SPST Addr

Idle periodsof less than

10 bits

Page 6: 8 - 1 Texas Instruments Incorporated Module 8 : Serial Communication Interface C28x 32-Bit-Digital Signal Controller TMS320F2812

8 - 8 - 66

Address-Bit Wake-Up ModeAddress-Bit Wake-Up Mode

All frames contain an extra address bitAll frames contain an extra address bit Receiver wakes up when address bit detectedReceiver wakes up when address bit detected Automatic setting of Addr/Data bit in frame by setting Automatic setting of Addr/Data bit in frame by setting

TXWAKE = 1 prior to writing address to SCITXBUFTXWAKE = 1 prior to writing address to SCITXBUF

Last Data STST DataSCIRXD/SCITXD

Block of Frames

SP SP Last DataST Addr SP

Idle Periodlength of nosignificance

First frame withinblock is Address.

ADDR/DATAbit set to 1

1st data frame

0 1 0 0 SPST Addr 1SP

no additionalidle bits neededbeyond stop bits

Page 7: 8 - 1 Texas Instruments Incorporated Module 8 : Serial Communication Interface C28x 32-Bit-Digital Signal Controller TMS320F2812

8 - 8 - 77

SCI SummarySCI Summary

Asynchronous communications formatAsynchronous communications format 65,000+ different programmable baud rates65,000+ different programmable baud rates Two wake-up multiprocessor modesTwo wake-up multiprocessor modes

Idle-line wake-up & Address-bit wake-upIdle-line wake-up & Address-bit wake-up

Programmable data word formatProgrammable data word format 1 to 8 bit data word length1 to 8 bit data word length 1 or 2 stop bits1 or 2 stop bits even/odd/no parityeven/odd/no parity

Error Detection FlagsError Detection Flags Parity error; Framing error; Overrun error; Break detectionParity error; Framing error; Overrun error; Break detection

FIFO-buffered transmit and receiveFIFO-buffered transmit and receive Individual interrupts for transmit and receiveIndividual interrupts for transmit and receive

Page 8: 8 - 1 Texas Instruments Incorporated Module 8 : Serial Communication Interface C28x 32-Bit-Digital Signal Controller TMS320F2812

8 - 8 - 88

SCI-A RegistersSCI-A RegistersAddress Register Name

0x007050 SCICCR SCI-A commun. control register0x007051 SCICTL1 SCI-A control register 10x007052 SCIHBAUD SCI-A baud register, high byte0x007053 SCILBAUD SCI-A baud register, low byte0x007054 SCICTL2 SCI-A control register 2 register0x007055 SCIRXST SCI-A receive status register0x007056 SCIRXEMU SCI-A receive emulation data buffer0x007057 SCIRXBUF SCI-A receive data buffer register0x007059 SCITXBUF SCI-A transmit data buffer register0x00705A SCIFFTX SCI-A FIFO transmit register0x00705B SCIFFRX SCI-A FIFO receive register0x00705C SCIFFCT SCI-A FIFO control register0x00705F SCIPRI SCI-A priority control register

Page 9: 8 - 1 Texas Instruments Incorporated Module 8 : Serial Communication Interface C28x 32-Bit-Digital Signal Controller TMS320F2812

8 - 8 - 99

SCI-A Communication Control RegisterSCI-A Communication Control Register

ADDR/IDLEMODE

STOPBITS

EVEN/ODDPARITY

PARITYENABLE

LOOP BACKENABLE

SCICHAR2

SCICHAR1

SCICHAR0

Communications Control Register (SCICCR) – 0x007050

0 = 1 Stop bit1 = 2 Stop bits

0 = Odd1 = Even

0 = Disabled1 = Enabled

0 = Disabled1 = Enabled

0 = Idle-line mode1 = Addr-bit mode

7 6 5 4 3 2 1 0

# of data bits = (binary + 1)e.g. 110b gives 7 data bits

[SCI-B Communications Control Register (SCICCR) – 0x007750]

Page 10: 8 - 1 Texas Instruments Incorporated Module 8 : Serial Communication Interface C28x 32-Bit-Digital Signal Controller TMS320F2812

8 - 8 - 1010

SCI-A Control Register 1SCI-A Control Register 1

TXWAKEreserved RX ERRINT ENA

SWRESET

reserved SLEEP TXENA RXENA

Control Register 1 (SCICTL1) – 0x007051

0 = Receive Error Interrupt disabled1 = Receive Error Interrupt enabled

Write 0 = Reset SCIWrite 1 = release from Reset

Transmitter wakeup method select1 = wakeup mode depends on SCICCR.30 = no wakeup mode

7 6 5 4 3 2 1 0

[SCI-B Control Register 1 (SCICTL1) – 0x007751]

0 = sleep mode disabled1 = sleep mode enabled

0 = transmitter disabled1 = transmitter enabled

0 = receiver disabled1 = receiver enabled

Page 11: 8 - 1 Texas Instruments Incorporated Module 8 : Serial Communication Interface C28x 32-Bit-Digital Signal Controller TMS320F2812

8 - 8 - 1111

SCI-A Baud RateSCI-A Baud Rate

BAUD15(MSB)

BAUD14

Baud-Select MSbyte Register (SCIHBAUD) – 0x0070527 6 5 4 3 2 1 0

BAUD13 BAUD12 BAUD11 BAUD10 BAUD9 BAUD8

BAUD6

Baud-Select LSbyte Register (SCILBAUD) – 0x0070537 6 5 4 3 2 1 0

BAUD5 BAUD4 BAUD3 BAUD2 BAUD1BAUD7 BAUD0(LSB)

SCI baud rate =

LSPCLK

(BRR + 1) x 8

LSPCLK

16

, BRR = 1 to 65535

, BRR = 0

[SCI-B Baud-Select MSbyte Register (SCIHBAUD) – 0x007752][SCI-B Baud-Select LSbyte Register (SCILBAUD) – 0x007753]

Page 12: 8 - 1 Texas Instruments Incorporated Module 8 : Serial Communication Interface C28x 32-Bit-Digital Signal Controller TMS320F2812

8 - 8 - 1212

TXRDYTX

EMPTYRX/BK

INT ENA

SCI-A Control Register 2SCI-A Control Register 2SCICTL2 @ 0x007054SCICTL2 @ 0x007054

0TX

INT ENA

17 6 5 - 2

reserved

SCI TX READY 0 = SCITXBUF is full 1 = SCITXBUF is empty

SCI TX EMPTY0 = TXBUF or shift register are loaded with data1 = Transmit buffer and shift register both empty

reserved

15 - 8

[SCI-B Control Register 2(SCICTL2) – 0x007754]

SCI TX INT ENA 0 = Disable TXRDY interrupt 1 = Enable TXRDY interrupt

SCI RX/BK INT ENA 0 = Disable RXRDY/BRKDT interrupt 1 = Enable RXRDY/BRKDT interrupt

Page 13: 8 - 1 Texas Instruments Incorporated Module 8 : Serial Communication Interface C28x 32-Bit-Digital Signal Controller TMS320F2812

8 - 8 - 1313

SCI-A Receiver Status RegisterSCI-A Receiver Status RegisterSCIRXST @ 0x007055SCIRXST @ 0x007055

[SCI-B Receiver Status Register (SCIRXST) – 0x007755]

OERX

ERRORRXRDY BRKDT FE PE RXWAKE reserved

0 = No error flags set1 = Error flag(s) set

0 = no new character in SCIRXBUF1 = new character in SCIRXBUF

1 = Break condition occurred0 = no break condition

7 6 5 4 3 2 1 0

1 = Framing Error detected

1 = Overrun Error detected

1 = Parity Error detected

1 = Receiver wakeup condition detected

Page 14: 8 - 1 Texas Instruments Incorporated Module 8 : Serial Communication Interface C28x 32-Bit-Digital Signal Controller TMS320F2812

8 - 8 - 1414

SCI-A FIFO Transmit RegisterSCI-A FIFO Transmit RegisterSCIFFTX @ 0x00705ASCIFFTX @ 0x00705A

0

TXFFIL2

SCIFFENA TXFFST0TXFFST3

TXFFIENA

1234567

89101112131415

TXFFIL0TXFFIL1TXFFIL4 TXFFIL3

TXFFST1

TXFFINTCLR

TXFFST2

TXFFINT

TXFFST4TXFIFORESET

SCIRST

TX FIFO Status (read-only)00000 TX FIFO empty00001 TX FIFO has 1 word00010 TX FIFO has 2 words00011 TX FIFO has 3 words

10000 TX FIFO has 16 words

... ... ...

TX FIFO Interrupt LevelInterrupt when TXFFST4-0and TXFFIL4-0 match

SCI FIFOEnhancements

0 = disable1 = enable

TX FIFO Reset0 = reset (pointer to 0)1 = enable operation

TX FIFOInterrupt

(on match)Enable

0 = disable1 = enable

TX FIFOInterrupt

Flag (read-only)0 = not occurred1 = occurred

TX FIFOInterruptFlag Clear0 = no effect1 = clear

SCI Reset0 = reset1 = enable operation

Page 15: 8 - 1 Texas Instruments Incorporated Module 8 : Serial Communication Interface C28x 32-Bit-Digital Signal Controller TMS320F2812

8 - 8 - 1515

SCI-A FIFO Receive RegisterSCI-A FIFO Receive RegisterSCIFFRX @ 0x00705BSCIFFRX @ 0x00705B

0

RXFFIL2

RXFF-OVF CLR

RXFFST0RXFFST3

RXFFIEN

1234567

89101112131415

RXFFIL0RXFFIL1RXFFIL4 RXFFIL3

RXFFST1

RXFFINTCLR

RXFFST2

RXFFINT

RXFFST4RXFIFORESET

RXFF-OVF

RX FIFO Status (read-only)00000 RX FIFO empty00001 RX FIFO has 1 word00010 RX FIFO has 2 words00011 RX FIFO has 3 words

10000 RX FIFO has 16 words

... ... ...

RX FIFO Interrupt LevelInterrupt when RXFFST4-0and RXFFIL4-0 match

RX FIFO Reset0 = reset (pointer to 0)1 = enable operation

RX FIFOInterrupt

(on match)Enable

0 = disable1 = enable

RX FIFOInterrupt

Flag (read-only)0 = not occurred1 = occurred

RX FIFOInterruptFlag Clear0 = no effect1 = clear

RX FIFOOverflow

Flag (read-only)0 = no overflow1 = overflow

RX FIFOOverflowFlag Clear0 = no effect1 = clear

Page 16: 8 - 1 Texas Instruments Incorporated Module 8 : Serial Communication Interface C28x 32-Bit-Digital Signal Controller TMS320F2812

8 - 8 - 1616

SCI-A FIFO Control RegisterSCI-A FIFO Control RegisterSCIFFCT @ 0x00705CSCIFFCT @ 0x00705C

0

ABDCLR

1234567

89101112131415

CDCABD

FFTXDLYTime delay between every transfer from FIFOto transmit shift register in number of SCI baud clock cycles( 0 to 255 )

CDC calibrate ‘A’0 = disabled auto-baud alignment1 = enables auto-baud alignment

Auto Bauddetection

Flag (read-only)0 = not complete1 = complete

Auto BauddetectionFlag Clear0 = no effect1 = clear

reserved

Page 17: 8 - 1 Texas Instruments Incorporated Module 8 : Serial Communication Interface C28x 32-Bit-Digital Signal Controller TMS320F2812

8 - 8 - 1717

SCI Example 1: transmit a text - stringSCI Example 1: transmit a text - string

Lab 8: Basic SCI Communication

  Send a string from DSP to a PC’s COM-port. Connect the RS232 - Connector of the Zwickau adapter board

with a standard DB9 - cable ( 1:1 ) to a serial port of the PC (COM1or COM2).

DSP shall transmit a string from the DSP to the PC periodically. No SCI interrupt services in this lab After transmission of the first character we just poll the

transmission ready flag (TXEMPTY) before loading the next character into the transmit buffer - and wait again.

The Windows-Hyper Terminal program is used as the counterpart from the PC’s-side and must be initialized properly for correct function(Baud rate, Parity, no protocol).

Page 18: 8 - 1 Texas Instruments Incorporated Module 8 : Serial Communication Interface C28x 32-Bit-Digital Signal Controller TMS320F2812