hucker233 wrote on Thursday, June 03, 2010:
I have just isolated a bug in some code I’m debugging on a PIC24 project. The code is using an API function in an ISR that runs at a priority higher than the kernel priority (1).
The priorities were setup because our AD has a very tight timing requirement for clocking the data in (if we take an interrupt in the middle we loose data). The problem is the code right now is queuing up the data (a fair bit) from the ISR for external task processing and saving to an SD card. This mechanism eventually crashes.
So now I’m in a quandary, how best to handle this from an architectural standpoint? Implementation as a queue was natural (as was a semaphore) but it appears that none of the OS centric solutions will work here since I can’t call them. Valid assumption? Am I stuck writing to a circular buffer I manage in the ISR and then having a task poll to see if new data has arrived? Seems to defeat some of the reason I’m using an OS!
Any help greatly appreciated, this has been quite a wild goose chase!
Chuck