AnsweredAssumed Answered

Understanding _io_read Errors

Question asked by Scott Christensen on Sep 23, 2014
Latest reply on Oct 7, 2014 by Scott Christensen


I'm using MQX 4.0 and am using _io_read to read values from one the internal ADC modules on a MK10 mirco.  My read logic is similar to:

 

if ( _io_read(...) ) {

     do something

} else {

     write error message to console

}

 

Every so often, the _io_read function returns an error value and I get an error message on the console output.  I'm having trouble trying to understand what's causing the error & am hoping for some help.  How can I translate the return value of the function to a pass/fail value and learn more about why the read failed?

 

Here's more info:

  • I'm reading from multiple ADC inputs, and it's not always the same channel which errors out
  • Only one task reads from the ADCs
  • I have higher-priority tasks running, so it's possible my ADC task could be pre-empted during the _io_read process.  If so, how would I know this and how could I prevent it?
  • Is there a way to monitor task stack usage, or tell if a task is being continually pre-empted?

 

Thanks for the help!

Outcomes