From: Oliver H. <au...@od...> - 2001-09-30 03:35:44
|
Hi, Johann Deneux wrote: > On Sat, 29 Sep 2001, Oliver Hamann wrote: > > BUG 1: machine freeze > > ===================== > > > > BUG 2: force freeze > > =================== > > > > BUG 3: force interrupts > > ======================= > > > > Somehow I tend to believe that the bug nests in the serial part, > > because the highler level code looks so clear. My wheel is on rs232. > > Did you ever encounter the bug with usb? > > Yes, I do have the same problem with usb. I thought that maybe the > cause was my asynchronous serial code. But even when coming back to > a synchronous model, the problem subsists. The fact that the bug is under both, rs232 and usb, motivated me to take a careful look again into your send_packet function, and this time i found it quickly. It's the circular buffer wrapping: memcpy(&iforce->xmit.buf[head], data, c); if (n != c) { memcpy(&iforce->xmit.buf[0], data, <-- here's the mistake, should be: data+c n - c); } It's the clear reason for bug 2 and 3. (proved by test) Could this, somehow, even be the reason for bug 1? Remember: the packet size is stored in the packet, the rs232 and usb code depends on this. There may be great confusion when the size is damaged by the circular buffer mistake. - - - - - - Oliver Hamann |