UART TX to GPIO programmatically?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
wablc_2332316
Level 3
Level 3
First like received First like given

Using Psoc Creator 4.1 and CY84247 module on the CYKit-042. I am using P3.5 as uart tx via SCB1. Everything works fine w the UART, but I need to pull down the TX line for ~1sec to reset comms then turn back to UART TX. How do I reconfigure the P3.5 TX line as a GPIO line and then back to a TX line programmatically at runtime?

Thanks

Wayne

0 Likes
1 Solution
wablc_2332316
Level 3
Level 3
First like received First like given

Thanks to e.pratt pointing me in the right direction I found reconfigure thread that has the same requirement as myself. I'm able to successfully;

-Set P3.5 (TX) to GPIO =

//reset required bits to make GPIO, note this changes RX pin to GPIO as well

CY_SET_REG32(CYREG_HSIOM_PORT_SEL3,CY_GET_REG32(CYREG_HSIOM_PORT_SEL3) & 0xFF00FFFF);

//next set desired mode

UART_tx_SetDriveMode(UART_tx_DM_STRONG);

-Drive P3.5 low =

//set drive level as desired

UART_tx_Write(0);

-Set P3.5 to UART TX =

//set required bits to revert GPIO back to UART

//prior to GPIO change CYREG_HSIOM_PORT_SEL3 was 0x00990000 per cyfitter.h

CY_SET_REG32(CYREG_HSIOM_PORT_SEL3,CY_GET_REG32(CYREG_HSIOM_PORT_SEL3) | 0x00990000);

View solution in original post

3 Replies