Problem using IBusBM with Nano EVERY

I am trying to get data from the iBus on the FS-i6X to my Arduino Nano Every. The Library I am using is the IBusBM library. Here is the code:

[code]
#include <IBusBM.h>
 
// Create iBus Object
IBusBM ibus;



//HardwareSerial& ibusRcSerial = Serial1;
//HardwareSerial& debugSerial = Serial;


// Read the number of a given channel and convert to the range provided.
// If the channel is off, return the default value
int readChannel(byte channelInput, int minLimit, int maxLimit, int defaultValue) {
  uint16_t ch = ibus.readChannel(channelInput);
  if (ch < 100) return defaultValue;
  return map(ch, 1000, 2000, minLimit, maxLimit);
}
 
// Read the channel and return a boolean value
bool readSwitch(byte channelInput, bool defaultValue) {
  int intDefaultValue = (defaultValue) ? 100 : 0;
  int ch = readChannel(channelInput, 0, 100, intDefaultValue);
  return (ch > 50);
}
 
void setup() {
  // Start serial monitor
  //debugSerial.begin(115200);
  Serial.begin(115200);
  //Serial1.begin(115200);
  // Attach iBus object to serial port
  ibus.begin(Serial1);
}
 
void loop() {
 
  // Cycle through first 5 channels and determine values
  // Print values to serial monitor
  // Note IBusBM library labels channels starting with "0"
 
  for (byte i = 0; i < 5; i++) {
    int value = readChannel(i, -100, 100, 0);
    Serial.print("Ch");
    Serial.print(i + 1);
    Serial.print(": ");
    Serial.print(value);
    Serial.print(" | ");
  }
 
  // Print channel 6 (switch) boolean value
  Serial.print("Ch6: ");
  Serial.print(readSwitch(5, false));
  Serial.println();
 
  delay(10);
}
[/code]

I know I wired it up properly and the error I am getting is actually not related to the wiring. The error I am getting in the code, is that is says 'no matching function for call to 'IBusBM::begin(UartClass&)'. I know the version of the library I am using is compatible with megaAvr architecture and as far as I know, pin D1 on the Nano EVERY is Serial1. I don't know how to fix this issue. Here is the full error message:

Arduino: 1.8.13 (Windows 10), Board: "Arduino Nano Every, None (ATMEGA4809)"


WARNING: library IBusBM claims to run on avr, esp32, stm32, mbed architecture(s) and may be incompatible with your current board which runs on megaavr architecture(s).

In file included from C:\Users\Burak-as-user\Documents\Arduino\sketch_dec03b\sketch_dec03b.ino:1:0:

C:\Users\Burak-as-user\Documents\Arduino\libraries\IBusBM\src/IBusBM.h:45:14: error: reference to 'HardwareSerial' is ambiguous

   void begin(HardwareSerial &serial, int8_t timerid=0, int8_t rxPin=-1, int8_t txPin=-1);

              ^~~~~~~~~~~~~~

C:\Users\Burak-as-user\Documents\Arduino\libraries\IBusBM\src/IBusBM.h:38:7: note: candidates are: class HardwareSerial

 class HardwareSerial;

       ^~~~~~~~~~~~~~

In file included from C:\Users\Burak-as-user\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\cores\arduino/UART.h:27:0,

                 from C:\Users\Burak-as-user\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\cores\arduino/Arduino.h:140,

                 from sketch\sketch_dec03b.ino.cpp:1:

C:\Users\Burak-as-user\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\cores\arduino/api/HardwareSerial.h:87:7: note:                 class arduino::HardwareSerial

 class HardwareSerial : public Stream

       ^~~~~~~~~~~~~~

In file included from C:\Users\Burak-as-user\Documents\Arduino\sketch_dec03b\sketch_dec03b.ino:1:0:

C:\Users\Burak-as-user\Documents\Arduino\libraries\IBusBM\src/IBusBM.h:45:14: error: 'HardwareSerial' has not been declared

   void begin(HardwareSerial &serial, int8_t timerid=0, int8_t rxPin=-1, int8_t txPin=-1);

              ^~~~~~~~~~~~~~

C:\Users\Burak-as-user\Documents\Arduino\libraries\IBusBM\src/IBusBM.h:70:3: error: reference to 'HardwareSerial' is ambiguous

   HardwareSerial *stream;           // serial port

   ^~~~~~~~~~~~~~

C:\Users\Burak-as-user\Documents\Arduino\libraries\IBusBM\src/IBusBM.h:38:7: note: candidates are: class HardwareSerial

 class HardwareSerial;

       ^~~~~~~~~~~~~~

