Page 1 of 1

Compile error for board Generic STM32F4 series.

Posted: Tue May 03, 2022 9:29 am
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 ??

Re: Compile error for board Generic STM32F4 series.

Posted: Tue May 03, 2022 9:47 am
by ag123
Serial2 may already be there, trying commenting the definition and rebuild

https://github.com/stm32duino/wiki/wiki ... wareserial

Re: Compile error for board Generic STM32F4 series.

Posted: Tue May 03, 2022 10:38 am
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?