Will the config tools and LPUART_Init function support inverting the UART polarity?

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

Will the config tools and LPUART_Init function support inverting the UART polarity?

Jump to solution
458 Views
rj_engineer
Contributor III

Hi,

The CTRL register of the MCXA UART contains the TXINV (28) bit which control the polarity of the UART.

txinv_capture.png

However, the config tools doesn't expose this functionnality and the "LPUART_Init" function automatically unset this bit. The only solution found was to disable the RX and TX output (after the "LPUART_Init") to set the TXINV.

LPUART1_PERIPHERAL->CTRL &= ~LPUART_CTRL_TE_MASK;
LPUART1_PERIPHERAL->CTRL &= ~LPUART_CTRL_RE_MASK;
LPUART1_PERIPHERAL->CTRL |= LPUART_CTRL_TXINV_MASK;
LPUART1_PERIPHERAL->CTRL |= LPUART_CTRL_TE_MASK;
LPUART1_PERIPHERAL->CTRL |= LPUART_CTRL_RE_MASK;

 

This solution cause unnecessary rising edge on the UART lines.

Writing a custom UART init function is overkill and error prone.

 

The question is :

Is there any other "proper" way to invert the UART polarity and are the config tools scheduled to support this functionnality.

 

Sincerely,

Labels (1)
0 Kudos
Reply
1 Solution
398 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hi @rj_engineer 

I'm sorry for replying to you late.

1. I have checked the config tool, and it indeed doesn't support this feature. I will submit a feature request to the config tool development team. Thank you
 
2. We can add this configuration through code, such as
 

LPUART_CTRL_TXINV(1); // Enable Transmit Data Inversion

 

Please contact me if still have any question. 

 

BR

Alice

View solution in original post

0 Kudos
Reply
2 Replies
399 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hi @rj_engineer 

I'm sorry for replying to you late.

1. I have checked the config tool, and it indeed doesn't support this feature. I will submit a feature request to the config tool development team. Thank you
 
2. We can add this configuration through code, such as
 

LPUART_CTRL_TXINV(1); // Enable Transmit Data Inversion

 

Please contact me if still have any question. 

 

BR

Alice

0 Kudos
Reply
306 Views
rj_engineer
Contributor III
Thank you for the answer
0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2143566%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EWill%20the%20config%20tools%20and%20LPUART_Init%20function%20support%20inverting%20the%20UART%20polarity%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2143566%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3EThe%20CTRL%20register%20of%20the%20MCXA%20UART%20contains%20the%20TXINV%20(28)%20bit%20which%20control%20the%20polarity%20of%20the%20UART.%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22txinv_capture.png%22%20style%3D%22width%3A%20684px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22txinv_capture.png%22%20style%3D%22width%3A%20684px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F350262i3B2C68B186D14600%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22txinv_capture.png%22%20alt%3D%22txinv_capture.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EHowever%2C%20the%20config%20tools%20doesn't%20expose%20this%20functionnality%20and%20the%20%22LPUART_Init%22%20function%20automatically%20unset%20this%20bit.%20The%20only%20solution%20found%20was%20to%20disable%20the%20RX%20and%20TX%20output%20(after%20the%20%22LPUART_Init%22)%20to%20set%20the%20TXINV.%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-c%22%3E%3CCODE%3ELPUART1_PERIPHERAL-%26gt%3BCTRL%20%26amp%3B%3D%20~LPUART_CTRL_TE_MASK%3B%0ALPUART1_PERIPHERAL-%26gt%3BCTRL%20%26amp%3B%3D%20~LPUART_CTRL_RE_MASK%3B%0ALPUART1_PERIPHERAL-%26gt%3BCTRL%20%7C%3D%20LPUART_CTRL_TXINV_MASK%3B%0ALPUART1_PERIPHERAL-%26gt%3BCTRL%20%7C%3D%20LPUART_CTRL_TE_MASK%3B%0ALPUART1_PERIPHERAL-%26gt%3BCTRL%20%7C%3D%20LPUART_CTRL_RE_MASK%3B%3C%2FCODE%3E%3C%2FPRE%3E%3CBR%20%2F%3E%3CP%3EThis%20solution%20cause%20unnecessary%20rising%20edge%20on%20the%20UART%20lines.%3C%2FP%3E%3CP%3EWriting%20a%20custom%20UART%20init%20function%20is%20overkill%20and%20error%20prone.%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EThe%20question%20is%20%3A%3C%2FP%3E%3CP%3EIs%20there%20any%20other%20%22proper%22%20way%20to%20invert%20the%20UART%20polarity%20and%20are%20the%20config%20tools%20scheduled%20to%20support%20this%20functionnality.%3C%2FP%3E%3CBR%20%2F%3E%3CP%3ESincerely%2C%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2143566%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3EMCXA%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2162951%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Will%20the%20config%20tools%20and%20LPUART_Init%20function%20support%20inverting%20the%20UART%20polarity%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2162951%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EThank%20you%20for%20the%20answer%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2152228%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Will%20the%20config%20tools%20and%20LPUART_Init%20function%20support%20inverting%20the%20UART%20polarity%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2152228%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F251635%22%20target%3D%22_blank%22%3E%40rj_engineer%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EI'm%20sorry%20for%20replying%20to%20you%20late.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CDIV%20class%3D%22auto-hide-last-sibling-br%20paragraph-JOTKXA%20paragraph-element%20br-paragraph-space%22%3E1.%20I%20have%20checked%20the%20config%20tool%2C%20and%20it%20indeed%20doesn't%20support%20this%20feature.%20I%20will%20submit%20a%20feature%20request%20to%20the%20config%20tool%20development%20team.%20Thank%20you%3C%2FDIV%3E%0A%3CDIV%20class%3D%22auto-hide-last-sibling-br%20paragraph-JOTKXA%20paragraph-element%20br-paragraph-space%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%20class%3D%22auto-hide-last-sibling-br%20paragraph-JOTKXA%20paragraph-element%20br-paragraph-space%22%3E2.%20We%20can%20add%20this%20configuration%20through%20code%2C%20such%20as%3C%2FDIV%3E%0A%3CDIV%20class%3D%22auto-hide-last-sibling-br%20paragraph-JOTKXA%20paragraph-element%20br-paragraph-space%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CP%3E%3CEM%3E%20LPUART_CTRL_TXINV(1)%3B%20%2F%2F%20Enable%26nbsp%3BTransmit%20Data%20Inversion%3C%2FEM%3E%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3EPlease%20contact%20me%20if%20still%20have%20any%20question.%26nbsp%3B%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3EBR%3C%2FP%3E%0A%3CP%3EAlice%3C%2FP%3E%3C%2FLINGO-BODY%3E