![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
Matt Que
Joined: 16 Nov 2009 Posts: 14
|
PIC24 UART Rx Issue |
Posted: Thu Jun 28, 2012 8:39 pm |
|
|
I have been having quite a bit of serial communication issues with the PIC24H. I am trying to understand whether I have a hardware implementation issue or a software/firmware issue. I seem to have pretty pretty poor serial communication above 9600 baud.
My compiler version is up to 4.134.
I am connected to the PIC24H on a board using a Maxim 3222CWN+ RS-232 transceiver wired per the Maxim datasheet. The PIC PCB is then connected to a GUC232A usb-serial adapter in which I have realterm spewing out bytes of data repeatedly for debugging.
I have been able to isolate the problem down to the receive side of the configuration/system. At baud rates above 9600, the PIC is acting like it is inadvertently shifting bits and getting corrupted bytes transferred. I have been able to get good data transmitted from the PIC through the GUC232A into realterm at baud rates all the way up to 115200, but the PIC receives shifted bytes at any baud rate above 9600, 9600 and below are fine.
For example: @57600, I send 0x01 to the PIC, the PIC receives 0x03 confirmed by the ICD and spews back to RealTerm 0x03... everytime...
I am stuck here and not sure where to go... Any insight is greatly appreciated!
Code: |
#include <24HJ128GP306.h>
#build(stack = 256)
#device ICD=TRUE
//#device ADC=16
//#device ADC=10
#include <math.h>
#include <string.h>
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include <SAS_STRUCT_120624.h>
#type FLOAT=32
#fuses HS,NOWDT,PR
#use delay(clock=20000000)
#use rs232(BAUD=57600, UART2, PARITY=N, BITS=8, STOP=1, ERRORS)
void main()
{
while(TRUE)
{
T = getchar(); // Puts Input BYTE from AP_IN UART Port and copies it to a variable
putc(T);
}
} |
|
|
![](templates/subSilver/images/spacer.gif) |
ezflyr
Joined: 25 Oct 2010 Posts: 1019 Location: Tewksbury, MA
|
|
Posted: Thu Jun 28, 2012 8:46 pm |
|
|
Hi,
You already have a thread going for this issue, so please don't start a new one: http://ccsinfo.com/forum/viewtopic.php?t=45070
It has been 15 months (!) since you first raised this issue, and worse, you have basically ignored everything that PCM programmer told you to do in the original thread. This is probably why no one is taking you seriously, and thus you have no answers. My guess is that you are on your own!
BTW, does the posted code even compile? Where is your definition for 'T'? If it's in one of your includes, this is precisely one of the reasons PCM told you to get rid of them!
John |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|