lpcware

LPCOpen + FreeRTOS + LPC1769 -> Hard fault

Discussion created by lpcware Employee on Jun 15, 2016
Content originally posted in LPCWare by masio on Mon Sep 29 18:45:02 MST 2014
Hi. I'm writing a code for LPC1769 (Cortex M3) with FreeRTOS and LPCOpen library. A 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:

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.
}

}


FreeRTOSConfig.h file attached.

Sorry for my bad english.

Thanks!

Outcomes