GithubHelp home page GithubHelp logo

Comments (12)

bmellink avatar bmellink commented on August 25, 2024

I just made a small change to support MegaAVR. I do not have a board, so I can't test it, but it should compile now. Can you please test it? Please note the timer function is not supported, so you should use IBUSBM_NOTIMER and call the iBus.loop() yourself.

from ibusbm.

haruss77 avatar haruss77 commented on August 25, 2024

Hello Bart
Wow that was fast...
Unfortunately there are still ERRORS while compiling... (see below). I have to say that I am not that skilled in programming... Sorry. I hope the ERROR messages make sense for you..

BR

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

C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\bless\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\bless\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\bless\Documents\Arduino\libraries -fqbn=arduino:megaavr:nona4809:mode=off -vid-pid=2341_0058 -ide-version=10813 -build-path C:\Users\bless\AppData\Local\Temp\arduino_build_780594 -warnings=none -build-cache C:\Users\bless\AppData\Local\Temp\arduino_cache_779495 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=C:\Users\bless\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17 -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Users\bless\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17 -prefs=runtime.tools.arduinoOTA.path=C:\Users\bless\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Users\bless\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.avr-gcc.path=C:\Users\bless\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5 -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino5.path=C:\Users\bless\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5 -verbose C:\Users\bless\Documents\Arduino\FlySky\TraktorTest\TraktorTest.ino

C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\bless\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\bless\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\bless\Documents\Arduino\libraries -fqbn=arduino:megaavr:nona4809:mode=off -vid-pid=2341_0058 -ide-version=10813 -build-path C:\Users\bless\AppData\Local\Temp\arduino_build_780594 -warnings=none -build-cache C:\Users\bless\AppData\Local\Temp\arduino_cache_779495 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=C:\Users\bless\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17 -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Users\bless\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17 -prefs=runtime.tools.arduinoOTA.path=C:\Users\bless\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Users\bless\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.avr-gcc.path=C:\Users\bless\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5 -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino5.path=C:\Users\bless\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5 -verbose C:\Users\bless\Documents\Arduino\FlySky\TraktorTest\TraktorTest.ino

Using board 'nona4809' from platform in folder: C:\Users\bless\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.6

Using core 'arduino' from platform in folder: C:\Users\bless\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.6

Detecting libraries used...

"C:\Users\bless\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega4809 -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_NANO_EVERY -DARDUINO_ARCH_MEGAAVR -DMILLIS_USE_TIMERB3 -DNO_EXTERNAL_I2C_PULLUP "-IC:\Users\bless\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.6\cores\arduino/api/deprecated" "-IC:\Users\bless\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.6\cores\arduino" "-IC:\Users\bless\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.6\variants\nona4809" "C:\Users\bless\AppData\Local\Temp\arduino_build_780594\sketch\TraktorTest.ino.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE

Alternatives for IBusBM.h: [[email protected]]

ResolveLibrary(IBusBM.h)

-> candidates: [[email protected]]

"C:\Users\bless\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega4809 -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_NANO_EVERY -DARDUINO_ARCH_MEGAAVR -DMILLIS_USE_TIMERB3 -DNO_EXTERNAL_I2C_PULLUP "-IC:\Users\bless\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.6\cores\arduino/api/deprecated" "-IC:\Users\bless\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.6\cores\arduino" "-IC:\Users\bless\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.6\variants\nona4809" "-IC:\Users\bless\Documents\Arduino\libraries\IBusBM\src" "C:\Users\bless\AppData\Local\Temp\arduino_build_780594\sketch\TraktorTest.ino.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE

"C:\Users\bless\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega4809 -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_NANO_EVERY -DARDUINO_ARCH_MEGAAVR -DMILLIS_USE_TIMERB3 -DNO_EXTERNAL_I2C_PULLUP "-IC:\Users\bless\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.6\cores\arduino/api/deprecated" "-IC:\Users\bless\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.6\cores\arduino" "-IC:\Users\bless\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.6\variants\nona4809" "-IC:\Users\bless\Documents\Arduino\libraries\IBusBM\src" "C:\Users\bless\Documents\Arduino\libraries\IBusBM\src\IBusBM.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE

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).

Generating function prototypes...

