CC254x 如何设置才能使得P1.6/P1.7被用作UART1?
TI朋友,
因P0口被用作按键输入了,不能再被用作UART0,但又得使用一个UART功能,请问如何设置才能使得P1.6/P1.7被用作UART1?
即UART1-Alt2功能的设置如何实现?
参考https://e2e.ti.com/support/wireless_connectivity/bluetooth_low_energy/f/538/t/268017
Morning WBJ,
谢谢你的回复。
在给你们发贴后的第二天,我在努力奋斗,也搜到了你上面的老外提问链接。
经过一番实验,UART1-ALT2看来是搞定了。但昨天忙于别的事,没来论坛报道。感谢TI的回复,今把我的心得贴出来共享观众--万一碰到我这样的需求的话就可以少走很多弯路了。下面是我28号测试成功后的记录。
5, Add macro definitions in IAR "C\C++ Compiler\Preprocessor" as below :
INT_HEAP_LEN=3072
HALNODEBUG
OSAL_CBTIMER_NUM_TASKS=1
HAL_AES_DMA=TRUE // this is added automatically by IAR during build
HAL_DMA=TRUE // this is added automatically by IAR during build
POWER_SAVING
xPLUS_BROADCASTER
xHAL_LCD=TRUE
HAL_LED=TRUE
HAL_KEY=TRUE
HAL_UART=TRUE
HAL_UART_ISR=TRUE
HAL_UART_DMA=2
6, Change "#define SBP_UART_PORT HAL_UART_PORT_0" to "#define SBP_UART_PORT HAL_UART_PORT_1" in "SerialApp.h"
7, Use UART1 with ALT2 mode(P1.7 - RX, P1.6 - TX, P1.5 - RT, P1.4 - CT), and remove hardware of UART0 with ALT1 mode(P0.2 - RX, P0.3 - TX, P0.5 - RT, P0.4 - CT), in fact, RT and CT pins are not used yet.
8, Add "HalUARTWrite (SBP_UART_PORT, pktBuffer, numBytes);" in function "sbpSerialAppCallback()" in "SerialApp.c" to let CC2540 TX prints out chars which received from RX(connents to PC RS232-TX). to PC RS232-RX, it looks well now
Edited and tested by norman on 2015-12-28 PM
关于上面第8条的说明:
"HalUARTWrite (SBP_UART_PORT, pktBuffer, numBytes);"即将接收到的字符原原本本地返回给发送端。我用的是CC2540跟PC超级终端之间的通讯(当然在它们之间加了个自己的UART-RS232转换板),目的是通过PC超级终端输入的字符被CC2540收到后立即返回并显示在PC超级终端。