Missing messages from ISR

splatspeed wrote on Friday, November 26, 2010:

Hi All

I am developing M3 code using an Actel Chip, i am sending messages from an ISR and receiving them in a thread.

i am using the xQueueSendToBackFromISR code.

however there is no implementation of the taskYIELD_FROM_ISR  code and Actel say i don’t need it any more

1 is this correct.
2 could this be the cause of my missing messages??

thanks Sean

rtel wrote on Friday, November 26, 2010:

There is not  an official Actel port, which means I don’t really know which code you are using.  However, all the Cortex M3 ports that are in the official release all use the same port layer code - the only difference being the compiler used.  There is a port for GCC (including Rowley, Code Red, Atollic, etc), Keil, and IAR.  Which are you using?

I would suggest looking at the documentation page on the FreeRTOS site for an existing CM3 port to see how it tells you do perform an ‘in ISR’ context switch - or look at examples for other cortex M3 chips in the main download.

Regards.

splatspeed wrote on Friday, November 26, 2010:

Thanks Richard

i am using the actel smartfusion webserver demo with Free RTOS i am using eclipse with the softconsole from actel, i beleicve this is Gcc as it is free. this is just strange as for some reason after 12k messages the thread stops receiving them?

i have checked the return code from the post function and this allways returns ok but the receive dosn’t allways happen?

thanks again Sean

rtel wrote on Friday, November 26, 2010:

The macro to use then is portEND_SWITCHING_ISR(), not taskYIELD_FROM_ISR().

If you are sending a lot of messages character by character consider using a ring buffer instead, and just send a single message to the task that processes the data once a complete message has been received.

Also, what have you set the priority of the interrupt to?  It must be equal to or below configMAX_SYSCALL_INTERRUPT_PRIORITY, remembering that high numeric values denote ***low*** interrupt priorities, and that different functions provided by different vendors want the interrupt priority specified in different ways (some wanted shifted into the most significant bits, while others want it in the least significant bits and do the shifting internally within the driver).  Definitely ***do not*** leave the interrupt at its default priority as this will be 0 and therefore the highest priority in the system.

Regards.

splatspeed wrote on Monday, November 29, 2010:

thanks again richard

the version i have has the following macro

#define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired ) vPortYieldFromISR()

the interrupts in the ACTEL port have not been conected in any way to your OS and are running in the drivers, i am assuming there is someway to write interrupts using Free RTOS that connects it into the RTOS and keeps everythign working.

you talk about a ACTEL official port any idea on a timeline for this?

thanks again for your help.

Sean

splatspeed wrote on Monday, November 29, 2010:

HI again Richard

found this in the code

/* This is the raw value as per the Cortex-M3 NVIC.  Values can be 255
(lowest) to 0 (1?) (highest). */
#define configKERNEL_INTERRUPT_PRIORITY 255
//#define configKERNEL_INTERRUPT_PRIORITY 149
#define configMAX_SYSCALL_INTERRUPT_PRIORITY 191 /* equivalent to 0xb0, or priority 11. */

/* This is the value being used as per the ST library which permits 16
priority values, 0 to 15.  This must correspond to the
configKERNEL_INTERRUPT_PRIORITY setting.  Here 15 corresponds to the lowest
NVIC value of 255. */
//#define configLIBRARY_KERNEL_INTERRUPT_PRIORITY 15

thanks Again and hope the snow is not to bad

Sean

splatspeed wrote on Monday, November 29, 2010:

hi all

i found this linked list with a loop in it so the for loop never returns??

“apiAdcData” = 0x20005a8c
apiAdcData = 0x00000000
apiAdcData = 0x00000000
“uiErrorCounter” = 4978860
“auiDataBufferPoolBitField” = 0x20000648
auiDataBufferPoolBitField = 0xfffffffc
“uxCriticalNesting” = 1
“uiSentMessages” = 43431
“uiRecvMessages” = 43429
“uiYieldCounter” = 43360
“uiSendError” = 0
“( xListItem * ) &( pxList->xListEnd )” = 0x2000e19c
xItemValue = 65535
pxNext = 0x2000afa8
pxPrevious = 0x2000afa8
pvOwner = 0x00000002
pvContainer = 0x00000008
“pxIterator” = 0x2000afa8
xItemValue = 1
pxNext = 0x2000afa8
pxPrevious = 0x2000afa8
pvOwner = 0x2000af90
pvContainer = 0x2000e194
“pxIterator->pxNext->xItemValue <= xValueOfInsertion” = 1
thanks Sean

davedoors wrote on Monday, November 29, 2010:

Where is the linked list within the FreeRTOS code? Your snipped, which refers to ADC data, seems to be application code.

splatspeed wrote on Monday, November 29, 2010:

Thanks dave

this is my entire watch windo cut and pasted the linked list is the Queue

“( xListItem * ) &( pxList->xListEnd )” = 0x2000e19c

this loops on it’s self, on further investigation it seems the disable interupts is not working as i still have interrupts firing when it is stuck in the for loop and “uxCriticalNesting” = 1 which means we should be in a critical section with interrupts disabled

thanks again sean

davedoors wrote on Monday, November 29, 2010:

This all sounds like an interrupt priority problem. There is one place in the FreeRTOS code where getting stuck in a circular loop is a classic sign of having interrupt priorities set wrong, and it even mentions it in the comments directly above the loop.

splatspeed wrote on Monday, November 29, 2010:

Yeah thanks Dave

that is the way i ma leaning

interrupts are still firing when the code is in a critical section???

i am trying to fix this now but i am waiting on actel to tell me where they set therir interuypt priorities in their system

thanks again Sean