I am, after a long time on this problem, again desperate and asking for your help..
Im working with Neo n8m GPS with board STM32F411CE and I cannot figure out, how to communicate via Serial2 o pins RX PA3 and TX PA2. If I wont be able to figure this out, I might try to switch to Serial1 pins, but I have different sensors on them now with I2C and this should be pretty easy, but I guess it is not..
After a lot of trying, now Im currently trying communicating from PC to the board with USB. The code is simple:
Code: Select all
HardwareSerial Serial2(PA3,PA2);
void setup() {
Serial2.begin(115200);
Serial.begin(115200);
}
void loop() {
if (Serial2.available()) {
byte inByte = Serial2.read();
Serial.println("OK"+String(inByte));
}
else {Serial.println("NO");}
delay(1000);
}
I've run it thru logic analyser and everything is working fine, just the Serial2 isnt printing..
I red a lot about build flags, but this should be simple as it is..
Would appreciate any help. Thank you.