CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

RX @ 38400 OK, 57600 Not

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
jecottrell



Joined: 16 Jan 2005
Posts: 559
Location: Tucson, AZ

View user's profile Send private message

RX @ 38400 OK, 57600 Not
PostPosted: Sun Sep 30, 2007 4:17 pm     Reply with quote

18LF6627, 3.3V, 40MHz
3.249

I'm sending a string from the PC to the PIC via a XBee link. When I scope the output of the radio to the PIC it looks good at 57600. Instead of the PIC receiving 5 characters, I only get 4. (same four every time...) If I send one character at a time it works. Or if I tweak it down to 38400 it works.

Here is my setup:

Code:
#use rs232(baud=57600,parity=N,xmit=PIN_G1,rcv=PIN_G2,bits=8,stream=XBEE,errors)   // xbee


And here is my ISR:

Code:
   #INT_RDA2
   void serial_isr2(void)
   {
      int RxChar;
      // Hamlett
      Rx_BaseHW2[HWU2_RxHead] = fgetc(XBEE);
      HWU2_RxHead = (HWU2_RxHead + 1) & (HWU2_RxQsize - 1);
   }


I'm always use to working at 9600 and have never seen these problems. Could someone offer some ideas? (I've already tried the disable_ints option.)

Thanks,

John
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Sep 30, 2007 4:29 pm     Reply with quote

You could make a test program and output continuous 0x55 characters
and look at the bit period with an oscilloscope.
jecottrell



Joined: 16 Jan 2005
Posts: 559
Location: Tucson, AZ

View user's profile Send private message

PostPosted: Sun Sep 30, 2007 4:33 pm     Reply with quote

PCM thanks for the idea.

Just after posting it struck me that I had the RDA1 pins floating (another piece of hardware, serial camera) wasn't attached while testing. I intermittently saw a bad receive flag on RDA1 and that made me think that INT_RDA was firing and bunging up INT_RDA2.

I think I got it fixed.

Thanks again,

John
jecottrell



Joined: 16 Jan 2005
Posts: 559
Location: Tucson, AZ

View user's profile Send private message

PostPosted: Sun Sep 30, 2007 4:59 pm     Reply with quote

Disregard..... Still broke.....
jecottrell



Joined: 16 Jan 2005
Posts: 559
Location: Tucson, AZ

View user's profile Send private message

PostPosted: Sun Sep 30, 2007 6:52 pm     Reply with quote

The plot thickens....

Did as PCM suggested.

Scoped receiving 0x55. Measured bit rate. Looks like there's a timing issue from the XBee radio. 59000 +/-. When I tweak the baud rate in the setup everything works fine.

Problem identified, but not solved.

Thanks,

John
jecottrell



Joined: 16 Jan 2005
Posts: 559
Location: Tucson, AZ

View user's profile Send private message

PostPosted: Mon Oct 01, 2007 2:49 pm     Reply with quote

For anyone that is interested or runs into similar problems:

XBee baud rates are 1MHz/n.

So, 57600 is actually 1,000,000/17 = 58823.

If I use 58823 in the #use rs232 everything works great. The errors between both sets of hardware is tolerable.

PCM, thanks again for the ideas.

John
bwhiten



Joined: 26 Nov 2003
Posts: 151
Location: Grayson, GA

View user's profile Send private message

Which XBEE series?
PostPosted: Thu Mar 06, 2008 12:54 pm     Reply with quote

jecottrell,
Sorry for extending your thread for my own use Embarassed
I have designed in an XBEE module for wireless in my product, Series 2 to be exact. Are you running as Zigbee, 802.15.4 or just a serial port extension? Are you running more than two end devices?
Any other tips you mave have would be greatly appreciated.
Thanks.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group