Quality RTOS & Embedded Software

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




Loading

A interrupt problem with PIC32

Posted by wne on January 20, 2010
When I use xSemaphoreGiveFromISR in one of my ISR (ipl3), my code hangs. In RTOS viewer, the xTickCount is zero all the time and only shows 3 out of 8 tasks in the viewer. This topic could be discussed before. After searching and reading this forum, I am still not sure what would cause it and how to correct it. Could you give me the possible reasons that you can guess based upon my description? Or, let me know what else I can provide to solve it. I'll check with it tomorrow. Thanks.

RE: A interrupt problem with PIC32

Posted by MEdwards on January 20, 2010
Is the priority of the interrupt equal to or lower than configMAX_SYSCALL_INTERRUPT_PRIORITY? Do you have stack overflow checking on?

RE: A interrupt problem with PIC32

Posted by wne on January 20, 2010
my configMAX_SYSCALL_INTERRUPT_PRIORITY is equal to 0x03, which is equal to the ISR priority level.
I'll try to figure out if your 2nd question true or not tomorrow. Thanks for the reply.

RE: A interrupt problem with PIC32

Posted by wne on January 21, 2010
I set a break point inside the function vApplicationStackOverflowHook( void ), I did not observe a break, so, I assume that there is no overflow happened.

RE: A interrupt problem with PIC32

Posted by wne on January 29, 2010
After days working on it, I found that my code hangs at _general_exception_handler. It always happen when the code running in function:
xQueueGenericSendFromISR
line:
if( pxQueue->uxMessagesWaiting <= pxQueue->uxLength )
after stepping off this line, my code ends up general exception. Any clue?

RE: A interrupt problem with PIC32

Posted by wne on January 29, 2010
Sorry, I changed "<" to "<=" in
if( pxQueue->uxMessagesWaiting <= pxQueue->uxLength )
but the same result.

RE: A interrupt problem with PIC32

Posted by Dave on January 29, 2010
If the interrupt priority is correct, then I'm going for stack overflow or some other form of data corruption within the queue. It might be that the PIC is raising an exception before the stack overflow is checked.

Have you written the ISR *exactly* as per the examples?

RE: A interrupt problem with PIC32

Posted by woops_ on January 29, 2010
PIC32 has a separate interrupt stack. Only the task stacks are checked for overflowing.

RE: A interrupt problem with PIC32

Posted by wne on January 29, 2010
one more update:
I checked the *pxQueue in Watch window. what I caught are when code stop at line:
if( pxQueue->uxMessagesWaiting < pxQueue->uxLength ) (it always can stop here, but here is the key)
then in watch window,
1. If the uxMessagesWaiting value is 0x00000000 and uxLength value is 0x00000001, my code will run fine.
2. If the uxMessagesWaiting value is 0x00000000 and uxLength value is 0x40976000, the code must end up general exceptioni. (this happen most of time).
In case 1, I type pxQueue->uxMessagesWaiting and pxQueue->uxLength in watch window, they both show value 0xA00038B0.
in case 2, they both show value 0x40976000
I am not able to interpret the phenomenon.

RE: A interrupt problem with PIC32

Posted by wne on January 29, 2010
>>Have you written the ISR *exactly* as per the examples?
I got not only one ISR using xSemaphoreGiveFromISR, but only one is not working. I use copy and paste technic to write my ISR, chen change parameters, so...

>>PIC32 has a separate interrupt stack. Only the task stacks are checked for overflowing.
I doubled the configISR_STACK_SIZE, but seem not working.

RE: A interrupt problem with PIC32

Posted by wne on January 29, 2010
How to prevent interrupt which calls API function occurring before scheduler start? this might solve my problem.

RE: A interrupt problem with PIC32

Posted by wne on January 29, 2010
Seem that it is taken care by FreeRTOS automatically. Am I right?

RE: A interrupt problem with PIC32

Posted by MEdwards on January 29, 2010
Provided you don't change the interrupt bits yourself, then yes it should be taken care of.

RE: A interrupt problem with PIC32

Posted by MEdwards on January 29, 2010
Inspect xSchedulerRunning from the exception handler to see if the scheduler was actually started before it crashed.

RE: A interrupt problem with PIC32

Posted by wne on January 29, 2010
xSchedulerRunning value is 0x00000001 when I check at general exception handler point.


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




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists