Maybe this is a silly question (from an unexperienced user, as you’ll probably notice) but here it goes anyway:
I’m having an issue with the PIC24 port of the freeRtos kernel (Version 5.1.2). My application seems to run fine for a while but after some time it freezes. Every task stops executing and no interrupts are handled, the code just loops in the idle task. I have the ICD 2 debugger connected to my circuit and i can see that the IPL bits are set, so the CPU level is 7 when it freezes. ** I’ve disabled the nested interrupts by setting the NSTDIS bit, because a while ago i experimented other problem that was solved by doing this**. Now according to the PIC24F family reference manual:
- All user interrupt sources can be disabled by setting IPL<2:0> = 111.
- The IPL<2:0> status bits are read-only when NSTDIS = 1 (INTCON1<15>).
- When the NSTDIS control bit is set, all interrupts in progress will force the CPU priority to level 7 by setting IPL<2:0> = 111.
So, Is it wrong to disable nested interrupts while using the kernel?, Can someone please point me to some text, paper, reference or anything about precautions on handling nested interrupts? If it is not wrong to disable nested interrupts (I’m guessing it is), what else could be happening, what else should i check?
NOTE: I assume its wrong to disable nested interrupts since the macro #define portDISABLE_INTERRUPTS() SR |= portINTERRUPT_BITS writes to this bits. However while i was searching the forum I found this post https://sourceforge.net/projects/freertos/forums/forum/382005/topic/3489944 which suggest to disable nested interrupts “If you don’t need them” to solve their problem.
Any help figuring this out will be appreciated.
Thanks in advance guys