Hello!
I am working on reading data from GPS module. I think I am stuck at here:
UARTConfigSetExpClk(UART1_BASE, SysCtlClockGet(),9600, 0x00000060 |UART_CONFIG_STOP_ONE| UART_CONFIG_PAR_NONE);
In the code above, I want to make a change so that the stop bit is 0, instead of choosing either one or two. This is to read data from a GPS module. Currently it returns messy code. I have tried many combinations but none of them works. However, I know the module works because I have tried it on Arduino before. Is there a way to customize communication protocol?
The manual of GPS EM-406a says
"The default communication parameters for PORT B are set for 9600 Baud, 8data bits, 0 stop bits, and no parity."
Also attached is my entire code:
int x=0;
int main(void) {
SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN |SYSCTL_XTAL_16MHZ);
SysCtlPeripheralEnable(SYSCTL_PERIPH_UART1);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
GPIOPinConfigure(GPIO_PB0_U1RX);
GPIOPinConfigure(GPIO_PB1_U1TX);
GPIOPinTypeUART(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1);
UARTConfigSetExpClk(UART1_BASE, SysCtlClockGet(),9600, 0x00000060 |UART_CONFIG_STOP_ONE| UART_CONFIG_PAR_NONE);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
GPIOPinConfigure(GPIO_PA0_U0RX);
GPIOPinConfigure(GPIO_PA1_U0TX);
GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
UARTClockSourceSet(UART0_BASE, UART_CLOCK_PIOSC);
UARTStdioConfig(0, 9600, 16000000);
UARTprintf("flag!! \n");
while (1) {
char data;
while(UARTCharsAvail(UART1_BASE)) {
data = UARTCharGetNonBlocking(UART1_BASE);
UARTprintf("%c", data) ;
x++;
if (x>=20) {
x=0;
UARTprintf("\n") ;
}
}
}
}