- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Do you still have the problem?
If so, could you please confirm that you get longer output string ( by 3 characters or so ) string _each_ time you reset the CPU? At first, I thought that maybe the reset circuit had glitches and was causing the issue, but I think that would cause more random lengths, not consistently longer outputs... Also, you could look at the assembler output, it should be quite short ( at least for the main loop ). Also, you could try to change the compiler optimizer to a less optimized level.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Sorry for the late answer, I was not notifed. Yes the output strings was always longer by 3 characters after each reset. I noticed similar effect on others project I made. For example, I had a project where some global variables were initialized. And sometimes, after a reset, the variables were not initialized (keeping value before the reset).
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page