使用SDK:simplelink_cc2640r2_sdk_1_50_00_58,npi串口。但是发现一个问题。
我在mian函数配置的RX的状态是input 上拉,但是用逻辑分析仪观察,在我调用UART_open()之后发现RX(IO口悬空)的电平变成了low,请问是否UART_open()会配置RX的状态输入下拉或者高阻抗,如果我想将RX的状态修改为上拉,那么如何修改,谢谢!
const PIN_Config BoardGpioInitTable[] = {
//CC2640R2_LAUNCHXL_PIN_RLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,/* LED initially off */
//CC2640R2_LAUNCHXL_PIN_GLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,/* LED initially off */
//CC2640R2_LAUNCHXL_PIN_BTN1 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS,/* Button is active low */
//CC2640R2_LAUNCHXL_PIN_BTN2 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS,/* Button is active low */
//CC2640R2_LAUNCHXL_SPI_FLASH_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */CC2640R2_LAUNCHXL_UART_RX | PIN_INPUT_EN | PIN_PULLUP,/* UART RX via debugger back channel */CC2640R2_LAUNCHXL_UART_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL,/* UART TX via debugger back channel */
//CC2640R2_LAUNCHXL_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN,/* SPI master out - slave in */
//CC2640R2_LAUNCHXL_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN,/* SPI master in - slave out */
//CC2640R2_LAUNCHXL_SPI0_CLK | PIN_INPUT_EN | PIN_PULLDOWN,/* SPI clock */PIN_TERMINATE
};
qiyin tan:
回复 Alvin Chen:
Alvin Chen,
谢谢你的回复,那么这个函数在哪个文件下面,我未能找到。
qiyin tan:
回复 Alvin Chen:
Alvin Chen:
我只是在CC2640R2_LAUNCHXL.c文件下,看到UART的配置如下,我使用的是NPI串口的例程:
/**=============================== UART ===============================*/ #include <ti/drivers/UART.h> #include <ti/drivers/uart/UARTCC26XX.h>UARTCC26XX_Object uartCC26XXObjects[CC2640R2_LAUNCHXL_UARTCOUNT];uint8_t uartCC26XXRingBuffer[CC2640R2_LAUNCHXL_UARTCOUNT][32];const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC2640R2_LAUNCHXL_UARTCOUNT] = {{.baseAddr= UART0_BASE,.powerMngrId= PowerCC26XX_PERIPH_UART0,.intNum= INT_UART0_COMB,.intPriority= ~0,.swiPriority= 0,.txPin= CC2640R2_LAUNCHXL_UART_TX,.rxPin= CC2640R2_LAUNCHXL_UART_RX,.ctsPin= PIN_UNASSIGNED,.rtsPin= PIN_UNASSIGNED,.ringBufPtr= uartCC26XXRingBuffer[CC2640R2_LAUNCHXL_UART0],.ringBufSize= sizeof(uartCC26XXRingBuffer[CC2640R2_LAUNCHXL_UART0])} };const UART_Config UART_config[CC2640R2_LAUNCHXL_UARTCOUNT] = {{.fxnTablePtr = &UARTCC26XX_fxnTable,.object= &uartCC26XXObjects[CC2640R2_LAUNCHXL_UART0],.hwAttrs= &uartCC26XXHWAttrs[CC2640R2_LAUNCHXL_UART0]}, };const uint_least8_t UART_count = CC2640R2_LAUNCHXL_UARTCOUNT;
Alvin Chen:
回复 qiyin tan:
最后都会触发C:\TI\simplelink_cc2640r2_sdk_1_50_00_58\source\ti\drivers\uart这里程序,建议你去看一下。
qiyin tan:
回复 Alvin Chen:
Alvin Chen,
好的,非常感谢!
qiyin tan:
回复 qiyin tan:
Alvin Chen,
我尝试修改了相关的IO配置,让RX配置成上拉,然后编译stack,编译application。但是配置依旧不起作用。确认了UARTCC26XX.c文件的
路径正确后,我尝试将UARTCC26XX_initIO函数里面的内容全部注释,编译all,然后UART依旧能够通信。
所以我在猜想,其实UARTCC26XX.c文件里面的内容是不是已经封装在程式里面,因为程式只有include UARTCC26XX.h的文件,无法知道
这个.c文件究竟是如何调用的。麻烦解答下,谢谢!
qiyin tan:
回复 qiyin tan:
Alvin Chen,
查看工程里面调用的lib情况,有调用到driverlib.lib 路径:
C:\ti\simplelink_cc2640r2_sdk_1_50_00_58\source\ti\devices\cc26x0r2\driverlib\bin\iar
如果这样的话,我如何重新编译我修改过后的配置,并且生成新的lib给程式调用
Alvin Chen:
回复 qiyin tan:
这个还真没研究过,建议去e2e问一下jxs。如果方便可以贴出你的发帖链接,学习一下。
e2e.ti.com/…/
TI中文支持网


