Hello, I have a problem with my code. I run a several tasks on FreeRTOS (v7.3, supplied from Atmel ASF) and added a set of new tasks for ADC conversion. I tested the ADC part before without FreeRTOS and it worked fine. But after calling
NVIC_EnableIRQ(ADC_IRQn);, FreeRTOS scheduling ends (no task is called again) while the ADC interrupts remain. I have the standard configuration from Atmel, which is using 4 bits for the priorities. I tried to call also moving the call to
NVIC_EnableIRQ(ADC_IRQn); before creating any tasks, but this resulted in the same behaviour. Can someone please explain me why, as I am pretty sure that NVIC_EnableIRQ causes the crash, this stops the FreeRTOS kernel. I have already read http://www.freertos.org/RTOS-Cortex-M3-M4.html and used configASSERT on all semaphores and tasks related to this issue.
The ADC interrupts simply loads the result of from two ADC channels and stores them in a local variable. Afterwards it calls the corresponding task through releasing a binary semaphore. The ADC is operating hardware controlled using timer 0 with 10Hz. I understand FreeRTOS this way, the timer 0 and 1 are not consumed by it (it uses sysclk, correct?). As I have other components which will be integrated in my main application with FreeRTOS, I fear that similar errors might occur, as I2C and USB CDC also use hardware interrupts with
The semaphore is all 10Hz released, but no task is ever called after startup (where the ADC task is once called):
long prio = pdFALSE; xSemaphoreGiveFromISR(*(getSemaphoreHandlerADCDriver()), &prio); portEND_SWITCHING_ISR(prio);