Currently my requirement is to use UART 2 in K21 as interrupt driven. For this can anyone help me with example code which receives daata from UART byte by byte.
Thanks & Regards,
The Freescale_MQX_4_1\mqx\examples\rs485 demo default use UART interrupt routine;
Which define UART3, you can change follow your HW, the ittyx indicate UART driver use interrupt mode, ttyx indicate UART driver use polling mode.
/* set RS485 output device */
#define RS485_CHANNEL "ittyd:"
If I want to do something in the interrupt function,how should I modify the source code?
Do I have to modify the interrupt function in the BSP?
In the example code given in rs485, it is waiting @ fread(data_buffer, 1,
18, rs485_dev); and can't we skip this?? and i would rather like to capture
the data as an interrupt, without any function call. Is there any function
of such a kind?? I have noticed on calling fread it is waiting and on
reception of data from UART it is hitting ioserial_int_read () in
serl_int.c file where i can capture actual data and if we donot call fread
it is not hitting this function. Can you please help me resolving this.
On Tue, Aug 5, 2014 at 7:49 PM, Dawei You <firstname.lastname@example.org>
Actually, if I don’t want to change original BSP code, I think we could use new isr to replace old isr, and implement your ISR code here, just like mqx\examples\isr demonstrated:
isr_ptr->TICK_COUNT = 0;
intget_isr_data(BSP_TIMER_INTERRUPT_VECTOR);//get back old isr data and save
intget_isr(BSP_TIMER_INTERRUPT_VECTOR);//get back old isr and save
isr_ptr = (MY_ISR_STRUCT_PTR)user_isr_ptr;
isr_ptr->TICK_COUNT++;//do your code
/* Chain to the previous notifier */
(*isr_ptr->OLD_ISR)(isr_ptr->OLD_ISR_DATA);// call old isr routinue;
Retrieving data ...