xQueueSendToBackFromISR

raphaelpereira wrote on Thursday, July 31, 2008:

Hello,

I’m trying to use this function inside my UART IRQ handler in my ARM7 GNUARM project, but it is producing Data Abort Exception. I raised the IRQ stack to 2048 bytes and verified the pointers using a debugger. All seems to be fine. I really can’t find the problem, as it doesn’t occur when stepping through the debugger.
The code used is below:

extern volatile struct uart_info **uarts_available;

void uart_0_interrupt_handler(void)
{
    unsigned char c;
    unsigned int status;
    portBASE_TYPE task_woken = 0;

    status = U0IIR;

    /* Check interrupt source */
    switch (status & UART_INT_ID)
    {
        /* Status received */
        case UART_INT_RLS:
            /* Not enabled */
            break;

        /* Data available */
        case UART_INT_RLA:

            status = U0LSR;
            while (status & UART_LSR_RDR)
            {
                c = U0RBR;
                if (!(status & UART_LSR_RXFE))
                    xQueueSendToBackFromISR(uarts_available[0]->rx_queue, &c, &task_woken);

                status = U0LSR;
            }
            break;

        case UART_INT_CTI:
            /* Not enabled */
            break;

        case UART_INT_THRE:
            /* Not enabled */
            break;
    }

    VICVectAddr = 0;
    if (task_woken)
        taskYIELD();
}

davedoors wrote on Thursday, July 31, 2008:

Check the UART demo that comes with the port to see how to call yield from within an interrupt. I don’t think it is likely that you can simply call taskYIELD(). Which ARM7 port are you using?

Have you followed the example given on the documentation page for your port with regard to how to write an interrupt?

jorick23 wrote on Thursday, July 31, 2008:

Perhaps you have an interrupt interrupting your interrupt.  When you’re in the debugger, interrupts are inhibited so you won’t see the data abort happen.

Also, taskYIELD isn’t the proper macro to be using in an interrupt.  You should do something like this:

portEND_SWITCHING_ISR (task_woken);

raphaelpereira wrote on Friday, August 01, 2008:

Thank you all. I was really doing the thing in the wrong way! Now everything is working fine!

Regards,