I am using both receive and transmit interrupts, but in my code interrupt handler is only one for both receive and transmit is it right?
Iam using FRDMKE04 dev board, and SDK_2.3.1_FRDM-KE04Z
following is my sample code
#include "board.h"
#include "fsl_uart.h"
#include "pin_mux.h"
void UART0_IRQHandler(void)
{
if(receive interrupt) ///// I need to know this condition
{
uint8_t data;
/* If new data arrived. */
if ((kUART_RxDataRegFullFlag | kUART_RxOverrunFlag) & UART_GetStatusFlags(UART0))
{
data = UART_ReadByte(UART0);
// Copy the byte into the local FIFO, if it won't cause an overflow
if(UART_RxBuffer_WritePtr < EUSART_RX_BUFFER_SIZE)
{
UART_RxBuffer[UART_RxBuffer_WritePtr++] = data;
if(UART_RxBuffer_WritePtr >= EUSART_RX_BUFFER_SIZE)
{
UART_RxBuffer_WritePtr = 0;
}
UART_NumBytesInRxBuffer++; /* Update counter */
}
elseif(transimit interrupt is fired) ///// I need to know this condition
{
}
}
Hi Vikranth
You need to read UART0_S1 to see which interrupt flag is set [UART_S1_TDRE, UART_S1_RDRF, or both].
Regards
Mark
uTasker developer and supporter (+5'000 hours experience on +60 Kinetis derivatives in +80 product developments)
Kinetis: http://www.utasker.com/kinetis.html
Kinetis KE:
- http://www.utasker.com/kinetis/FRDM-KE02Z.html
- http://www.utasker.com/kinetis/FRDM-KE02Z40M.html
- http://www.utasker.com/kinetis/FRDM-KE04Z.html
- http://www.utasker.com/kinetis/FRDM-KE06Z.html
- http://www.utasker.com/kinetis/FRDM-KE15Z.html
HW Timers: http://www.utasker.com/docs/uTasker/uTaskerHWTimers.PDF
Free Open Source solution: https://github.com/uTasker/uTasker-Kinetis
Working project in 15 minutes video: https://youtu.be/K8ScSgpgQ6M
For better, faster, cheaper product developments consider the uTasker developer's version, professional Kinetis support, one-on-one training and complete fast-track project solutions to set you apart from the herd : http://www.utasker.com/support.html