AnsweredAssumed Answered

printf - Implementation without interrupts using a co-operative scheduler

Question asked by Hector Hernandez on Feb 8, 2012
Latest reply on May 17, 2012 by Paul Roberts



Using CW10.1 on Kinetis K60 TWR platform. I'm also using Processor Expert LDD for the UART, etc.


I'm building applications around a co-operative scheduler (only a tick interrupt is enabled to drive the scheduler).


I'm trying to use as much as possible standard functions such as "printf" due to the flexibility built in to achieve some basic messaging loging capability.


The trouble is that printf would not work when the UART interrupts are disabled, at least when being supported by the LDD functions provided for console UART by PE. Just enabling interrupts will spring printf back to life.


I guess the question is, how could I make printf "work" in a co-operative environment where UART interrupts are disabled?

The generic idea is to send some characters to the queue and "periodically" poll the device for sending one character (or a partial number) in the time slot allocated for the task. Then in the next tick come back and complete the task.


Any help is much appreciated.