FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [December 2013 Threads] Cortex M4 Low power interruptPosted by jabad06 on December 8, 2013 I am using the CortexM4ATSAM4LAtmelStudio in low power mode for my applications. I am doing some stability testing and have found that my build crashes within 24 hours. My build is using the ast timer as the ticks for freertos as the demo provides. I created an interrupt that uses a semaphore to resume a task. My interrupts are coming in at 200hz and set the priority level to be configLIBRARYMAXSYSCALLINTERRUPTPRIORITY. When running this The system freezes in under 24 hours. In this freezing I noticed the ast interrupts (ticks for freertos) and my external interrupts stop coming in also.
This is how I set my interrupts.
~~~~~~
struct eiclineconfig eiclineconf;
ioport_set_pin_mode(PIN_PA16, MUX_PA16C_EIC_EXTINT1 | IOPORT_MODE_PULLUP);
ioport_disable_pin(PIN_PA16);
/* Setup Motion interrupt PIN as EIC*/
eic_line_conf.eic_mode = EIC_MODE_EDGE_TRIGGERED;
eic_line_conf.eic_edge = EIC_EDGE_FALLING_EDGE;
eic_line_conf.eic_level = EIC_LEVEL_LOW_LEVEL;
eic_line_conf.eic_filter = EIC_FILTER_DISABLED;
eic_line_conf.eic_async = EIC_ASYNCH_MODE;
eic_enable(EIC);
eic_line_set_config(EIC, EXT_INT1,
&eic_line_conf);
eic_line_set_callback(EIC, EXT_INT1, cb,
EIC_1_IRQn, 1);
eic_line_enable(EIC, EXT_INT1);
sysclk_disable_peripheral_clock(EIC);
~~~~~~
~~~~~~
static void cb(){
SemaphoreGiveFromISR(semid);
}
void task(){
for(;;){
if(SemaphoreTake(semid){
//toggle led
}
}
}
~~~~~~
I also did a separate test where my external interrupts has a priority 1 and they constantly come in while the ast stops coming.
Cortex M4 Low power interruptPosted by rtel on December 8, 2013
and set the priority level to be configLIBRARYMAXSYSCALLINTERRUPTPRIORITY
There is a comment in the code as follows:
/* Tick interrupt MUST execute at the lowest interrupt priority. */
Try setting the priority level to configLIBRARYLOWESTINTERRUPT_PRIORITY.
Also, when the ticks stop, look at the alarm value. While creating a low power demo for another port I ensured the equivalent of the alarm value is never set to 0. It doesn't look like the same check is included in the SAM4L demo in the following place in the code:
/* The alarm value is set to whatever fraction of a single tick period remains. */
ulAlarmValue = astreadcountervalue( AST ) - ( ulCompleteTickPeriods * ulAlarmValueForOneTick );
astwritealarm0value( AST, ulAlarmValue );
Try adding the following lines in between those two lines (which are in SAM4Llowpowertickmanagement.c).
if( ulAlarmValue == 0 )
{
/* There is no fraction remaining. */
ulAlarmValue = ulAlarmValueForOneTick;
ulCompleteTickPeriods++;
}
Regards.
Cortex M4 Low power interruptPosted by rtel on December 8, 2013 See https://sourceforge.net/p/freertos/code/HEAD/tree/trunk/FreeRTOS/Demo/CORTEXM4ATSAM4LAtmelStudio/src/SAM4Llowpowertickmanagement.c
Note that change will only make a difference if something other than the tick interrupt brings the MCU out of its sleep state.
Regards.
Cortex M4 Low power interruptPosted by jabad06 on December 9, 2013 Yes I set the priority level of my other interrupt to be configLIBRARYMAXSYSCALLINTERRUPTPRIORITY. I don't believe the error occurs in the portSuprressTicksAndSleep function. I have led toggle checks in that function and the error appears to occur out of the function. I am guessing that maybe some in freertos it is disabling the interrupts in a critical section and somehow fail to enable the interrupts.
Has anyone ever used the freertos low power demo on cortex M4 to run with other interrupts coming in? A reference guide on how to use external interrupts with this low power demo would also help.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|