Hi, been playing around with the demo application and like the way it can easily give us all the bells and whistles we need for our project - file system, webserver, usb, tcp, bootloader and so on.. all with a neat little scheduler that fits my preferred programming model of event based state machines.
As an aside, a table driven hierarchical state machine I have used in the past...
http://embedded.com/design/10700829My past projects tend to run a pre-emptive RTOS - and for most of the 'executing time', they don’t need to. Agreed.
There is one case where I have relied on pre-emption to meet some tight real time constraints - and can't see an obvious solution using the uTasker scheduler. Really I'm looking for some tips/tricks/strategies on if/how I can solve these problems.
It concerns situations, for example, when external devices give an interrupt to signal they need additional attention - and fairly quickly. A 'hypothetical example' is the SPI CAN driver chip MCP2515. It lets me know a message is waiting in the RX buffer - but I cant read the buffer from within the ISR (SPI comms within an ISR is not good practice!) .. If I leave it too late the buffer gets ovewritten.
So, what I do is have the ISR post an event to a task called 'ReadMCP2515_RxBuf'. The 'ReadMCP2515_RxBuf' task reads out the contents of the buffer over the SPI and places it in a FIFO in RAM for other tasks to consume as and when they can. (Assume CAN messages arrive in bursts)
Most of the time all tasks are waiting on a empty queue, so the real time requirement is met, but there will be conditions where this clashes with a periodic task, such as an ADC read - that in turn will start a flurry of message activity between tasks - status updates, LCD updates.. etc. all the time our 'ReadMCP2515_RxBuf' is not getting any service. (No one said event driven programming was easy!)
Ideally the current SPI operation finishes its chip select - (this could include an LCD update OR and an ADC read..) then the 'ReadMCP2515_RxBuf' should get started as soon as possible.
What are community members thoughts on tacking such an issues?
Multiple entries of 'ReadMCP2515_RxBuf' task in the table of tasks to be run?? That sort of thing??
Thanks,
Jon.