I am using FRDM-KE04Z dev board with onboard MKE04Z8VFK4 MCU, I am trying to communicate serial UART0 using RS485 communication, While debugging mode it will work fine. Plz, help me on how to solve this.
I am using UART0 PTB1(TX), PTB0(RX); SDK_2.3.1_FRDM-KE04Z
following is my code
int main(void)
{
uart_config_t config;
uint8_t u8Ch = 0;
/* Define the init structure for the output LED pin*/
gpio_pin_config_t led_config = {
kGPIO_DigitalOutput, 0,
};
/* Init output LED GPIO. */
GPIO_PinInit(kGPIO_PORTA, 2U, &led_config); // configured GPIO PTA2 pin for rs485 communication
BOARD_InitPins();
BOARD_BootClockRUN();
UART_GetDefaultConfig(&config);
config.baudRate_Bps = BOARD_DEBUG_UART_BAUDRATE;
config.enableTx = true;
config.enableRx = true;
UART_Init(DEMO_UART, &config, DEMO_UART_CLK_FREQ);
/* echo chars received from terminal */
while(1)
{
int i =0;
GPIO_PinWrite(kGPIO_PORTA, 2U, 0u); // writing LOW for enable receiver mode
u8Ch = UART_GetChar(UART0);
GPIO_PinWrite(kGPIO_PORTA, 2U, 1u); // writing High for transmit mode
UART_PutChar(UART0, u8Ch);
}
}