I had the bad idea to buy 6 Arduino Nano Every

Issue #56 closed
Luca D. created an issue

Tested a sketch with your library with Arduino Uno and Arduino Nano, but I had a bad idea to buy 6 Arduino Nano Every and I got error compiling.
I'm not a programmer, so I'm not able to help find the problem.
Can you help me? I'll attach my sketch and error log.

Thanks in advance, Luca

P.S.
Actually, I'm going to buy some cheap Chinese Arduino Nano clone.
Later, if possible, I want to be able to use the Nano Every.

Comments (5)

  1. Tim Eckel repo owner

    Seems the microcontroller used in that board doesn’t support the timers.

    Please see https://bitbucket.org/teckel12/arduino-new-ping/wiki/Home for a list of compatible microcontrollers:

    Arduino Uno, Mega, Mega 2560, Leonardo, Micro, Mini, Nano, Pro, Pro Mini, Fio, Mega ADK, Ethernet, Robot, Bluetooth, Yún, Lilypad, Duemilanove, Diecimila, Teensy 1.x, Teensy 2.x, Teensy 3.x, Particle Photon, Particle Electron?, ATmega328, ATmega168, ATmega8, ATmega16, ATmega32, ATmega8535

    It may be possible for the Arduino Nano Every’s microcontroller to be made compatible, but it would need to be added to the NewPing.h file in the 209-215 line range. I don’t have the one of these boards to test however.

  2. Jan Geurts

    @Tim Eckel I’d be glad to test in whatever way possible, I have a few Arduino Nano Every boards in my posession as well. I can even provide you a remote accessible system so you can test if needed (using TeamViewer or AnyDesk). I’m a basic programmer, but after spending a few hours looking into defining the AVR atMega4809 myself, I find myself lost in the woods of microcontroller datasheets and your source code. Also, it’d be best that a ‘real’ programmer makes the necessary adjustments to your code.

    Also, I am prepared to donate a small amount in return for your work on this if we get it working. It’d be really sad to have to switch back to the older Nano-boards jut because of the (seemingly) incompatible timer registers right now.

    So, to progress with this, I’d love to hear what you need from me?

    What I’ve found so far, is that the definition of the atMega4809 should be :

    __AVR_ATmega4809__
    

    Not sure how to define the timers, though…
    Would posting the compilation log of my simple ultrasound script (using your library) help with revealing what pins/registers need to be defined?

  3. Jan Geurts

    @Tim Eckel Update:

    I modified the NewPing.h in the following way :

    Added the Arduino Nano Every to be included on line 190

    #if (defined (__arm__) && (defined (TEENSYDUINO) || defined (PARTICLE) || defined(AVR_NANO_EVERY)))
    

    Added the ATmega4809 to be included on line 209

    #if defined (__AVR_ATmega128__) || defined (__AVR_ATtiny24__) || defined (__AVR_ATtiny44__) || defined (__AVR_ATtiny441__) || defined (__AVR_ATtiny84__) || defined (__AVR_ATtiny841__) || defined (__AVR_ATtiny25__) || defined (__AVR_ATtiny45__) || defined (__AVR_ATtiny85__) || defined (__AVR_ATtiny261__) || defined (__AVR_ATtiny461__) || defined (__AVR_ATtiny861__) || defined (__AVR_ATtiny43U__)  || defined(__AVR_ATmega4809__)
    

    This seems to compile just fine, upload AND measure. But I’m wondering if the functionality is less with the disabling of the timer? Since the Atmega4809 has the same (and more) functionality as the regular nano with the 328p, I imagine there should indeed be a way to use the timer with this chip as well.

    Will the results of a non-timer-enabled measurement differ from a timer-enabled one?

  4. Tim Eckel repo owner

    While this may work, I don’t think the changes are technically correct.

    The change in line 190 is for ARM-based microcontrollers, which I don’t believe the Arduino Nano Every is. So this change probably does nothing. I’d bet if you remove it, it would still compile.

    The change in 209 disables the timer functions. Which is fine if it doesn’t have timers. Instead, it may need to be added to line 215 or a new section specific to the Arduino Nano Every created if it has unique timer identifiers.

    All you’re doing is disabling functions which use timers. If you’re not using those functions, it doesn’t make a bit of difference. If you just want to disable the timers, the proper way is to change the setting in line 170 to:

    #define TIMER_ENABLED false

    The other things you’re doing are just doing that, but in an untested and improper way.

  5. Log in to comment