View previous topic :: View next topic |
Author |
Message |
jecottrell
Joined: 16 Jan 2005 Posts: 559 Location: Tucson, AZ
|
RX @ 38400 OK, 57600 Not |
Posted: Sun Sep 30, 2007 4:17 pm |
|
|
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
|
|
Posted: Sun Sep 30, 2007 4:29 pm |
|
|
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
|
|
Posted: Sun Sep 30, 2007 4:33 pm |
|
|
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
|
|
Posted: Sun Sep 30, 2007 4:59 pm |
|
|
Disregard..... Still broke..... |
|
|
jecottrell
Joined: 16 Jan 2005 Posts: 559 Location: Tucson, AZ
|
|
Posted: Sun Sep 30, 2007 6:52 pm |
|
|
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
|
|
Posted: Mon Oct 01, 2007 2:49 pm |
|
|
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
|
Which XBEE series? |
Posted: Thu Mar 06, 2008 12:54 pm |
|
|
jecottrell,
Sorry for extending your thread for my own use
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. |
|
|
|