LAUNCHXL-CC1312R1: How to dynamically switch UART pin functions

Part Number: LAUNCHXL-CC1312R1

Tool/software:

Hi,

I want to dynamically switch UART TX pin to simulate DMX frames. Specifically, I need the Tx Pin first as a GPIO that can pull up/down Pin level to simulate BREAK/MAB, and then as a UART TX Pin to transmit 512 slot data.

I see someone doing the same thing as me:
https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/992945/msp432e401y-change-uart-idle-state/3670821?tisearch=e2e-sitesearch&keymatch=DMX#3670821

It doesn't seem to work out well either.

Here's my function:

static void DMX_TX(uint8_t *data, uint16_t len)
{
    UART2_close(uart);
    //IO function change
    GPIO_setConfig(3, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
    //BREAK Frame
	GPIO_write(3, CONFIG_GPIO_LED_OFF);
	usleep(88);
    //MAB Frame
	GPIO_write(3, CONFIG_GPIO_LED_ON);
	usleep(8);

   //IO function chang
   /* Access UART */
   uart = UART2_open(CONFIG_UART2_0, &uartParams);

    UART2_write(uart, data, len, NULL);
}

Since I already initialized DIO3 as the UART TX pin when I powered on, I should have disabled UART first in the function, but I didn't find any disable or uninit functions.So I used the close function, but so far the TX Pin has been kept high, which doesn't seem to be working.

I would like to confirm whether such a switch is feasible, and if so, how should I do it?