TI中文支持网
TI专业的中文技术问题搜集分享网站

cc1310的uart关闭后dio2和dio3是什么状态?

cc1310的uart关闭后dio2和dio3是什么状态?高电平还是低电平,还是高阻态?

da qin zheng sheng:

可能都是高电平?一个输出,一个输入

可以在仿真环境看看gpio,ioc寄存器

user4988634:

Felix ZF 你好。我刚才测试了一下,我调用了函数UART_close(uart);之后,用示波器观察端口2和3.。发现dio2是低电平,dio3是高电平。并不是像注释说的那样,拉低去。。。。??这个是怎么回事呢?

Felix ZF:

回复 user4988634:

const PIN_Config BoardGpioInitTable[] = {

    Board_RLED   | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,         /* LED initially off             */
    Board_GLED   | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,         /* LED initially off             */
    Board_BTN1   | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS,            /* Button is active low          */
    Board_BTN2   | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS,            /* Button is active low          */
    Board_SPI_FLASH_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN,  /* External flash chip select    */
    Board_UART_RX | PIN_INPUT_EN | PIN_PULLDOWN,                                              /* UART RX via debugger back channel */
    Board_UART_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL,                        /* UART TX via debugger back channel */
    Board_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN,                                            /* SPI master out – slave in */
    Board_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN,                                            /* SPI master in – slave out */
    Board_SPI0_CLK | PIN_INPUT_EN | PIN_PULLDOWN,                                             /* SPI clock */

    PIN_TERMINATE
};

user4988634:

回复 Felix ZF:

我想关掉串口去之后,想让串口达到// GPIO, input buffer disable, GPIO output disable, low GPIO output, no pull, no IRQ, no wakeup这种状态,也就是和其他模块串口相连的时候,不会通过串口浪费电去。这个调用UART_close(uart);两个端口没有达到这种状态啊?

是不是需要调用PIN_Status PIN_remove(PIN_Handle handle, PIN_Id pinId);这条函数?

Susan Yang:

回复 user4988634:

您是想彻底关闭串口引脚?

PIN_Status PIN_remove
(
PIN_Handle 
handle,

PIN_Id 
pinId 

)

Removes pin from pin set foropen PIN handle.

If the requested pin is allocated to handle it will be removed from the pin set, else an error code will be returned.

Parameters

handle
handle retrieved through an earlier call to PIN_open().

pinId
Pin ID for pin to remove.

ReturnsError code if unsuccessful, else PIN_SUCCESS

user4988634:

回复 Susan Yang:

我现在对于串口想是想两个功能:

1,串口使用完之后,关掉。—————————————————————————这个可以用过UART_close(uart);来实现。我也实现了。

2,串口使用完之后,把串口的两个脚设置成PIN_remove这个函数关掉后的状态。—-这个我一直实现不了。

我现在有个思路:

1,把Board_initGeneral();里面的串口初始化注释掉

const PIN_Config BoardGpioInitTable[] = {CC1310_LAUNCHXL_PIN_RLED| PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW| PIN_PUSHPULL| PIN_DRVSTR_MAX,/* LED initially off*/CC1310_LAUNCHXL_PIN_GLED| PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW| PIN_PUSHPULL| PIN_DRVSTR_MAX,/* LED initially off*/CC1310_LAUNCHXL_PIN_BTN1| PIN_INPUT_EN| PIN_PULLUP| PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS,/* Button is active low*/CC1310_LAUNCHXL_PIN_BTN2| PIN_INPUT_EN| PIN_PULLUP| PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS,/* Button is active low*/CC1310_LAUNCHXL_SPI_FLASH_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL| PIN_DRVSTR_MIN,/* External flash chip select *///CC1310_LAUNCHXL_UART_RX| PIN_INPUT_EN| PIN_PULLDOWN,/* UART RX via debugger back channel *///CC1310_LAUNCHXL_UART_TX| PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL,/* UART TX via debugger back channel */CC1310_LAUNCHXL_SPI0_MOSI| PIN_INPUT_EN| PIN_PULLDOWN,/* SPI master out - slave in */CC1310_LAUNCHXL_SPI0_MISO| PIN_INPUT_EN| PIN_PULLDOWN,/* SPI master in - slave out */CC1310_LAUNCHXL_SPI0_CLK| PIN_INPUT_EN| PIN_PULLDOWN,/* SPI clock */PIN_TERMINATE
};

2,自己在写一个初始化的串口2,3脚的函数来。

/* Pin driver object and handle */
static PIN_Handle UART_PinHandle;
static PIN_StateUART_PinState;
static PIN_Config UART_pinTable[] =
{IOID_2 | PIN_INPUT_EN| PIN_PULLDOWN,IOID_3 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL,PIN_TERMINATE
};void UART_open(void)
{UART_PinHandle = PIN_open(&UART_PinState, UART_pinTable);
}void UART_add(void)
{UART_PinState = PIN_add(UART_PinHandle, UART_pinTable);
}void UART_remove(void)
{UART_PinState = PIN_remove(UART_PinHandle, IOID_2);UART_PinState = PIN_remove(UART_PinHandle, IOID_3);
}

3,程序运行之前调用UART_open();然后用UART_add();和UART_remove();来实现串口的io口的开关。

这样可以吗?

赞(0)
未经允许不得转载:TI中文支持网 » cc1310的uart关闭后dio2和dio3是什么状态?
分享到: 更多 (0)