Bidirectional uart error
Hi,
While testing my compactflash interface, that
communicates using a bidirectional uart, I discovered
that occasionally the uart buffer was not cleared
after changing the direction. That is, the last byte
transmitted, was the first byte received after changing
from transmit to receive using setDirection().
I send a command every 0.5 sec and during a four
hour test, I counted 26 times where the last byte
transmitted is the first byte received. So it is very
rare, but it does happen. I solved this by explicitly
clearing the buffer after a direction change. I haven't
had this error since.
Perhaps Parallax can clear the buffer explicitly
in the start() method in the next release of the
IDE, to prevent this error to appear.
regards peter
·
While testing my compactflash interface, that
communicates using a bidirectional uart, I discovered
that occasionally the uart buffer was not cleared
after changing the direction. That is, the last byte
transmitted, was the first byte received after changing
from transmit to receive using setDirection().
I send a command every 0.5 sec and during a four
hour test, I counted 26 times where the last byte
transmitted is the first byte received. So it is very
rare, but it does happen. I solved this by explicitly
clearing the buffer after a direction change. I haven't
had this error since.
Perhaps Parallax can clear the buffer explicitly
in the start() method in the next release of the
IDE, to prevent this error to appear.
regards peter
·