Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT




Loading

Loosing interrupts on queue and semaphore

Posted by Nobody/Anonymous on November 2, 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

RE: Loosing interrupts on queue and semaphore

Posted by Nobody/Anonymous on November 2, 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?

RE: Loosing interrupts on queue and semaphore

Posted by Nobody/Anonymous on November 3, 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


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS