I am currently using the FreeRTOS in a project using a PIC32MX. It all
worked properly until I added an xTaskCreate from inside an interrupt
routine. The system crashed!.
The created task started with an xTaskDelay and although it reached this
function it never returned but failed on an address problem.
/* Task started. */
static void downloadtask( void *param )
{
uint8t result;
BFRHANDLE bfr;
uint16t cChr;
uint8t retry;
uint8t schar = 0;
vTaskDelay( DOWNLOADDELAYTO_START );
fileClean( 1 );
………….
I WILL find a way round my problem but it would be interesting to know
if there is a known problem.
—
Regards Malcolm
Technical Manager (R&D)
ENS Group
Orpheus House
Calleva Park
Aldermaston
Berks RG7 8TA
UK
Email: malcolm@smc-electronics.co.uk
Web: www.smc-electronics.co.uk
Web: www.ens-group.co.uk
This email has been checked for viruses by AVG.
http://www.avg.com
xTaskCreate in an interrupt
xTaskCreate in an interrupt
There is a simple rule of thumb (which doesn’t hold in all cases, but is
easy to state and follow): Do not call any API function that doesn’t
end if ‘FromISR’ from an interrupt.
That is particularly true of xTaskCreate(), which will allocate memory.
If you want to create a task from an interrupt then use one of the
deferred interrupt handling techniques, or use
xTimerPendFunctionCallFromISR()
http://www.freertos.org/xTimerPendFunctionCallFromISR.html
I would recommend reading the book, its free, and won’t take long:
http://www.freertos.org/Documentation/RTOS_book.html
xTaskCreate in an interrupt
Many thanks.
My problem was using the taskENTERCRITICAL/taskEXITCRITICAL inside an interrupt.
I noted your comments and changed to starting the task then suspended it. Whan I wanted to use it I just did an xTaskResumeFromISR to activate it.