masio wrote on Monday, September 29, 2014:
Hi. I’m writing a code for LPC1769 (Cortex M3) with FreeRTOS and LPCOpen library. The hard fault occurs when a FreeRTOS API function is called from an ISR.The interrupt has the same priority as the kernel (configKERNEL_INTERRUPT_PRIORITY).
The RTC interrupts make this error.
This function configs the RTC:
void rtc_init(){
Chip_RTC_Init(LPC_RTC);
Chip_RTC_CntIncrIntConfig(LPC_RTC, RTC_AMR_CIIR_IMSEC, ENABLE);
Chip_RTC_ClearIntPending(LPC_RTC, RTC_INT_COUNTER_INCREASE | RTC_INT_ALARM);
NVIC_EnableIRQ((IRQn_Type) RTC_IRQn);
Chip_RTC_Enable(LPC_RTC, ENABLE);
NVIC_SetPriority((IRQn_Type)RTC_IRQn,configKERNEL_INTERRUPT_PRIORITY);
}
IRQ Handler:
<i>
void RTC_IRQHandler(void)
{
uint32_t sec;
if (Chip_RTC_GetIntPending(LPC_RTC, RTC_INT_COUNTER_INCREASE)) {
Chip_RTC_ClearIntPending(LPC_RTC, RTC_INT_COUNTER_INCREASE);
}
xSemaphoreGiveFromISR(sem_temp,NULL); // THIS CAUSES THE ERROR.
}
}
</i>
FreeRTOSConfig.h file: http://paste.ofcode.org/DEERe56y3X8Eg7tXZgBRHd
Sorry for my bad english.
Thanks!