UART transmit error

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

UART transmit error

654 Views
philippadolph
Contributor II

I have a TWR-K60F120M Board and my problem is the uart interrupt routine.

In my main i created an array with 4 numbers

int a[4]={1 , 2 , 3, 4};

UART0_C2 |= UART_C2_TCIE_MASK;

i wanted to start the interrupt with the transmission complete flag

In my interrupt routine

extern int a[];

int i =0;

void UART_IRQ

{

while(i<4)

{

UART0_D=a[i];

i++

}

UART0_C2 &= ~UART_C2_TCIE_MASK;

i=0;

}

I don't receive the numbers from the uart and i don't know why .

Maybe someone know where i'm mistaken.

0 Kudos
2 Replies

434 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi

You can refer the attached test project. I test it on TWR-K60F120M board with CodeWarrior10.7.

UART Transmission Complete Interrupt TWR-K60F120M CW10.7 PE.png

Best Regards,

Robin

 

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

434 Views
mjbcswitzerland
Specialist V

Hi

References:
http://www.utasker.com/kinetis/TWR-K60F120M.html
http://www.utasker.com/docs/uTasker/uTaskerUART.PDF

I think you need to use the transmit data register empty interrupt to start transmission like this (the complete interrupt is set after the final bit of a character is sent).
Also you need to send one byte at a time and wait for the output FIFO to be free before sending the next (depends on the FIFO depth).

Attached is the uTasker UART driver as reference which allows interrupt and DMA operation on all LPUART and UARTs.
To save time just use the uTasker K60F120 Open Source project which includes all that you need, is documented and allows the K60F120 to be simulated, including UART interrupts/DMA.
Complete code is available at http://www.utasker.com/forum/index.php?topic=1721.msg7086#msg7086

Regards

Mark