CC2530 serial port configuration steps

1. Parallel communication and serial communication

The data communication between the microcontroller and the peripherals can be divided into two types according to the connection structure and transmission mode: parallel communication and serial communication.

Parallel communication: Refers to the simultaneous sending or receiving of bits of data, using a separate wire for each bit of data. The transmission speed is fast and the efficiency is high, but more data lines are required and the cost is high.

Serial Communication: Refers to the sequential sending or receiving of data one bit after another. Fewer data lines are needed and the cost is low, but the transmission speed is slow and the efficiency is low.

2. Serial communication module of CC2530

CC2530 has two serial communication interfaces USART0 and USART1, which can run in asynchronous UART mode or synchronous SPI mode respectively.

The two USART interfaces have the same function, and the mapping relationship between the two USART interfaces corresponding to external I/O pins can be set through the PERCFG register:

Position 1: RX0 — P0_2 TX0 — P0_3 RX1 — P0_5 TX1 — P0_4

Position 2: RX0 — P1_4 TX0 — P1_5 RX1 — P1_7 TX1 — P1_6

The essence of programming each USART serial port communication is to set the relevant 5 registers:

<1> UxCSR: USARTx control and status register.

<2> UxUCR: UART control register for USARTx.

<3> UxGCR: USARTx general control register.

<4> UxDBUF: Receive/send data buffer register of USARTx.

<4> UxBAUD: Baud rate control register of USARTx.

3. Connect the UART port to the COM port of the computer

Know two levels first: TTL level and RS232 level

Guess you like

Origin blog.csdn.net/xiaolong1126626497/article/details/131456783