In the peripherals configuration for a Flexcomm USART, under "General Configuration," there are two checkboxes, "Enable RX" and "Enable TX." When you mouse over them, the pop-up description says, somewhat redundantly, "Enable Receiver" and "Enable Transmitter," respectively.
The API reference docs say the same thing. There's a definition of the type usart_config_t which includes boolean fields enableRx and enableTx and the non-helpful doxygen comments (see fsl_usart.h) say "Enable RX" and Enable TX," respectively.
So pardon me if I thought that these fields controlled whether the transmit side and the receive side of the USART could be wholly disabled or enabled. The code in fsl_usart.c disagrees!
In the USART_Init() function we see:
if (config->enableTx)
{
base->FIFOCFG |= USART_FIFOCFG_EMPTYTX_MASK | USART_FIFOCFG_ENABLETX_MASK;
base->FIFOTRIG &= ~(USART_FIFOTRIG_TXLVL_MASK);
base->FIFOTRIG |= USART_FIFOTRIG_TXLVL(config->txWatermark);
base->FIFOTRIG |= USART_FIFOTRIG_TXLVLENA_MASK;
}
if (config->enableRx)
{
base->FIFOCFG |= USART_FIFOCFG_EMPTYRX_MASK | USART_FIFOCFG_ENABLERX_MASK;
base->FIFOTRIG &= ~(USART_FIFOTRIG_RXLVL_MASK);
base->FIFOTRIG |= USART_FIFOTRIG_RXLVL(config->rxWatermark);
base->FIFOTRIG |= USART_FIFOTRIG_RXLVLENA_MASK;
}
So the two controls determine whether the FIFOs are enabled, not whether the entire transmit or receive functions are enabled.
Can someone in the documentation group fix this? It needs to be fixed in the source code as well as the MCUXpresso configuration tool.