MCUXpresso SDK 2.7.1, Flexcomm USART configuration doc error

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MCUXpresso SDK 2.7.1, Flexcomm USART configuration doc error

Jump to solution
1,937 Views
devel
Contributor III

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.

Labels (1)
Tags (1)
0 Kudos
Reply
1 Solution
1,828 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Andy.

I got feedback from SDK team. This issue will be fixed in next released.

Thanks!
Jun Zhang

View solution in original post

4 Replies
1,828 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Andy,

To check this issue, we need to know:

- your chip part number

- MCUXpresso IDE version

- ""Enable RX" and "Enable TX." When you mouse over them, the pop-up description says, somewhat redundantly,", I tried with my LPC546xx sdk2.7.1 project,  I didn't see this problem, could you please send me a video about this?

- please send me your demo project, and mention how I can reproduce your issue with your project?

Thanks,

Jun Zhang

0 Kudos
Reply
1,828 Views
devel
Contributor III
  1. The device is the LPC55S28, specifically the LPC55S28JBD100 that's on the eval board. This applies to all of the LPC55S2x variants. I have not checked to see if it applies to the LPC55S6x devices.
  2. I'm using MCUXpresso IDE v11.1.1 [Build 3241] [2020-03-02], which I believe is the latest.

  3. Video is attached.
  4. You don't need the project. You can see this clearly with any project that uses a USART. In the first post I attached the relevant code from your driver (in the source file fsl_usart.c), where the usart_config_t members enableTx and enableRx enable their respective FIFOs. I verified that clicking the enableTx and enableRx boxes in the peripheral configuration tool (as seen in the video) sets those members to true or false in the generated file peripherals.c:
const usart_config_t MIDIUART_config = {
  .baudRate_Bps = 31250,
  .syncMode = kUSART_SyncModeDisabled,
  .parityMode = kUSART_ParityDisabled,
  .stopBitCount = kUSART_OneStopBit,
  .bitCountPerChar = kUSART_8BitsPerChar,
  .loopback = false,
  .txWatermark = kUSART_TxFifo0,
  .rxWatermark = kUSART_RxFifo1,
  .enableRx = true,         // set to true if checkbox checked
  .enableTx = false,        // set to false if checkbox cleared
  .clockPolarity = kUSART_RxSampleOnFallingEdge,
  .enableContinuousSCLK = false
};‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

So the point of all of this is that the documentation is not correct. The documentation, the name of the member variables and the config tool itself imply that checking the box in the configurator (or setting the const initializers in the code) enables or disables the receiver or transmitter function, which is wrong. This controls whether the FIFO in the function is enabled or not.

0 Kudos
Reply
1,828 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Andy Peters

Thanks for reporting it.

I got your point. I will escalate it to SDK development to request fix.

Thanks for bringing the problem to our attention.

BR,

Jun Zhang

1,829 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Andy.

I got feedback from SDK team. This issue will be fixed in next released.

Thanks!
Jun Zhang