"C:\Users\bless\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega4809 -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_NANO_EVERY -DARDUINO_ARCH_MEGAAVR -DMILLIS_USE_TIMERB3 -DNO_EXTERNAL_I2C_PULLUP "-IC:\Users\bless\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.6\cores\arduino/api/deprecated" "-IC:\Users\bless\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.6\cores\arduino" "-IC:\Users\bless\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.6\variants\nona4809" "-IC:\Users\bless\Documents\Arduino\libraries\IBusBM\src" "C:\Users\bless\AppData\Local\Temp\arduino_build_780594\sketch\TraktorTest.ino.cpp" -o "C:\Users\bless\AppData\Local\Temp\arduino_build_780594\preproc\ctags_target_for_gcc_minus_e.cpp" -DARDUINO_LIB_DISCOVERY_PHASE

"C:\Program Files (x86)\Arduino\tools-builder\ctags\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\Users\bless\AppData\Local\Temp\arduino_build_780594\preproc\ctags_target_for_gcc_minus_e.cpp"

Compiling sketch...

"C:\Users\bless\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega4809 -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_NANO_EVERY -DARDUINO_ARCH_MEGAAVR -DMILLIS_USE_TIMERB3 -DNO_EXTERNAL_I2C_PULLUP "-IC:\Users\bless\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.6\cores\arduino/api/deprecated" "-IC:\Users\bless\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.6\cores\arduino" "-IC:\Users\bless\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.6\variants\nona4809" "-IC:\Users\bless\Documents\Arduino\libraries\IBusBM\src" "C:\Users\bless\AppData\Local\Temp\arduino_build_780594\sketch\TraktorTest.ino.cpp" -o "C:\Users\bless\AppData\Local\Temp\arduino_build_780594\sketch\TraktorTest.ino.cpp.o"

In file included from C:\Users\bless\Documents\Arduino\FlySky\TraktorTest\TraktorTest.ino:1:0:

C:\Users\bless\Documents\Arduino\libraries\IBusBM\src/IBusBM.h:43: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\bless\Documents\Arduino\libraries\IBusBM\src/IBusBM.h:36:7: note: candidates are: class HardwareSerial

class HardwareSerial;

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

In file included from C:\Users\bless\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.6\cores\arduino/api/ArduinoAPI.h:32:0,

             from C:\Users\bless\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.6\cores\arduino/Arduino.h:23,

             from C:\Users\bless\AppData\Local\Temp\arduino_build_780594\sketch\TraktorTest.ino.cpp:1:

C:\Users\bless\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.6\cores\arduino/api/HardwareSerial.h:87:7: note: class arduino::HardwareSerial

class HardwareSerial : public Stream

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

In file included from C:\Users\bless\Documents\Arduino\FlySky\TraktorTest\TraktorTest.ino:1:0:

C:\Users\bless\Documents\Arduino\libraries\IBusBM\src/IBusBM.h:43: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\bless\Documents\Arduino\libraries\IBusBM\src/IBusBM.h:68:3: error: reference to 'HardwareSerial' is ambiguous

HardwareSerial *stream; // serial port

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

C:\Users\bless\Documents\Arduino\libraries\IBusBM\src/IBusBM.h:36:7: note: candidates are: class HardwareSerial

class HardwareSerial;

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

In file included from C:\Users\bless\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.6\cores\arduino/api/ArduinoAPI.h:32:0,

             from C:\Users\bless\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.6\cores\arduino/Arduino.h:23,

             from C:\Users\bless\AppData\Local\Temp\arduino_build_780594\sketch\TraktorTest.ino.cpp:1:

C:\Users\bless\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.6\cores\arduino/api/HardwareSerial.h:87:7: note: class arduino::HardwareSerial

class HardwareSerial : public Stream

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

C:\Users\bless\Documents\Arduino\FlySky\TraktorTest\TraktorTest.ino: In function 'void setup()':

TraktorTest:19:25: error: no matching function for call to 'IBusBM::begin(UartClass&)'

IBusServo.begin(Serial);

                     ^

In file included from C:\Users\bless\Documents\Arduino\FlySky\TraktorTest\TraktorTest.ino:1:0:

C:\Users\bless\Documents\Arduino\libraries\IBusBM\src/IBusBM.h:43: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\bless\Documents\Arduino\libraries\IBusBM\src/IBusBM.h:43:8: note: no known conversion for argument 1 from 'UartClass' to 'int&'

Using library IBusBM at version 1.1.4 in folder: C:\Users\bless\Documents\Arduino\libraries\IBusBM

exit status 1

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

from ibusbm.

bmellink avatar bmellink commented on August 25, 2024

The error error: reference to 'HardwareSerial' is ambiguous means you are still using the original IBusBM.h

