Arm Mbed OS support forum

UART Debug printf works only with \n character

Hi Everyone,
I hope you can help me with this issue. I am using printf over UART as Debug tool and it works only when i add at the end of the string a ‘\n’ character. This is my function.

if(buf[posicionBuf-1] == ‘\n’)
{
printf(“datos en bufSD =\n”);
for(i = 0; i < posicionBuf; i++)
{
if(buf[i] == ‘\n’)
printf("%c", ‘*’);
else if(buf[i] == ’ ')
printf("%c", ‘_’);
else
printf("%c", buf[i]);
}
posicionBuf = 0;
}

The first printf() works as spected but the next printf transmits nothing until that I put ‘\n’ character. Why this happens? I hope you can help me to understand this behavior.

Best Regards