AnsweredAssumed Answered

MCUXpresso SDK 2.7.1, Flexcomm USART configuration doc error

Question asked by Andy Peters on Apr 6, 2020
Latest reply on Apr 21, 2020 by ZhangJennie

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)
    {
        /* empty and enable txFIFO */
        base->FIFOCFG |= USART_FIFOCFG_EMPTYTX_MASK | USART_FIFOCFG_ENABLETX_MASK;
        /* setup trigger level */
        base->FIFOTRIG &= ~(USART_FIFOTRIG_TXLVL_MASK);
        base->FIFOTRIG |= USART_FIFOTRIG_TXLVL(config->txWatermark);
        /* enable trigger interrupt */
        base->FIFOTRIG |= USART_FIFOTRIG_TXLVLENA_MASK;
    }

    /* empty and enable rxFIFO */
    if (config->enableRx)
    {
        base->FIFOCFG |= USART_FIFOCFG_EMPTYRX_MASK | USART_FIFOCFG_ENABLERX_MASK;
        /* setup trigger level */
        base->FIFOTRIG &= ~(USART_FIFOTRIG_RXLVL_MASK);
        base->FIFOTRIG |= USART_FIFOTRIG_RXLVL(config->rxWatermark);
        /* enable trigger interrupt */
        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.

Outcomes