about LPC 1125 UART1 / UART2

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

about LPC 1125 UART1 / UART2

778 Views
owenpeng
Contributor I

Hi

My   problem  about  LPC 1125 UART1 / UART2

. IDE : LPCXpresso V 8.22

.DEMO Board: OM13080

.I need 3 Uarts .

  With Example  “ periph_uart_rb”  Project  in   lpcopen_2_17_lpcxpresso_nxp_lpcxpresso_1125.zip,

TEST  UART0, It work  very well。 AS  I  initialize  UART1  & UART2  and test ,  They can not work well.

 I need your  HELP ,Thank  you  very much !!!  

Owen

///////////////////////////////////////////////////////////////////////////////////////////////////////////////

  I find the differents  among  UART0 / UART1/ UART2:

 

(1)Initialize   Pin_Mux

static void Init_UART_PinMux(void) // UART0

{

Chip_IOCON_PinMuxSet(LPC_IOCON, IOCON_PIO1_6, (IOCON_FUNC1 | IOCON_MODE_INACT | IOCON_DIGMODE_EN)); /* RXD */

Chip_IOCON_PinMuxSet(LPC_IOCON, IOCON_PIO1_7, (IOCON_FUNC1 | IOCON_MODE_INACT | IOCON_DIGMODE_EN)); /* TXD */

}

 

static void Init_UART_PinMux(void)//UART1

{

Chip_IOCON_PinMuxSet(LPC_IOCON, IOCON_PIO0_7, (IOCON_FUNC3 | IOCON_MODE_INACT | IOCON_DIGMODE_EN)); /* RXD */

Chip_IOCON_PinMuxSet(LPC_IOCON, IOCON_PIO0_6, (IOCON_FUNC3 | IOCON_MODE_INACT | IOCON_DIGMODE_EN)); /* TXD */

}

static void Init_UART_PinMux(void)//UART2

{

Chip_IOCON_PinMuxSet(LPC_IOCON, IOCON_PIO0_3, (IOCON_FUNC3 | IOCON_MODE_INACT | IOCON_DIGMODE_EN)); /* RXD */

Chip_IOCON_PinMuxSet(LPC_IOCON, IOCON_PIO1_8, (IOCON_FUNC3 | IOCON_MODE_INACT | IOCON_DIGMODE_EN)); /* TXD */

}

 

(2)UART interrupt handler

 

void UART_IRQHandler(void)// UART0

{  

 }

void UART1_IRQHandler(void)// UART1

{  

 }

void UART1_IRQHandler(void)// UART1

{  

 }

(3)Chip_UART_Init

 

 // The following FUNCTION only init UART0  ,In clock_112x.h  do not define SYSCON_CLOCK_UART1 ,SYSCON_CLOCK_UART2

  void Chip_UART_Init(LPC_UART_T *pUART) ;

  {

 

Chip_Clock_EnablePeriphClock(SYSCON_CLOCK_UART0); //  uart0

         Chip_Clock_SetUARTClockDiv(1);    //  LPC_SYSCON->UART0CLKDIV  = div;

 

      /* Enable FIFOs by default, reset them */

      Chip_UART_SetupFIFOS(pUART, (UART_FCR_FIFO_EN | UART_FCR_RX_RS | UART_FCR_TX_RS));

 

      /* Default 8N1, with DLAB disabled */

      Chip_UART_ConfigData(pUART, (UART_LCR_WLEN8 | UART_LCR_SBS_1BIT | UART_LCR_PARITY_DIS));

 

      /* Disable fractional divider */

      pUART->FDR = 0x10;

}

If  i intialize UART1     UART2       The function   void Chip_UART_Init(LPC_UART_T *pUART) ”  need modify:

 

  void Chip_UART1_Init(LPC_UART_T *pUART) ;

  {

 

Chip_Clock_EnablePeriphClock(SYSCON_CLOCK_UART1); //  uart1

 LPC_SYSCON->UART1CLKDIV  = div;  

...

}

void Chip_UART2_Init(LPC_UART_T *pUART) ;

  {

  Chip_Clock_EnablePeriphClock(SYSCON_CLOCK_UART2); //  uart2

 LPC_SYSCON->UART2CLKDIV  = div;  

...

}

Thanks a lot!

Labels (4)
Tags (2)
0 Kudos
Reply
1 Reply

542 Views
soledad
NXP Employee
NXP Employee

Hi, 

 You need to add the  SYSCON_CLOCK_UART1 and SYSCON_CLOCK_UART2 defines in   clock_112x.h  

pastedImage_3.png

and double check the UART interrupt handlers there is no uart2

I hope this helps,

Sol

0 Kudos
Reply