Altera_Forum
Honored Contributor
16 years agoStrange effects of UART at reset
Hello,
I use an UART peripheral to communicate with a computer. If I launch the program, it works correctly, but if I reset the Nios II processor I have some problems. Here I post an simpler example where I have also the problem. The first code works correctly all the time, I receive well 1234 each time I reset the cpu.int main (void)
{
printf("1234 ");
while(1);
} But if i had the usleep function, that works when I launch the program, but if I reset the cpu, it the programs sends more characters than wanted. int main (void)
{
usleep(500000);
printf("1234 ");
while(1);
} I received the following (one line by reset of cpu) : 1234 34 1234 1234 1234 234 1234 1234 4 1234 1234 1234 1234 1234 1234 1234 34 1234 1234 1234 1234 But if I have the usleep function and I remove the while(1), I receive well 1234. Anybody have an idea why I have these effects ? Thanks in advance. Jérôme