AnsweredAssumed Answered

How do I call fclose on a UART for which another task has a blocked fgetc call?

Question asked by Wayne Taylor on May 22, 2015
Latest reply on May 27, 2015 by Wayne Taylor

I want to be able to dynamically disconnect the pins used by the UART from my DTE that is wired wrong on some products. Instead of having the UART drive Rx & Tx, I want to close the UART using fclose() and then reassign the pins as high impedance inputs with weak pull-down resistors. However... I have a task that uses a blocking UART read, fgetc(). So what is the proper way to dynamically start and stop using this UART?

 

I did find that a call to fgetc() drills all the way down to the serial ISR call, and when there is no character ready, it places the task in a task queue and changes it's state to suspended. What I don't know how to do is bring that task back to life, so it can release a mutex used to guard access to the Rx port.

 

Thanks,

Wayne Taylor

Outcomes