Zigbee CC2530 UART0使用备用端口P1.4、P1.5通信

捏麻麻滴,TI连个代码的文档都不给,最后还是在论坛里找到的

定义HAL_UART=TRUE,修改 _hal_uart_dma.c文件里的相关参数将HAL_UART_DMA == 1里的地方都对应到UART0 PROT2如下
_hal_uart_dma.c:

#if (HAL_UART_DMA == 1)
/*
#define PxOUT P0
#define PxIN P0
#define PxDIR P0DIR
#define PxSEL P0SEL
#define UxCSR U0CSR
#define UxUCR U0UCR
#define UxDBUF U0DBUF
#define UxBAUD U0BAUD
#define UxGCR U0GCR
#define URXxIE URX0IE
#define URXxIF URX0IF
#define UTXxIE UTX0IE
#define UTXxIF UTX0IF
*/#define PxOUT P1
#define PxIN P1
#define PxDIR P1DIR
#define PxSEL P1SEL
#define UxCSR U0CSR
#define UxUCR U0UCR
#define UxDBUF U0DBUF
#define UxBAUD U0BAUD
#define UxGCR U0GCR
#define URXxIE URX0IE
#define URXxIF URX0IF
#define UTXxIE UTX0IE
#define UTXxIF UTX0IF
#if (HAL_UART_DMA == 1)
/*
#define HAL_UART_PERCFG_BIT 0x01 // USART0 on P0, Alt-1; so clear this bit.
#define HAL_UART_Px_RX_TX 0x0C // Peripheral I/O Select for Rx/Tx.
#define HAL_UART_Px_RTS 0x20 // Peripheral I/O Select for RTS.
#define HAL_UART_Px_CTS 0x10 // Peripheral I/O Select for CTS.
*/#define HAL_UART_PERCFG_BIT 0x01 // USART0 on P0, Alt-1; so clear this bit.
#define HAL_UART_Px_RX_TX 0x30 // Peripheral I/O Select for Rx/Tx.
#define HAL_UART_Px_RTS 0x08 // Peripheral I/O Select for RTS.
#define HAL_UART_Px_CTS 0x04 // Peripheral I/O Select for CTS.
*****************************************************************************/static void HalUARTInitDMA(void)
{
halDMADesc_t *ch;
P2DIR &= ~P2DIR_PRIPO;
P2DIR |= HAL_UART_PRIPO;
#if (HAL_UART_DMA == 1)
//PERCFG &= ~HAL_UART_PERCFG_BIT; // Set UART0 I/O to Alt. 1 location on P0.
PERCFG |= HAL_UART_PERCFG_BIT; // Set UART1 I/O to Alt. 2 location on P1.

以上是所有修改,程序里直接

halUARTCfg_t uartConfig;
uartConfig.configured = TRUE;
uartConfig.baudRate = HAL_UART_BR_115200;
uartConfig.flowControl = FALSE;
uartConfig.flowControlThreshold = MT_UART_THRESHOLD;
uartConfig.rx.maxBufSize = MT_UART_RX_BUFF_MAX ;
uartConfig.tx.maxBufSize = MT_UART_TX_BUFF_MAX ;
uartConfig.idleTimeout = MT_UART_IDLE_TIMEOUT;
uartConfig.intEnable = TRUE;
uartConfig.callBackFunc = smd_UartProcessData;
HalUARTOpen (HAL_UART_PORT_0, &uartConfig);

futa: