Many missed ACKs from receiver

We are doing some prototyping with Xbee S2 modules.

We have an extremely simply test which is showing very poor results:

Sender module (configured as Router) sends 8 bytes directly (unicast) to receiver and waits for an ACK byte. The receiver module (configured as Coordinator) reads bytes and after the 8th byte is received, it sends an ACK byte.

This is wrapped in a for-loop running 50 iterations. The modules are 1 foot apart.

We have tested with various delays between successive iterations in the for-loop.

Observation:
In all cases the receiver always receives all data cleanly. However, the sender often does not receive the response ACK. I am seeing 10% on average of all responses being missed! We reversed roles of modules and saw the same results.

This is certainly showstopper for any further development.

Questions:
What are some potential causes for such a poor results for such a trivial test?

Below is my python test code.

----------------Sender.py----------------
import serial
import time
from time import sleep

ser = serial.Serial(‘COM9’, 9600, timeout=2)

NumResponsesReceived=0

#wait maximum of 2 seconds for response
ser.timeout=2
for i in range(0,50):
print "sending message, SeqNo " + str(i) + "
"
values = bytearray([2, 3, 1,4,0,0,0,i])
ser.write(values)
c2=ser.read(1)
if(c2!=‘’):
b=int(c2.encode(‘hex’),16)
print "Got response! " + str(b) + "
"
NumResponsesReceived=NumResponsesReceived+1
else:
print "Timed out
"
ser.flush()

sleep(0.1)

ser.close()
print "Total responses received: " + str(NumResponsesReceived)

----------------Receiver.py----------------
import serial
import time
from time import sleep

ser = serial.Serial(‘COM5’, 9600, timeout=None)
ser.flushInput
ACK=‘06’
NAK=‘15’

NumOfMessages=0
print “Receiver started. Waiting for data…”
while True:
ser.timeout= None
c=ser.read()
if(c!=‘’):
x=int(c.encode(‘hex’),16)
#print "encoded " + str(x)
if(x==2): #STX symbol (start sentinal)
print ":::::Record:::::
"
ser.timeout=1

		print "["
		NumRead=1
		while(NumRead<8):
			c2=ser.read(1)
			if(c2!=''):
				b=int(c2.encode('hex'),16)
				print str(b),
				NumRead=NumRead+1
			else:
				#print "Timed out

"
break
print “]”
sleep(0.1)
if(NumRead==8):
ser.write(ACK.decode(“hex”))
print “Got command message! Sending ACK!”
else:
ser.write(NAK.decode(“hex”))
print “Did not receive all 8 bytes! Sending NAK!”
print " "

	else:
		print "Unexpected preamble " + str(x)
else:
	print "Timeout or something is wrong!!! Assuming no more data.

"
#print Checks
break

ser.close()

Try taking the Coordinator out of Broadcast mode and placing it in Unicast mode by setting the DL and DH addresses to the SL and SH of the router.

This setting is already on.

What are the exact settings you are using on both radios?

What throughput rate are you trying to achieve? Is that rate full or half duplex?

I am not in the office now to grab record the settings in XCTU. I will grab this later. But basically, the only setting that I altered from the default are the DL and DH addresses.

I have minimal throughput requirements (will be sending occasional 32 byte status messages) and require only half duplex. In light of this, what settings might help with the issue?

Try sending the 32 byte packet as a full packet instead of 8 bights at a time. You will find that you will get better results and use less current.

Thanks but my problem is with the 1-byte response. The initiated 8-byte message seems perfect.

Are you implying that I should respond with more bytes (e.g have 31 dummy bytes)? Why might this improve the situation?