UART interrupt not working

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

UART interrupt not working

Jump to solution
1,078 Views
mpc8377e
Contributor I

Hi,

 

I am trying to use interrupt on UART3. I have configured user_config.h as below :

#define BSPCFG_ENABLE_TTYD 0

#define BSPCFG_ENABLE_ITTYD 1

#define BSP_DEFAULT_IO_CHANNEL "ittyd:"

#define BSP_DEFAULT_IO_CHANNEL_DEFINED

and also update twrk40x256.h with following:

#ifndef BSP_DEFAULT_IO_CHANNEL
#if BSPCFG_ENABLE_TTYD
#define BSP_DEFAULT_IO_CHANNEL "ittyd:"
#define BSP_DEFAULT_IO_CHANNEL_DEFINED

The problem i am facing is that the when some data is sent from host on UART the interrupt is not triggered.

Part of application which installs ISR and some code in ISR:

#define RS485_CHANNEL "ittyd:"

func()
{

rs485_dev = fopen( RS485_CHANNEL, (char const *)IO_SERIAL_HW_485_FLOW_CONTROL );
#else
/* HW 485 flow not available on chip */
rs485_dev = fopen( RS485_CHANNEL, NULL );
#endif
if( rs485_dev == NULL )
{
/* device could not be opened */
_task_block();
}
if( result == IO_ERROR_INVALID_IOCTL_CMD )
{
_task_block();
}
_int_install_isr(INT_UART3_RX_TX, uart3_rx_tx_isr, NULL);
err = _io_ioctl(rs485_dev, IO_IOCTL_SERIAL_SET_BAUD, &ulBaudRate);
err = _io_ioctl(rs485_dev, IO_IOCTL_SERIAL_SET_DATA_BITS, &ucDataBits);
err = _io_ioctl(rs485_dev, IO_IOCTL_SERIAL_SET_STOP_BITS, &ucStopBits);
}


void
uart3_rx_tx_isr( pointer user_isr_ptr )
{
UBYTE ubUDR; /* TODO: Get byte from UART. */;

/* optional to open device again*/
rs485_dev = fopen( RS485_CHANNEL, NULL );
if( rs485_dev == NULL )
{
/* device could not be opened */
_task_block();
}

if (fstatus( rs485_dev ))
{
    ubUDR = fgetc( rs485_dev );
}
}

 

Can some one help getting ISR triggered when there is some data on UART3?

 

/Raghu

0 Kudos
1 Solution
409 Views
c0170
Senior Contributor III

Hi mpc8377e,

 

#if BSPCFG_ENABLE_TTYD
#define BSP_DEFAULT_IO_CHANNEL "ittyd:"

 

change condition to BSPCFG_ENABLE_ITTYD. You only added interrupt into the MQX.

Use those 2 functions for cortex  to initialize and enable interrupt vector.

    _cortex_int_init();
    _cortex_int_enable();

 

Regards,

MartinK

View solution in original post

0 Kudos
1 Reply
410 Views
c0170
Senior Contributor III

Hi mpc8377e,

 

#if BSPCFG_ENABLE_TTYD
#define BSP_DEFAULT_IO_CHANNEL "ittyd:"

 

change condition to BSPCFG_ENABLE_ITTYD. You only added interrupt into the MQX.

Use those 2 functions for cortex  to initialize and enable interrupt vector.

    _cortex_int_init();
    _cortex_int_enable();

 

Regards,

MartinK

0 Kudos