Quote:
|
Originally Posted by Kingofl337
The TTL runs at 115,200bps by default and most GPS devices run at 9600bps. You need to intialize the serial port at 9600 or convert 9600 to 115,200.
I don't know what to change in the code to properly initialize the port for 9600.
|
If its the BAUD then you will need to open serial_ports.c, and find the Init_Serial_Port_Two;
The current code should look like this:
Code:
void Init_Serial_Port_Two(void)
{
// Start by initializing the serial port with code
// common to receive and transmit functions
SPBRG2 = BAUD_115200; // baud rate generator register [251]
//
TXSTA2bits.BRGH = 1; // high baud rate select bit (asynchronous mode only) [248]
// 0: low speed
// 1: high speed
//
You need to change the TXSTA2bits.BRGH to 0, and SPBRG2 = BAUD_9600.
When your finished the code should look like this:
Code:
void Init_Serial_Port_Two(void)
{
// Start by initializing the serial port with code
// common to receive and transmit functions
SPBRG2 = BAUD_9600; // baud rate generator register [251]
//
TXSTA2bits.BRGH = 0; // high baud rate select bit (asynchronous mode only) [248]
// 0: low speed
// 1: high speed
//
I haven't tested this code, but I think its correct.