void GPS_Configure(void) { //send the string to always change the baud //printf("about to change the baud"); //char *NMEA_String="$PMTK251,115200*1F\r\n\0"; GPS_PutString(MEDIATEK_CHANGE_BAUD); while (!GPS_IsTransmitEmpty()); //disable the uart and change baud and then re-enable UARTEnable(UART2, UART_DISABLE_FLAGS(UART_PERIPHERAL | UART_TX | UART_RX)); UARTSetDataRate(UART2, F_PB, 115200); UARTEnable(UART2, UART_ENABLE_FLAGS(UART_PERIPHERAL | UART_TX | UART_RX)); #ifdef DEBUG_VERBOSE printf("UART at Higher BaudRate\r\n"); #endif //while(!GPS_IsReceiveEmpty()); while (GPS_GetChar() != '$'); GPS_PutString(MEDIATEK_NMEA); while (!GPS_IsTransmitEmpty()); while (!GPS_IsReceiveEmpty()) { GPS_GetChar(); } while (GPS_GetChar() != '$'); GPS_PutString(MEDIATEK_REFRESH_RATE); printf("GPS Should be at 115200"); }
void setup_UART2 (unsigned int pb_clock) //UART associated with the PmodCLS { // OpenUART2( config1, config2, ubrg) OpenUART2 (UART_EN | UART_IDLE_CON | UART_RX_TX | UART_DIS_WAKE | UART_DIS_LOOPBACK | UART_DIS_ABAUD | UART_NO_PAR_8BIT | UART_1STOPBIT | UART_IRDA_DIS | UART_MODE_FLOWCTRL | UART_DIS_BCLK_CTS_RTS | UART_NORMAL_RX | UART_BRGH_SIXTEEN, UART_TX_PIN_LOW | UART_RX_ENABLE | UART_TX_ENABLE | UART_INT_TX | UART_INT_RX_CHAR | UART_ADR_DETECT_DIS | UART_RX_OVERRUN_CLEAR, mUARTBRG(pb_clock, DESIRED_BAUD_RATE)); UARTEnable(UART2, UART_DISABLE_FLAGS(UART_RX )); }
void closeSerial(unsigned char serialPortIndex) { UART_MODULE uart = getUartModule(serialPortIndex); UARTEnable(uart, UART_DISABLE_FLAGS(UART_PERIPHERAL | UART_RX | UART_TX)); }
void UARTiDisable(UART_MODULE iUART) { UARTEnable(iUART, UART_DISABLE_FLAGS(UART_PERIPHERAL | UART_RX | UART_TX)); }