Fluke (not meter) in Virtual Wire Library

I have a project involving the an OOK transmitter/receiver pair, sending 14 byte (payload) messages over a short range (say 40 feet), with very little RF impediment in the path. Both units are controlled by an UNO R3, and when the link is first established, it runs fine. The messages are reliably sent and accurate upon receipt. The received message is copied out of the VirtualWire receive buffer to an LCD display, byte by byte.

Oddly though, after a while, the messages begin to arrive truncated, with anywhere from a few to almost all latter bytes missing. The former part of the message is still correct. The problem persists once it starts: it doesn't ever correct itself.

At first I tried improving the link (up by about 10 dB) to no avail. Then I brought the data rate down from 2000 to 1200 bps, to no avail. Last, I tried issuing a vw_rx_start() command after each receipt, to no avail.

I am convinced that the problem is on the receive end, because once things go off track, a hard reset of the receive UNO will restore proper performance.

I know that the VW library uses INT 0, and I am wondering if perhaps the VW software gets lost if a second message arrives while the first is still being processed. Any thoughts on this?

Thanks in advance for any insights.

John Doner

I encountered this exact problem.
Ensure that the parameter passed into vw_get_message for the length is reset, because it is written over by the call. Thus, if you even once get 8 bytes instead of 12 from a bad packet, then from that point forward you are telling the call that you only have 8 bytes of room to put the next message. Thus, from that point forward, you only get 8 bytes... and so on.

void ReceiveFromVw()
{
messageLength = VW_MAX_MESSAGE_LEN;
if(vw_get_message((byte *)message, &messageLength))
{
...