AnsweredAssumed Answered

UART Driver with Interrupt

Question asked by Aseem C on Sep 17, 2013
Latest reply on Sep 26, 2013 by Robin_Shen

Hi All,

 

I've written a UART driver for Kinetis K70 with the Interrupt functionality. So far I'm able to Transmitte the data in polling mode and Recieve data interrupt mode.

Currently the problem I'm facing is that on every transmission and recieption of first byte is Garbage data.

My current settings are,

 

SIM->SCGC4 |= SIM_SCGC4_UART2_MASK;

SIM->SCGC5 |= SIM_SCGC5_PORTD_MASK;

PORTD->PCR[17] = (3UL <<  8);

PORTD->PCR[16] = (3UL <<  8);

UART2->S1 = 0x00;

setBaudrate(9600);
UART2->C2 = (UART_C2_RE_MASK | UART_C2_TE_MASK);

UART2->S2 = 0x00;
UART2->C3 = 0x00;

UART2->RWFIFO = UART_RWFIFO_RXWATER(1);
UART2->TWFIFO = UART_TWFIFO_TXWATER(0);
UART2->C2 |= UART_C2_RIE_MASK;
/* Enable UART0 Rx Tx  Interrupt in NVIC*/
Enable_IRQ(IRQ_UART2_RX_TX);

/* Enable UART0 Error  in NVIC*/
SET_PRIORITY(IRQ_UART2_RX_TX, 240);

Please correct me if I'm going somewhere wrong,

 

If possible please provide the driver code.

 

Thanks

A

Outcomes