ZigBee UART Configuration

Source: Internet
Author: User
Tags 0xc0

One, Usart data transmission

1, Usart Introduction

1) in cc2530, there are two serial ports,

UART0 corresponding external device IO pin relationship is: p0_2------RX, p0_3------TX

UART1 corresponding external device IO pin relationship is: p0_5------RX, p0_4------TX

2) mode

UART mode and SPI mode

2. UART Configuration

1) clkconcmd&=~0x40; Select the system clock source for external 32MHzcrystaloscillator.

2) while (clkconsta&0x40); Wait for crystal stability

3) clkconcmd&=~0x47; Set system main Clock frequency 32MHZ

4) percfg=0x00; Position 1p0 Port

5) p0sel=0x3c; P0_2,p0_3 as serial port (IO multiplexing)

6) p2dir&=~0xc0; P0 priority as UART0, priority

7) u0csr|=0x80; UART mode

8) u0gcr|= 11; U0GCR and U0baud coordination

9) u0baud|=216; Baud rate set to 115200

utx0if = 0; UART0TX Interrupt Flag Initial position 1 (time to send and receive)

3. Other

This byte is sent to the output pin TXDX when the USART receive/Send data buffer, register UXBUF writes the data. The UXBUF register is double-buffered. When the byte transfer begins, the uxcsr.active bit becomes high and is low when the byte transfer ends. When the transfer is complete, the Uxcsr.tx_byte bit is set to 1. When the USART receive/Send data buffer registers are ready for receiving new sending data, an interrupt request is generated. This interrupt occurs immediately after the start of the transfer, so that when the byte is being sent, the new byte can be loaded into the data buffer.

Second, the UART data receive

clkconcmd&=~0x40; Set the system clock source to 32MHZ Crystal oscillator

while (clkconsta&0x40); Wait for crystal stability

clkconcmd&=~0x47; //Set system main clock frequency to 32MHZ

percfg=0x00; Position 1p0 Port

p0sel=0x0c; P0_2,p0_3 as the serial port, the second function

p2dir&=~0xc0; P0 priority as UART0, priority

u0csr|=0x80; UART mode

u0gcr|= 11; U0GCR and U0baud coordination

u0baud|=216; Baud rate set to 115200

utx0if = 0; UART0TX Interrupt Flag Clear 0

u0csr|=0x40; Allow receive

urx0ie=1; Receive interrupts

Ea=1; Total interruption of opening,

ZigBee UART Configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.