Are you sure you replaced all changed files with the versions I changed? The files that I changed are: IBusBM.h, IBusBM.cpp and library.properties. They are located on your computer in:
C:\Users\bless\Documents\Arduino\libraries\IBusBM\
and
C:\Users\bless\Documents\Arduino\libraries\IBusBM\src
Once you replaced the files with the ones from github you need to restart the Arduino environment (exit/start Arduino) so Arduino checks the library property files. This should get rid of the error:
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).

from ibusbm.

haruss77 avatar haruss77 commented on August 25, 2024

Hello Bart

Of course I did not update them in the mentioned directory ;-). In the Arduino-SW I went just to Tools/Manage Libraries and updated the IBusBM.h. That was not enough...

The program can now be compiled, having only one red entry left in the bottom status window.
avrdude: jtagmkII_initialize(): Cannot locate "flash" and "boot" memories in description

I changed one of your examples "Ibus_multimonitor" so that it works with my old nano. It works fine with the old one. Fine means that I get values from different channels of the RC-receiver. But the very same program wont work for the nano every. Not a single value is received from the RC-receiver... (program see zip-file attached)
Ibus_multimonitor_Nano-adjust.zip

from ibusbm.

bmellink avatar bmellink commented on August 25, 2024

As indicated in my first answer: The timer function is not supported, so you should use IBUSBM_NOTIMER and call the iBus.loop() yourself from within loop(). See the readme for how that is done.

from ibusbm.

haruss77 avatar haruss77 commented on August 25, 2024

Hello Bart
I tried it without success so far. I dont get any values from the nano every. Same code with my old nano works perfect. Due to my limited programming-knowledge it is most likely a programming / syntax error.
It would be great if you could have a look at it (see ZIP-file attached)
BR
Ibus_multimonitor_Nano-adjust (2).zip

from ibusbm.

bmellink avatar bmellink commented on August 25, 2024

Your loop() does not call the IBusServo.loop() function every millisecond. You can try the following code to make this work:

void loop() {
  int cnt=0;
  while (1) {
    IBusServo.loop(); // ensure we call the loop every millisecond
    delay(1);
    if (cnt++ > 500) {
      // do something else once every 500 ms
      cnt=0;    
      int val=0;
      // show first 8 servo channels
      for (int i=0; i<8 ; i++) {
        // call internal loop function to update the communication to the receiver 
        val = IBusServo.readChannel(i);
        Serial.print(val);
        Serial.print(" ");
      }
      Serial.print("Cnt=");
      Serial.print(IBusServo.cnt_rec); // count of how many times servo values have been updated
      Serial.print(" POLL=");
      Serial.print(IBusSensor.cnt_poll); // count of polling for sensor existance
      Serial.print(" Sensor=");
      Serial.println(IBusSensor.cnt_sensor); // count of polling for sensor value
    }
  }
}

from ibusbm.

haruss77 avatar haruss77 commented on August 25, 2024

Hello Bart

Still the same. Your code works fine with the old nano but not with the nanao every. The wireing is the same at both nanos. RX0 is used for the IBUS connection.

from ibusbm.

haruss77 avatar haruss77 commented on August 25, 2024

Forgot to attach the code...
Ibus_multimonitor_Nano-adjust_Bart.zip

from ibusbm.

bmellink avatar bmellink commented on August 25, 2024

Just see another thing: I think you are using the wrong serial port in setup():

// iBUS setup
  IBusServo.begin(Serial, IBUSBM_NOTIMER);

The EVERY uses Serial for talking to the USB and Serial1 for talking to your RX/TX pins. Can you try changing the line in setup() to

// iBUS setup
  IBusServo.begin(Serial1, IBUSBM_NOTIMER);

from ibusbm.

bmellink avatar bmellink commented on August 25, 2024

If this works, you can actually also enable Serial2 for sending sensor data back to your controller. The Arduino Nano EVERY is based on the AVR 4809 processor. This processor has 4 hardware UART ports.

The standard Arduino libraries only have 2 ports enabled: serial through the USB port and serial1 through
pins TX/RX pins. This article https://forum.arduino.cc/index.php?topic=639740.0 describes a way to change
the core library routines to also enable serial2 and serial3. This allows you to provide both
servo output and sensor input using a single small sized Arduino module. Please note if you start doing this, you should repeat this change each time you let Arduino update the core libraries.

from ibusbm.

haruss77 avatar haruss77 commented on August 25, 2024

Whohooo! Heureka! :-)

What a big difference a little number can make.

Thank you Bart for your strong support...

from ibusbm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.