In file included from C:\Users\Burak-as-user\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\cores\arduino/UART.h:27:0,

                 from C:\Users\Burak-as-user\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\cores\arduino/Arduino.h:140,

                 from sketch\sketch_dec03b.ino.cpp:1:

C:\Users\Burak-as-user\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\cores\arduino/api/HardwareSerial.h:87:7: note:                 class arduino::HardwareSerial

 class HardwareSerial : public Stream

       ^~~~~~~~~~~~~~

C:\Users\Burak-as-user\Documents\Arduino\sketch_dec03b\sketch_dec03b.ino: In function 'void setup()':

sketch_dec03b:33:21: error: no matching function for call to 'IBusBM::begin(UartClass&)'

   ibus.begin(Serial1);

                     ^

In file included from C:\Users\Burak-as-user\Documents\Arduino\sketch_dec03b\sketch_dec03b.ino:1:0:

C:\Users\Burak-as-user\Documents\Arduino\libraries\IBusBM\src/IBusBM.h:45:8: note: candidate: void IBusBM::begin(int&, int8_t, int8_t, int8_t)

   void begin(HardwareSerial &serial, int8_t timerid=0, int8_t rxPin=-1, int8_t txPin=-1);

        ^~~~~

C:\Users\Burak-as-user\Documents\Arduino\libraries\IBusBM\src/IBusBM.h:45:8: note:   no known conversion for argument 1 from 'UartClass' to 'int&'

Multiple libraries were found for "IBusBM.h"

 Used: C:\Users\Burak-as-user\Documents\Arduino\libraries\IBusBM

 Not used: C:\Users\Burak-as-user\Documents\Arduino\libraries\IBusBM-1.1.5

exit status 1

no matching function for call to 'IBusBM::begin(UartClass&)'



This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

What am I doing wrong? Is there something I am missing?
Thanks.

Post a GitHub link to that library.

Multiple libraries were found for "IBusBM.h"

Used: C:\Users\Burak-as-user\Documents\Arduino\libraries\IBusBM

Not used: C:\Users\Burak-as-user\Documents\Arduino\libraries\IBusBM-1.1.5

What is the situation with the two libraries?

I haven't worked through the details, but the code compiles with MegaCoreX set for the Nano Every.

I think the answer to the issue lies somewhere in the difference between the two cores (MegaCoreX, megaavr) and how Serial1 is defined.

I downloaded the IBusBM library from the Library Manager in the Arduino IDE. And I downloaded IBusBM-1.1.5 library from GitHub. However I downloaded version 1.1.5 because someone online said an older version worked for them (not for me).

Even if it works for MegaCoreX. How would you install the MegaCoreX and change the Arduino IDE accordingly, so that it runs MegaCoreX instead of megaavr.

Available through the Boards Manager.

and

Not used: C:\Users\Burak-as-user\Documents\Arduino\libraries\IBusBM-1.1.5

Find and remove the library it is using that you don't want it to be. Using.

a7

I couldn't find it in the Boards Manager. Could I get it from somewhere else?

Also, it still gives the error message when I use either library.

https://github.com/MCUdude/MegaCoreX#boards-manager-installation

What programmer did you use for the MegaCoreX?

The Nano Every does not really require a special programmer. It uses a 1200 bps touch pulse to place the SAMD11 chip into a programming mode. Just press "Upload" in the IDE.

Make certain to select the Nano Every pinout. In Tools under programmer select JTAG2UPDI but it doesn't seem to matter.

Okay, I got it to upload but when I open the Serial Monitor there's no data (Just to make sure the code works, I ran the program on an Arduino Mega, because it has multiple serial pins. And it worked.) I am confused on why.

I have no direct experience with the IBusBM Library or the Flysky, but
I have been looking at the library source code, and don't understand the Timer issues involved with the library.

It's not clear to me that the Nano Every timers (which are very different from the avr timers like in the Mega) are accommodated and you may need to run with IBUSBM_NOTIMER. See the library Read Me.

Try these modifications to the code you have

//ibus.begin(Serial1);
ibus.begin(Serial1,IBUSBM_NOTIMER);

Then as the first line of loop() add this line which will call the readings manually instead of from the timer interrupt.
ibus.loop();

Once I did the modifications to the code, it worked! Thanks so much!

Great news. We probably should have looked at the closed issues in the Library bug reports sooner.

https://github.com/bmellink/IBusBM/issues/16

This issue link seems to cover both the failure to compile and the Timer issue.

Yeah, your right. Thank you again for your help.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.