Loosing interrupts on queue and semaphore

nobody wrote on Wednesday, November 02, 2005:

Hello,
i am working  at a CAN application which reads from multiple CAN interfaces by interrupt, and releases a semaphore (…i also tried a queue) to notify a task. I am loosing up to 30% of my CAN-interrupts.
When i remove the queue/semaphore functions everything seems to be ok.

Port : ARM7
Hardware LPC2294  

Any Idea ???

 
Thanx,

Peter

nobody wrote on Wednesday, November 02, 2005:

How fast is the LPC running?  (MHz, waitstates, etc), and what is the baud of the CAN?

Are you able to post your ISR code with and without the queues?

nobody wrote on Thursday, November 03, 2005:

Hello,

the LPC is running with 48 MHz, (… i also tried 60MHz). The behavior is the same at internal an external RAM.

CAN-Baudrate is 500Kbps

The CAN-ID’s are sent in 1 ms 25% Bus-Load,
10 ms (3% Busload) and 100ms (0,3 % Busload)
There are no bursts at the Bus (checked with Vector-CANalyzer)

The problems occure at 1 and 10 ms    

static portCHAR can_isr(unsigned int can_nr)
{
//    portBASE_TYPE xTaskWoken = pdFALSE;
/* put data it inside CAN-Ringbuffer */
    if(LPC_CAN[can_nr]->ctrl.gsr.dw & 0x1) {
        can_buffer->recv_ringb[can_nr].entries[can_buffer->recv_ringb[can_nr].w_ptr].can.id.dw =
            LPC_CAN[can_nr]->rcv.id.dw;
        can_buffer->recv_ringb[can_nr].entries[can_buffer->recv_ringb[can_nr].w_ptr].can.data[0].dw =
            LPC_CAN[can_nr]->rcv.data[0].dw;
        can_buffer->recv_ringb[can_nr].entries[can_buffer->recv_ringb[can_nr].w_ptr].can.data[1].dw =
            LPC_CAN[can_nr]->rcv.data[1].dw;
        can_buffer->recv_ringb[can_nr].entries[can_buffer->recv_ringb[can_nr].w_ptr].ts =
            T0_TC;
    /* release CAN-message */
        LPC_CAN[can_nr]->ctrl.cmr.b[0] = 0x4;
    /*Ring buffer movement*/   
        can_buffer->recv_ringb[can_nr].w_ptr ++;   
        if(can_buffer->recv_ringb[can_nr].w_ptr >= CAN_RING_SIZE) {
            can_buffer->recv_ringb[can_nr].w_ptr = 0;
        }
        can_rx_cnt[can_nr]++;
//        xTaskWoken = xSemaphoreGiveFromISR(CanIrqSem, xTaskWoken );
//        xTaskWoken = xQueueSendFromISR(CanIrqQ,&can_nr, xTaskWoken);
    }
    if(LPC_CAN[can_nr]->ctrl.gsr.dw & 0x2) {
        can_buffer->recv_ringb[can_nr].ovrcnt++;
        LPC_CAN[can_nr]->ctrl.cmr.b[0] =  0x8;
    }
    return pdFALSE;
//    return xTaskWoken;
}

void can0_rx_isr(void)
{
    portENTER_SWITCHING_ISR();
    portBASE_TYPE xTaskWoken = pdFALSE;
    xTaskWoken = can_isr(0);
    /* acknowledge Interrupt */   
//    VICVectAddr = 0x0L;
    VICVectAddr = 0xFFFFFFFFL;
    /*return from ISR by switching or recovering */
    portEXIT_SWITCHING_ISR(xTaskWoken);
}

Thankx,

Peter