programming microcontroller uart – universal asynchronous receiver transmitter 2007
DESCRIPTION
Programming Microcontroller UART – Universal Asynchronous Receiver Transmitter 2007. 64K or 96K Byte SRAM. Enet MAC. ARM966E. CORE. w/DSP. USB 2.0FS. 96 MHz. 256K or 512K Byte Burst Flash. PFQ BC. CAN 2.0B. DMA. INTR Cntl. CLK Cntl. 32K Byte Burst Flash. GPIO. - PowerPoint PPT PresentationTRANSCRIPT
4- 1
UART - Serial communic.
MS_uC / dnd / V08
Programming MicrocontrollerUART – Universal Asynchronous Receiver Transmitter
2007
32K Byte 32K Byte Burst FlashBurst Flash
64K or 96K 64K or 96K Byte SRAM Byte SRAM
256K or 512K 256K or 512K Byte Burst Byte Burst
FlashFlash
OTP OTP MemMem
UARTUARTI2CI2CSPISPITIMTIMRTCRTC
EXT. EXT. Bus Bus
GPIOGPIO
USB USB 2.0FS 2.0FS CAN CAN 2.0B 2.0B
Enet Enet MAC MAC
PFPFQ Q
BC BC DMADMA
INTINTR R
CntlCntl
ARM96ARM966E 6E CORE CORE
w/DSPw/DSP96 MHz 96 MHz
CLK CLK CntlCntl
ADCADC
LVD LVD BODBOD PLLPLL JTAJTA
GGETMETM
99
STR912FW44
4- 2
UART - Serial communic.
MS_uC / dnd / V08
Typical serial communication(low level)
Full-duplex interface
Device 1 Device 2
-PC-Embedded system
-PC-embedded system-modem-barcode reader-printer-display (with terminal emulation software)-data logger-sensor (simple or complex)-dongle (security element)-I/O module (digital, analog, encoder, PT100)-wireless interface
Transmit
ReceiveTransmit
Receive
4- 3
UART - Serial communic.
MS_uC / dnd / V08
EIA-232-C pin assignmentsD-Sub male on PC
PinDB9
PinDB25
Symbol Direction
Text
Out
In
1 8 DCD Data Carrier Detect2 3 Rx Receive Data3 2 Tx Transmit Data4 20 DTR Data Terminal Ready5 7 Gnd Signal Ground6 6 DSR Data Set Ready7 4 RTS Request to Send
8 5 CTS Clear to Send9 22 RI Ring Indicator
RS-232-C: Radio Sector, American Standard since 1969s
Male -> SteckerFemale -> Buchse
4- 4
UART - Serial communic.
MS_uC / dnd / V08
Serial data format(logical representation)
5-8 data bits
Parity bit if enabled
1-2 stop bitsmsblsb
start
1
n0
time
lsb: least significant bit (20)msb: most significant bit (2 db-1)
1 bit time = 1 / baudrate
Example: parity enabled, 2 stop bits
Normally one Byte is sent as 8 data bitsOr: One Byte is sent as 7 data bits + parity
4- 5
UART - Serial communic.
MS_uC / dnd / V08Hyperterminal usage
Start -> Zubehör -> Kommunikation -> HyperterminalGo offlineConfigure COM-Port: File->Properties
Xon/Xoff: Software handshake (Exchange on..)<ctrl-q>/<ctrl-s>
both sides must implement thissoftware handshake. The senderhas to stop almost immediatelyupon reception of Xoff characterBinary data transmission is notpossible.
Hardware: RTS/CTS hardware handshakegarantees loss-free transmissionon a byte level and allows binary data transmission
4- 6
UART - Serial communic.
MS_uC / dnd / V08
Hyperterminal communication(no handshake)
a) Reset the controller. It will send a stringb) Now type some characters. The controller will echo them (not hyperterminal!) try BS character (<ctrl-H> backspace) The terminal will interprete it properly try LF character (<ctrl-J> line feed, 0x0D). The cursor will move one line down try CR charcter (<ctrl-M> carriage return, 0x0A). The cursor jumps to column 0
View -> Serial Window -> UART #0Serial ports may be simulated using the Simulator output and the serial window:
4- 7
UART - Serial communic.
MS_uC / dnd / V08UART – What is it good for?
Simple serial communication (3-wire) Multiple physical interfaces:
EIA-232 Peer-to-peer (former RS-232-C 1969). Gnd based (-15..-3,3..15 V)
EIA-485 Party Line, multi-point link (SCSI, ISDN, ... EIA-422 : Balanced lines, no ground link (D+/D-) on
drivers up to 1'000m @ 100 kbps. Point-to-point or multi-drop. 0-5 V. Twisted-pair cable
Easy setup Direct programming Byte level only USB will not replace cheap and simple
communications
EIA: Electronic Industry Alliance
4- 8
UART - Serial communic.
MS_uC / dnd / V08Hardware flow control
RTS will be switched on and off by programmable receiv FIFO watermarks
4- 9
UART - Serial communic.
MS_uC / dnd / V08UART features (1/3)
Separate 16x8 Transmit and 16x12 Receive FIFO Programmable FIFO disabling for 1-byte depth Programmable Baud rate generator :
Baud rate = UARTCLK / (16 × BRR) Standard Asynchronous communication bits (start, stop and
parity) Independent masking of transmit FIFO, receive FIFO, receive
timout, modem status, and error condition interrupts False start bit detection Line Break Generation and Detection Support for Modem Control Functions CTS, DCD, DSR, RTS,
DTR, and RI Programmable hardware flow control
FIFO: First In First Out sequential, buffer structure
4- 10
UART - Serial communic.
MS_uC / dnd / V08UART features (2/3)
Programmable word length : 5 bits, 6 bits, 7 bits, 8 bits
Programmable Stop bits : 1 Stop bit, 2 Stop bits
Even, odd, stick, or no-parity bit generation and detection Support for Direct Memory Access (DMA) Support for an IrDA Serial Interface (SIR) protocol EnDec Parity control Loop Back Support baud rates of up to 460.8 Kbits / second subject to
UARTCLK reference clock frequency
4- 11
UART - Serial communic.
MS_uC / dnd / V08UART features (3/3)
11 Interrupt sources : Overrun error detected Break Error Parity Error Framing Error Receive Timeout Data Transmit Data Receive Modem Data Set Ready (DSRMIM) Modem Data Carrier Detect (DCD) Modem Clear to Send (CTS) Modem Ring Indicator (RI)
4- 12
UART - Serial communic.
MS_uC / dnd / V08
UART Block diagram
Ref manual figure 74
4- 13
UART - Serial communic.
MS_uC / dnd / V08UART register map
4- 14
UART - Serial communic.
MS_uC / dnd / V08Fractional Baud Rate generator
Every baud rate generator has errors. Check the tolerance!
BRCLK: baud rate clock
4- 15
UART - Serial communic.
MS_uC / dnd / V08UART configuration
[Peripherals -> UART]
4- 16
UART - Serial communic.
MS_uC / dnd / V08Pin connections of UART
STR91x ARM966 manual 12274.pdf, 4.1 pin functions page 36
P3.0 UART0_RxD Alternate Input 1P3.1 UART0_TxD Alternate Output 2
Use COM1 of MCBSTR9. Which port?
4- 17
UART - Serial communic.
MS_uC / dnd / V08