How to create an uart isr for K70

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

How to create an uart isr for K70

863 Views
pramodk_g_
Contributor III

Hi everyone,

                              I am using K70 twr module and mqx 4.0.  I need a isr for recieving data from isr. Already i have created one isr and i can recieve data. But the problem is when am trying to send data (using write fuction ) through that port execution goes to isr and then hangs there. Actualy i don't want to generate interrupt for transmisson. How it is possible in MQX , please let me know your valuable feedback on this.

This is my code:

void uart3_rx_tx_isr(pointer user_isr_ptr)

{

    char rcvByte;

    /* Get the device registers */

    sci_ptr = _bsp_get_serial_base_address(3);      //DES get base address for UART5

    rcvByte = sci_ptr->S1; //DES read status register.  Part of two step process to clear the interrupt flag.

    rcvByte = sci_ptr->D;              

}

void uart_init(void)

{

    char flags=IO_SERIAL_NON_BLOCKING;

    rs232_dev = fopen(RS232CHANNEL, NULL);   

    ioctl(rs232_dev, IO_IOCTL_SERIAL_SET_FLAGS, &flags);

   

    if( rs232_dev == NULL )

    {

        /* device could not be opened */

        printf("\n Bluetooth Init Failed..!");

        return;

    }     

   _nvic_int_init(INT_UART0_RX_TX, 2, TRUE );

   _int_install_isr(INT_UART0_RX_TX, uart3_rx_tx_isr, rs232_dev);

    _nvic_int_enable(INT_UART0_RX_TX);

   _bsp_serial_io_init(0, IO_PERIPHERAL_PIN_MUX_ENABLE);

}

Thanks

Pramod.

0 Kudos
1 Reply

389 Views
soledad
NXP Employee
NXP Employee

Hi,

In MQX the interrupt handling is done by the driver. You will find the appnote AN4022 very educative in this topic. The source code is also available:

http://cache.freescale.com/files/32bit/doc/app_note/AN4022.pdf

http://cache.freescale.com/files/32bit/doc/app_note/AN4022SW.zip

We have to remember that this is an RTOS. The driver is doing the handling of the reception of the data. You have to read from the driver’s buffer the data that is being read. The polling is happening in the application’s level, the interruption is in the driver’s level. So, you have to follow the protocol you want to implement. In the case of the serial camera it waited for commands and then it sent data back.

Have a great day,
Sol

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

0 Kudos