Hello,
on my qnx632 target, i wrote and read from the same serial port. In my task loop, i read first and then sent out the request for the data to be read in the next loop, read and write operation keep going in the loop with a period of 20ms.
The problem now is after several normal thousands of read and write operations, it got stuck in the read operation and could never return.
what might be the reasons leading to the zombie state? thx
But as the qnx help docs said, if i read from an empty pipe or FIFO, it will return 0 or indicate an error. Anyway, the read operation should not just be got stuck. Is it true?
my sample codes:
char buffer[4096];
read(ser1, buffer, 4096);
sorry i thought serial device could be regarded as the FIFO, so if there is no data received in the buffer of the serial device, it will block. Then if there only are, say 10 bytes in the serial buffer, then i request to read 4096 bytes, then the read operation should return 10 bytes, or it gets stuck?
And may i know in what kind of situations, we need to read in as much data as possible, and then parse the incoming packets accordingly. thx a lot.
I just tried the timer timeout method b4 the read operation. But the read operation will still get stuck there. As the qnx help doc says, since i have another timer already set in this thread, would it be the reason? thx
Tried this method, worked fine when the hardware was in good condition. Once it got stuck in the read operation, the timer will time out and will lead to the next read operation, but the sequencing read(after each time out) will all get stuck. So this is probably a hardware problem? thx
Perhaps what is happening is that the input queue is fully… Maybe the incoming data is faster than the reading loop. You said that the period of R/W is 20 msec… this period should not be handled directly by hardware? I don’t know the details of your implementation… But, maybe is a matter of synchronism…
thx, 20ms should be enough for the hardware processing to respond to the previous request data. Just found that if i ignored the CR (term.c_iflag = IGNBRK | IGNCR | IGNPAR;) then the stuck problem would disappear. But, the data length i read was reduced by 1 which would still pose a problem for me. Hope could help me clarify this. Thx.