xbee times out after Tx ~504 bytes

mcu=pic16f88
xbee=xb24 series I

i’m sending a string then checksum from the host pic16f88 to a xbee and that xbee sends it to another xbee on the dev board. somewhere around a total of approx 504 bytes the xbee’s stop sending/recieving. the association light hangs at this time also.

the pic is still sending the string out as i can see this with a LCD connected to the Tx pin on the sending host and the debug pin sends to a term window fine.

i’ve tried different baud rates on the pic & xbee but that didn’t seem to help with this particular issue.

Now, i can use two xbib dev boards connected to my computer with one of the xbee’s on each and send the same API packet with no issues.

so i’m leaning towards the problem is a timing issue with my pic16f88 or my program/fuses or both.

i’ve tried external resonators from 8MHz-20MHz. I have 22pF caps on the external crystals. I have tried the internal RC. but still, the issue remains.

any thoughts on why this is happening?

thx

'## code is in pic basic using mplab/mpasm



'###############################################
'#
'# program to test Tx & Rx API packets on 
'#  xb24 series 1 units. 
'#
'# host mcu's=  pic16f88
'#
'###############################################


'---[set fuses]---------------------------------

'Program Configuration Register 1
@ __CONFIG    _CONFIG1, _HS_OSC  & _DEBUG_OFF & _WDT_ON & _LVP_OFF & _CP_ALL & _CPD_ON & _BODEN_ON & _MCLR_ON & _PWRTE_ON & _WRT_PROTECT_OFF

;Program Configuration Register 2
@ __CONFIG    _CONFIG2, _IESO_OFF & _FCMEN_OFF



'---[includes----]-------------------------------

INCLUDE "bs2defs.bas"


'---[debug defines]-------------------------------

DEFINE DEBUG_REG PORTA
DEFINE DEBUG_BIT 2
DEFINE DEBUG_BAUD 9600
DEFINE DEBUG_MODE 1

'---[defines]--------------------------------------

DEFINE  OSC 8


'DEFINE HSER_RCSTA 90h 
DEFINE HSER_RCSTA 92h ' Enable serial ports Tx & Rx, sets SPEN & CREN & OERR
DEFINE HSER_TXSTA 24h ' Enable Tx HS, TXEN=1 & BRGH=1
DEFINE HSER_BAUD 9600 ' set baud and compiler will auto calc HSER_SPBRG
DEFINE HSER_CLROERR 1 ' Clear overflow automatically


ANSEL=0  
ADCON0=0
ADCON1=7
CMCON=7

'---[contants]---------------------------------------

LF            CON 10
CR            CON 13
MAX_DATA_LEN  CON 12


'-----------------------------------------------------------------------

BLINK_PA1  VAR portA.1    
BLINK_PB1  VAR portB.1    'to show sending serial data

TX_APIPacket  VAR byte[14]
Counter       VAR byte
Checksum      VAR byte
Ndx           VAR byte




'-----------------------------------------------------------------------
       
INIT:
  Clear
  gosub FILL_API_PACKET 



MAIN:
   FOR counter=0 to 35
      gosub sub_Test_Tx_API_Frame
   next counter
   goto MAIN



sub_Test_Tx_API_Frame:
    gosub sub_CALC_Checksum

    'send debug to realterm window
    Debug "TX= ",str TX_APIPacket\13," ", hex checksum, " [Cnt: ",dec counter,CR
 
    hserout [str TX_APIPacket\13, checksum]  
    gosub sub_BLINK_PB1  'show pic is alive
    pause 500
RETURN



FILL_API_PACKET:
   TX_APIPacket(0)=$7E  
   TX_APIPacket(1)=$00   
   TX_APIPacket(2)=$0A   
   TX_APIPacket(3)=$01   
   TX_APIPacket(4)=$01    'API frame ID
   TX_APIPacket(5)=$50    'DL addr
   TX_APIPacket(6)=$01    'DL addr
   TX_APIPacket(7)=$00    'option
   TX_APIPacket(8)=$48    'H
   TX_APIPacket(9)=$65    'E
   TX_APIPacket(10)=$6c   'L
   TX_APIPacket(11)=$6c   'L  
   TX_APIPacket(12)=$6f   'O
RETURN   


sub_CALC_Checksum:
    Checksum = 0
    for Ndx = 3 to MAX_DATA_LEN
       Checksum = Checksum + TX_APIPacket(Ndx)
    next 
    Checksum =  $FF & Checksum  'remove values > 1 byte
    Checksum = $FF - Checksum   '2's compliment
RETURN


sub_BLINK_PA1:
  High BLINK_PA1
  pause 200
  low BLINK_PA1
  PAUSE 200
RETURN


sub_BLINK_PB1: 
  High BLINK_PB1
  pause 200
  low BLINK_PB1
  PAUSE 200
RETURN


END                  


I’m not familiar with that version of Basic, but I don’t see anything obviously wrong with the code.

Have you checked Q7 in the Unofficial FAQ?

http://www.jsjf.demon.co.uk/xbee/faq.htm

i’ll take a look at that and see.

it happens on either breadboard with one using a droids.it breakout board and the other using a sparkfun breakout board. i did that just to test the 3.3v requirement on the xbee’s. same problem.

thx

I’d check the CTS signal from the XBee with a scope. It may be possible that you are overflowing the XBee’s serial receive buffer.

thanks john for the link. i actually have that on my wall from one of your other posts. it helped to revisit

waltr, i don’t have a scope. that problem i had written down in my notes earlier to check on. looked at some config setings on the xbee’s for that.

although i have each xbee’s profile saved so i can do diff’s easily to quickly see each unit’s config i really couldn’t see anything out of place…although my knowledge base currently is narrow with the xbee’s.

i flashed each one back to the default factory settings.

then started with 2 xbees for 16bit addressing, and that worked. then onto 64bit addressing and that worked. then one coordinator and a few end devices and they worked.

using either a 4mhz, 8mhz external resonator all at 9600 baud. so far so good. like they are working flawlessly.

no change to my code. works as expected.

other than that, i can’t say for certain what wasn’t quite right.

thanks for helping though. i think i’ll splurge for a software app for scoping. i can see where that would have helped quite a bit.