Tool/software:
When communicating with Tamagawa encode, I configure the RTSn as a GPIO(sw flow control). The communication test passed without breakpoints.
When the breakpoints are active when debugging, UART_RXFIFO_LVL is less than expected. This problem won't occur when the breakpoints are inactive.
void encSendDataInBytes(const uint8_t* data, uint8_t len)
{
uint8_t u8Tmp = 0;
//read the data to flush the rx fifo
while((uint16_t)HW_RD_REG32(ENC_UART_ADR + UART_RXFIFO_LVL) != 0 )
{
u8Tmp = (uint8_t)HW_RD_REG32(ENC_UART_ADR + UART_RHR);
}
HW_WR_REG32(ENC_UART_ADR + UART_FCR, HW_RD_REG32(ENC_UART_ADR + UART_FCR) | 0x6);
//send the data
GPIO_pinWriteHigh(GPIO_ENC_DE_BASE_ADDR,GPIO_ENC_DE_PIN);//set RTSn high
while(len--)
{
UART_putChar(ENC_UART_ADR, *data++);
}
while (((uint32_t) (UART_LSR_TX_SR_E_MASK | UART_LSR_TX_FIFO_E_MASK) !=
((uint32_t) (UART_LSR_TX_SR_E_MASK |UART_LSR_TX_FIFO_E_MASK) & HW_RD_REG32(ENC_UART_ADR + UART_LSR) )));
GPIO_pinWriteLow(GPIO_ENC_DE_BASE_ADDR,GPIO_ENC_DE_PIN);//set RTSn low
}
I want to enable the hardware flow control to implement this function, but there is no API in AM263x_SDK. How to enable the hardware flow control of UART ?
Is there an example I can refer to?