GPIO_ConfigurePin(UART) issue

Learn MoreFAQsTutorials

4 posts / 0 new
Last post
zhongc@ilink-wi...
Offline
Last seen:2 months 3 weeks ago
加入:2017-05-09 12:36
GPIO_ConfigurePin(UART) issue

嗨MT_diaglog,
In my project,we use the UART port to connect other chip.It will create a timer to TX/RX data with other chip.Since the GPIO ouput will add power consumption(divider resistance) , When it finish the timer we want to set the PID_UART1_TX to input or low. and next time when we want to use the UART ,we wang to configure the PID_UART1_TX PIN again and use the UART function.How can I do this?Thanks.

We try to do it like that,but fail.
---------------------------------------------------1.app_easy_timer()-----------------------------------------------------------------
GPIO_ConfigurePin(UART_TX_GPIO_PORT, UART_TX_GPIO_PIN, OUTPUT, PID_UART1_TX, false); //PIN change to High level
GPIO_ConfigurePin(UART_RX_GPIO_PORT, UART_RX_GPIO_PIN, INPUT, PID_UART1_RX, false);
SetBits16(CLK_PER_REG, UART1_ENABLE, 1);
uart_init(UART_BAUDRATE_115K2, UART_FRAC_BAUDRATE_115K2, UART_CHARFORMAT_8);

GPIO_SetInactive(UART_TX_GPIO_PORT, UART_TX_GPIO_PIN); // try to change the pin to low level,but The PIN still high level
GPIO_ConfigurePin(UART_TX_GPIO_PORT, UART_TX_GPIO_PIN, INPUT, PID_UART1_TX, false); try to change the pin to low level,but The PIN still high level

Device:
MT_dialog
Offline
Last seen:3 days 12 hours ago
工作人员
加入:2015 - 06 -08 11:34
Hi zhongc,

Hi zhongc,

Well, you have assigned a functionallity other than the PID_GPIO the pad is connected to the UART module of the SoC, so you wont be able to drive its state, what you can do is change the functionallity when you dont want to use the UART on that pin and reconfigure the pin as PID_GPIO. For example:

GPIO_ConfigurePin(UART2_GPIO_PORT, UART2_TX_PIN, OUTPUT, PID_GPIO, false);

And when you would like to reuse it as an UART GPIO you can reconfigure it as one.

Thanks MT_dialog

zhongc@ilink-wi...
Offline
Last seen:2 months 3 weeks ago
加入:2017-05-09 12:36
Hi MT_dialog,

Hi MT_dialog,
As your info,I had fixed this issue.Thanks.

MT_dialog
Offline
Last seen:3 days 12 hours ago
工作人员
加入:2015 - 06 -08 11:34
Hi zhongc,

Hi zhongc,

If the above answers had helped, please mark it as accepted.

Thanks MT_dialog