I'm trying to read GPS data with STM32 board but I've some issues. I'using FTDI serial to program my board and I connected GPS TX to PA3 (RX2) and GPS RX to PA2 (TX2). When I open the serial monitor I can see only reversed question marks. This is the code I'm using:
Code: Select all
void setup() {
Serial1.begin(57600);
//gps_setup();
}
void loop() {
Serial1.begin(57600);
gps_setup();
delay(200);
}
void gps_setup(void) {
Serial1.begin(9600);
delay(250);
//Disable GPGSV messages by using the ublox protocol.
uint8_t Disable_GPGSV[11] = {0xB5, 0x62, 0x06, 0x01, 0x03, 0x00, 0xF0, 0x03, 0x00, 0xFD, 0x15};
Serial1.write(Disable_GPGSV, 11);
delay(200); //A small delay is added to give the GPS some time to respond @ 9600bps.
//Set the refresh rate to 5Hz by using the ublox protocol.
uint8_t Set_to_5Hz[14] = {0xB5, 0x62, 0x06, 0x08, 0x06, 0x00, 0xC8, 0x00, 0x01, 0x00, 0x01, 0x00, 0xDE, 0x6A};
Serial1.write(Set_to_5Hz, 14);
delay(200); //A small delay is added to give the GPS some time to respond @ 9600bps.
//Set the baud rate to 57.6kbps by using the ublox protocol.
uint8_t Set_to_57kbps[28] = {0xB5, 0x62, 0x06, 0x00, 0x14, 0x00, 0x01, 0x00, 0x00, 0x00, 0xD0, 0x08, 0x00, 0x00,
0x00, 0xE1, 0x00, 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE2, 0xE1
};
Serial1.write(Set_to_57kbps, 28);
delay(200);
Serial1.begin(57600);
delay(200);
}
- I tried changing Serial1 with Serial2 but in this case nothing appears on serial monitor. Actually Serial1 should be the right serial for TX2 and RX2 as I read.
- I've tested GPS module with U-center and it works.
- I changed also boud rate to 9600 for GPS module from U-center but it still not work.
- Read every kind of discussion about this argument...
Is it possible TX2 and RX2 have to be enable before using them? And do you know how from FTDI serial adapter?
Thank you all!