Hi, Roymessinger,
Frankly speaking, I do not know the background of your issue. From software, it seems that your code has issue:
void send_message_in_uart(unsigned char *query, unsigned char string_length)
{
while ((kUART_TxDataRegEmptyFlag & UART_GetStatusFlags(UART_CH_ACTIVE)))
UART_WriteBlocking(UART_CH_ACTIVE, query, string_length);
while (!(UART1->S1 & UART_S1_TC_MASK))
__asm("NOP");
}
uint32_t UART_GetStatusFlags(UART_Type *base)
{
uint32_t status_flag;
status_flag = base->S1 | ((uint32_t)(base->S2) << 8);
#if defined(FSL_FEATURE_UART_HAS_EXTENDED_DATA_REGISTER_FLAGS) && FSL_FEATURE_UART_HAS_EXTENDED_DATA_REGISTER_FLAGS
status_flag |= ((uint32_t)(base->ED) << 16);
#endif
#if defined(FSL_FEATURE_UART_HAS_FIFO) && FSL_FEATURE_UART_HAS_FIFO
status_flag |= ((uint32_t)(base->SFIFO) << 24);
#endif
return status_flag;
}
void UART_WriteBlocking(UART_Type *base, const uint8_t *data, size_t length)
{
/* This API can only ensure that the data is written into the data buffer but can't
ensure all data in the data buffer are sent into the transmit shift buffer. */
while (length--)
{
while (!(base->S1 & UART_S1_TDRE_MASK))
{
}
base->D = *(data++);
}
}
The UART_WriteBlocking() function polls the uart flag to transmit data, it is unnecessary to add the while ((kUART_TxDataRegEmptyFlag & UART_GetStatusFlags(UART_CH_ACTIVE))) line, how about delet it.
BTW, can you use different GPIO to the DE and /RE pin?
Hope it can help you
BR
Xiangjun Rong