ST AN969 Application note

AN969
APPLICATION NOTE
SCI COMMUNICATION BETWEEN ST7 AND PC
by Microcontroller Division Applications
INTRODUCTION
This document presents a standard communications interface between a ST7 microcontroller and a PC. This communication is done through the ST7 SCI peripheral and a serial port of the PC using the RS232 protocol.
AN969/0102 1/10
1
SCI COMMUNICATION BETWEEN ST7 AND PC
1 SCI COMM UNICATION
The main features of the SCI communication peripheral are summarized below. Refer to your ST7 datasheet for more details.
1.1 MAIN FEATURES
The Serial Communication Interface (SCI) offers a flex ible means of full-dupl ex data exchange with external equipment requiring an industry standard NRZ asynchronous serial data format.
The SCI allows a very wide range of baud rates with different baud rates for transmission and reception.
For SCI communication, only two signals are needed, one for transmission and the other for reception. No cloc k signal is needed as it works in async hronous mode. Each dev ice has a Transmit Data Output pin (TDO pin) and a Receive Data Input pin (RDI pin). See Figure 1.
Figure 1. ST7 and SCI interface set-up
DEVICE
ST7
SCI Interface
The user must be very careful in identifying the use of each pin. This can easily be done putting the device in tr ansmission and checki ng with an osci lloscope if a transmission frame is present or not.
1.2 BAUD RATES
Transmission and r eception can be driven by their own baud rate generator. However be aware that to communicate correctly, the receiver must have a reception baud rate strictly equal to the transmission baud rate of the transmitter. If not, the communication will be cor-
rupted. A s long as this condition is met, a wide range of baud rates is possible.
TDO
RDI
RDI TDO
2/10
2
SCI COMMUNICATION BETWEEN ST7 AND PC
1.3 FRAMES
Any transmission is Least Significant Bit first. A data word can be 8 or 9 bits long. A data frame begins with a «star t bit», which i s a ’0’ bit and ends wit h a «stop bit», wh ich is a ’1’ bit. See Figure 2.
Two special frames are also managed : An Idle character is interpreted as an entire frame of ’1’ bits followed by the start bit of the next
frame which contains data. A Break character is detected when receiving ’0’ bits for some multiple of the frame period. At
the end of the last break, the transmitter inserts an extra ’1’ bit to acknowledge the next start bit.
Figure 2. Frames and word length
9-bit Word length (M bit of SCICR1 is set)
Next Data Frame
Start
Bit
Bit0
Data Frame
Bit2
Bit1
Bit3
Bit4
Bit5 Bit6
Bit7
Bit8
Stop
Bit
Next Start
Bit
Idle Frame
Break Fr ame
8-bit Word length (M bit of SCICR1 is reset)
Data Frame
Start
Bit
Bit0 Bit1
Bit2
Bit3 Bit4
Bit5 Bit6
Idle Frame
Break Frame
Bit7
Stop
Bit
Start
Bit
Start
Extra
’1’
Bit
Next Data Frame
Next Start
Bit
Start
Bit
Start
Extra
Bit
’1’
3/10
Loading...
+ 7 hidden pages