2 Replies Latest reply on Jun 8, 2020 11:57 AM by KeCo_3781066

    Reconfigure UART pins as GPIO and back to UART pins?

    KeCo_3781066

      I'm having trouble dynamically reconfiguring UART pins to GPIO and back.  Currently, I'm using a UART peripheral with TX 9[1] and RX 9[0] on the CYBLE-416045-02 and have tried the following:

       

      Set to GPIO, and set TX pin to low

      uint32 reg;

      reg = CY_GET_REG32(CYREG_HSIOM_PRT9_PORT_SEL0);

      CY_SET_REG32(CYREG_HSIOM_PRT9_PORT_SEL0 ,CY_GET_REG32(CYREG_HSIOM_PRT9_PORT_SEL0) & 0xFFFFFF0F);

      Cy_GPIO_SetDrivemode(TX_PIN_0_PORT, TX_PIN_0_NUM, CY_GPIO_DM_STRONG);

      Cy_GPIO_Write(TX_PIN_0_PORT, TX_PIN_0_NUM, 0);

       

      Then later set back to UART pins

      CY_SET_REG32(CYREG_HSIOM_PRT9_PORT_SEL0, reg);