Hi, thanks for the replies!
It's true I am not consuming the X, but with the second version of the script, I am not even sending them. I am just opening and closing the file.
But to be 100% sure, I changed the main loop to this:
Code: Select all
for(;;){
chnGetTimeout(&SDU1, TIME_INFINITE);
}
I can't imagine a safer version - it reads all the data and suspends when there are not any.
Furthermore, to be sure I am not too fast, I inserted a sleep to the test script.
Code: Select all
#!/bin/bash
x=0
while true
do touch /dev/ttyACM0
sleep 1
echo "OK" $x
x=$[x+1]
done
Now it is not faster than one open/close per second, not sending any real data. And it still fails after ~200 cycles.
I am getting more convinced that there is always some probability that opening/closing would trigger the error. And in the program I was developing it got so high I started noticing it even when communicating by hand.
Before submitting this post I even tried inserting another 1-second sleep between opening and closing the file. It worked for 800 cycles (half an hour) but then failed.
Also, here is what I get from usbmon, if it could help somehow.
A successful open/close.
Code: Select all
ffff88006ae30d80 3322959924 S Ii:6:011:2 -115:128 8 <
ffff8800637f3300 3322959942 S Co:6:011:0 s 21 22 0003 0000 0000 0
ffff8800637f3300 3322961428 C Co:6:011:0 0 0
ffff88007a5fa500 3322961468 S Bi:6:011:1 -115 128 <
ffff88007a5faec0 3322961481 S Bi:6:011:1 -115 128 <
ffff88007a8b3800 3322961485 S Bi:6:011:1 -115 128 <
ffff88007a8a0f00 3322961488 S Bi:6:011:1 -115 128 <
ffff880036b29680 3322961493 S Bi:6:011:1 -115 128 <
ffff880036b29980 3322961498 S Bi:6:011:1 -115 128 <
ffff880036b29800 3322961502 S Bi:6:011:1 -115 128 <
ffff880036b29ec0 3322961505 S Bi:6:011:1 -115 128 <
ffff88007a04ad80 3322961510 S Bi:6:011:1 -115 128 <
ffff88007a5fa2c0 3322961514 S Bi:6:011:1 -115 128 <
ffff88007a5fa440 3322961517 S Bi:6:011:1 -115 128 <
ffff88007a5fac80 3322961522 S Bi:6:011:1 -115 128 <
ffff88007a5faa40 3322961526 S Bi:6:011:1 -115 128 <
ffff88007a5fa380 3322961530 S Bi:6:011:1 -115 128 <
ffff88007a8a06c0 3322961534 S Bi:6:011:1 -115 128 <
ffff88007a5fa140 3322961537 S Bi:6:011:1 -115 128 <
ffff8800637f3300 3322961716 S Co:6:011:0 s 21 22 0000 0000 0000 0
ffff8800637f3300 3322962425 C Co:6:011:0 0 0
ffff88006ae30d80 3322963424 C Ii:6:011:2 -2:128 0
ffff88007a5fa500 3322964423 C Bi:6:011:1 -2 0
ffff88007a5faec0 3322965422 C Bi:6:011:1 -2 0
ffff88007a8b3800 3322966423 C Bi:6:011:1 -2 0
ffff88007a8a0f00 3322967424 C Bi:6:011:1 -2 0
ffff880036b29680 3322968422 C Bi:6:011:1 -2 0
ffff880036b29980 3322969403 C Bi:6:011:1 -2 0
ffff880036b29800 3322970421 C Bi:6:011:1 -2 0
ffff880036b29ec0 3322971433 C Bi:6:011:1 -2 0
ffff88007a04ad80 3322972433 C Bi:6:011:1 -2 0
ffff88007a5fa2c0 3322973424 C Bi:6:011:1 -2 0
ffff88007a5fa440 3322974425 C Bi:6:011:1 -2 0
ffff88007a5fac80 3322975424 C Bi:6:011:1 -2 0
ffff88007a5faa40 3322976422 C Bi:6:011:1 -2 0
ffff88007a5fa380 3322977424 C Bi:6:011:1 -2 0
ffff88007a8a06c0 3322978423 C Bi:6:011:1 -2 0
ffff88007a5fa140 3322979423 C Bi:6:011:1 -2 0
1 second later, a problem occurs when closing (note the 5-second delay and -2 response from ep 0)
Code: Select all
ffff88006ae30d80 3323983377 S Ii:6:011:2 -115:128 8 <
ffff88006aaf5b00 3323983393 S Co:6:011:0 s 21 22 0003 0000 0000 0
ffff88006aaf5b00 3323984450 C Co:6:011:0 0 0
ffff88007a5fa500 3323984474 S Bi:6:011:1 -115 128 <
ffff88007a5faec0 3323984479 S Bi:6:011:1 -115 128 <
ffff88007a8b3800 3323984481 S Bi:6:011:1 -115 128 <
ffff88007a8a0f00 3323984483 S Bi:6:011:1 -115 128 <
ffff880036b29680 3323984486 S Bi:6:011:1 -115 128 <
ffff880036b29980 3323984488 S Bi:6:011:1 -115 128 <
ffff880036b29800 3323984490 S Bi:6:011:1 -115 128 <
ffff880036b29ec0 3323984493 S Bi:6:011:1 -115 128 <
ffff88007a04ad80 3323984495 S Bi:6:011:1 -115 128 <
ffff88007a5fa2c0 3323984497 S Bi:6:011:1 -115 128 <
ffff88007a5fa440 3323984499 S Bi:6:011:1 -115 128 <
ffff88007a5fac80 3323984501 S Bi:6:011:1 -115 128 <
ffff88007a5faa40 3323984504 S Bi:6:011:1 -115 128 <
ffff88007a5fa380 3323984506 S Bi:6:011:1 -115 128 <
ffff88007a8a06c0 3323984508 S Bi:6:011:1 -115 128 <
ffff88007a5fa140 3323984511 S Bi:6:011:1 -115 128 <
ffff88006aaf5b00 3323984591 S Co:6:011:0 s 21 22 0000 0000 0000 0
ffff88006aaf5b00 3328982559 C Co:6:011:0 -2 0
ffff88006ae30d80 3328983555 C Ii:6:011:2 -2:128 0
ffff88007a5fa500 3328984557 C Bi:6:011:1 -2 0
ffff88007a5faec0 3328985557 C Bi:6:011:1 -2 0
ffff88007a8b3800 3328986554 C Bi:6:011:1 -2 0
ffff88007a8a0f00 3328987554 C Bi:6:011:1 -2 0
ffff880036b29680 3328988553 C Bi:6:011:1 -2 0
ffff880036b29980 3328989556 C Bi:6:011:1 -2 0
ffff880036b29800 3328990553 C Bi:6:011:1 -2 0
ffff880036b29ec0 3328991554 C Bi:6:011:1 -2 0
ffff88007a04ad80 3328992554 C Bi:6:011:1 -2 0
ffff88007a5fa2c0 3328993555 C Bi:6:011:1 -2 0
ffff88007a5fa440 3328994552 C Bi:6:011:1 -2 0
ffff88007a5fac80 3328995556 C Bi:6:011:1 -2 0
ffff88007a5faa40 3328996556 C Bi:6:011:1 -2 0
ffff88007a5fa380 3328997557 C Bi:6:011:1 -2 0
ffff88007a8a06c0 3328998554 C Bi:6:011:1 -2 0
ffff88007a5fa140 3328999555 C Bi:6:011:1 -2 0
All following attempts fail.
Code: Select all
ffff88006ae30d80 3330005302 S Ii:6:011:2 -115:128 8 <
ffff88006aaf5b00 3330005319 S Co:6:011:0 s 21 22 0003 0000 0000 0
ffff88006aaf5b00 3335006681 C Co:6:011:0 -2 0
ffff88006aaf5b00 3335006741 S Co:6:011:0 s 21 22 0000 0000 0000 0
ffff88006aaf5b00 3340006799 C Co:6:011:0 -2 0
ffff88006ae30d80 3340007796 C Ii:6:011:2 -2:128 0
Vlastimil Dort