Question
usart hangs when nothing connected
Posted on April 14, 2013 at 00:00
If I dont have anything on the usart port then it hangs when sending data. I have a ''debug'' usart output that I only want to use sometimes. But if I dont have anything connected then it will sit and hang here
PUTCHAR_PROTOTYPE{ /* Place your implementation of fputc here */ /* e.g. write a character to the USART */ USART_SendData(Debug_USART, (uint8_t) ch); /* Loop until the end of transmission */ while (USART_GetFlagStatus(Debug_USART, USART_FLAG_TC) == RESET) {} return ch;}which makes sense because its trying to send data but is never able to. Guess the best way around this is to have a switch to turn debug on or off, but it would be bad if a user hits that switch and then their unit never starts.