LPC1833 USART2 doesn't work, why?

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

LPC1833 USART2 doesn't work, why?

Jump to solution
779 Views
pat_wit
Contributor II

Hi,

i am working on a LPC1833.

i managed to get the UART1 run and was able to send and receive my necessery Data.

Since this was just a useful possibility for the first testing, i now use the USART2.

The following things i have changed:

LPC_UART1 -> LPC_USART2

RX Pin = 14 -> RX Pin 16

TX Pin = 13 -> TX Pin 15

UART1_IRQHandler -> UART2_IRQHandler

CLK_MX_UART1 -> CLK_MX_UART2

But it was not possible for me to send a single byte via USART2.

Did i missed something in the setup. I also recognized that in USART2 the TER2 is set. 

I removed this from the init because this register (TER2 not TER1) is not described in the Reference manual.

Any advice would be great.

Best regards,

Patrick

Labels (1)
0 Kudos
1 Solution
613 Views
pat_wit
Contributor II

Hi Kerry,

i managed to get the USART2 to run. 

First i have to enable the Base Clock of USART2 (with UART1 it is not necessary):

Chip_Clock_EnableBaseClock(CLK_BASE_UART2);

 

Also it was necessary to change the lines setting the TER value in the Init file in IP_UART_Init(...):

//pUART->TER2 = UART_TER2_TXEN;
pUART->TER1 = UART_TER1_TXEN;
/* Wait for current transmit complete */
while (!(pUART->LSR & UART_LSR_THRE)) {}
/* Disable Tx */
//pUART->TER2 = 0;
pUART->TER1 = 0;

After this changes it works pretty well.

Best regards.

View solution in original post

0 Kudos
3 Replies
613 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi patrick witting,

    When you change the pin to USART2, did you select the correct mode function?

    It is better to post your according code for checking.

    Besides, please give us the full name of your chip.

Waiting for you reply!

Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
614 Views
pat_wit
Contributor II

Hi Kerry,

i managed to get the USART2 to run. 

First i have to enable the Base Clock of USART2 (with UART1 it is not necessary):

Chip_Clock_EnableBaseClock(CLK_BASE_UART2);

 

Also it was necessary to change the lines setting the TER value in the Init file in IP_UART_Init(...):

//pUART->TER2 = UART_TER2_TXEN;
pUART->TER1 = UART_TER1_TXEN;
/* Wait for current transmit complete */
while (!(pUART->LSR & UART_LSR_THRE)) {}
/* Disable Tx */
//pUART->TER2 = 0;
pUART->TER1 = 0;

After this changes it works pretty well.

Best regards.

0 Kudos
613 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Patrick Witting,

     Thanks for the information update.

     Yes, UART2 clock open is the must options.

     Actually, the best way to check is debugging and checking the according register directly, whether it is the needed result or not.

    Now, do you have any other question?

   If your question is solved, please help to close this case by marking the correct answer.


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos