07:26:42.600 -> Done setting HC06, turn off development board now
so it flashed to hc-06.
...
You can check whether or not it flashed the HC-06 if the Bluetooth device name has changed, and I assume in your case it didn't.
Every time you run the program, you must check for a proper response from the HC-06 module (
a string beginning with "Response=...").
As I wrote above,
read the code. If you run the sketch as-is, it will fail because it assumes the HC-06 is already set at 115200, you have to change the line
Serial2.begin(115200); // serial to Bluetooth module
to
Serial2.begin(9600); // serial to Bluetooth module
and then set the Bluetooth interface name.
In a second step, you have to comment out the name setting part and uncomment the baud rate part.
Also note that once you have changed the baudrate to 115200, the program itself must be modified again since the HC-06 baudrate will be 115200.
Yes, it's a bit of a chicken and egg problem,
// Very short program just used to configure HC-06 Bluetooth modules
// for name and baud rate, using AT commands
HardwareSerial Serial2(PA3, PA2); // Serial to Bluetooth module
void setup() {
// put your setup code here, to run once:
Serial1.begin(9600); // serial to GPS module
Serial2.begin(115200); // serial to Bluetooth module
Serial.begin(115200); // USB serial
Serial.print(F("Check HC-06 module version, set baud rate to 115200 and rename to GPSDO1"));
Serial.println();
// check module version
Serial2.println("AT+VERSION"); // module should answer with HC06 version
delay(1500);
if (Serial2.available()) Serial.println("Response="+Serial2.readString());
// change BT module name
Serial2.println("AT+NAMEGPSDO1"); // change 1 to 2 or 3 or etc
delay(1500);
if (Serial2.available()) Serial.println("Response="+Serial2.readString());
// Change BT module baud rate (default is 9600)
// Serial2.println("AT+BAUD8"); // 8=115200
// delay(1500);
// if (Serial2.available()) Serial.println("Response="+Serial2.readString());
}
void loop() {
// put your main code here, to run repeatedly:
Serial.println("Done setting HC06, turn off development board now");
delay(5000);
}