Hi ,
I am working on p2p with Rak3172-E modules. I am trying to transmit the data coming from the host MCU to the module on the opposite side with Rak3172-E and read the data coming from the host MCU there. This is my general purpose, but I have some problems, I thought maybe friends who have experienced this problem before can help.
I tested the Ardunio.serial example without making any changes in the setup and it worked. It took the data I entered through any serial program and printed it on the serial screen. However, in the same code, when I deleted the places I marked in yellow in the setup and tried to load the code, I got the message "Detecting baudrate…
I get the error “Detect baudrate fail, can’t get the baudrate” and to upload the code again, I first upload the .hex file with the stm32 programmer and then I can upload the new code again.
I get the same errors when I load a code like the one below. Is there something I missed? By the way, I use usart1 pins with the host mcu.
#define BUFFER_SIZE 128
char buffer[BUFFER_SIZE];
int bufferIndex = 0;
void setup() {
Serial1.begin(115200);
Serial.begin(115200);
}
void loop() {
while (Serial1.available() > 0) {
Serial.println("UART Veri Alimi Basladi");
char receivedChar = Serial1.read();
if (bufferIndex < BUFFER_SIZE - 1) {
buffer[bufferIndex++] = receivedChar;
buffer[bufferIndex] = '\0';
} else {
Serial.println("Tampon dolu, veri kaybedildi!");
bufferIndex = 0;
}
if (receivedChar == '\r') {
Serial.println("Gelen Veri: ");
Serial.println(buffer);
bufferIndex = 0; //
}
}
}