Compile error for board Generic STM32F4 series.

Post here first, or if you can't find a relevant section!
Post Reply
nawasaqi
Posts: 20
Joined: Wed Dec 22, 2021 7:06 pm

Compile error for board Generic STM32F4 series.

Post by nawasaqi »

Hi to all,
I have such a problem. I bought a new computer and installed Arduino on it and I would like to compile with Serial, I have an error

c:/users/backu/appdata/local/arduino15/packages/stmicroelectronics/tools/xpack-arm-none-eabi-gcc/10.3.1-2.3/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: core\core.a(HardwareSerial.cpp.o):(.bss.Serial2+0x0): multiple definition of `Serial2'; sketch\iBus.ino.cpp.o:(.bss.Serial2+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
exit status 1
Compile error for board Generic STM32F4 series.

Code: Select all

#include <IBusBM.h>


IBusBM IBusServo;

HardwareSerial Serial2 (PA3, PA2); 

  
void setup() {
  Serial.begin(115200);
  Serial2.begin(115200);
  IBusServo.begin(Serial2);

}

void loop() {
  ibusServo();

}
//
//
//

void ibusServo()
{
 // show first 14 servo channels
  for (int i=0; i<14 ; i++) {
    Serial.print("Ch");
    Serial.print(i);
    Serial.print(": ");
    Serial.print(IBusServo.readChannel(i));
    Serial.print(" ---- ");

  }
 Serial.println("Next");

  delay(2000);
}
Can anyone help me what am I doing wrong ??
ag123
Posts: 1678
Joined: Thu Dec 19, 2019 5:30 am
Answers: 25

Re: Compile error for board Generic STM32F4 series.

Post by ag123 »

Serial2 may already be there, trying commenting the definition and rebuild

https://github.com/stm32duino/wiki/wiki ... wareserial
User avatar
fpiSTM
Posts: 1760
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: Compile error for board Generic STM32F4 series.

Post by fpiSTM »

Serial is an alias to a default Serialx instance. In your case, it is probably Serial2 by default. So change the name you used and check that PA2 and 3 is not the one used by the default one. Which variant you used?
Post Reply

Return to “General discussion”