Compile error for Pro Mini 5,5v 168



  • Hello,

    I recently updated from 2.0.0 to 2.1.0 and ever since I can no longer compile the same sketch, and I see a stack trace.

    I tried compiling the exact same sketch for another board (nano) and I don't have the problem. In fact, when I select the pro mini but with the Atmega328, it also compiles, just not with the atmega168


  • Mod

    @xelnaha the information in the stack trace will be the key to figuring out what is wrong. Please read it / post it.



  • I tested it with 2.0.0 and no errors, same sketch with 2.1.0 gives me this:

    Arduino: 1.8.0 (Mac OS X), Board: "Arduino Pro or Pro Mini, ATmega168 (5V, 16 MHz)"

    Build options changed, rebuilding all
    In file included from sketch/BinarySwitchSleepSensor.ino.cpp:1:0:
    /Users/user/Documents/Arduino/libraries/MySensors/drivers/RF24/RF24.cpp: In function 'void RF24_csn(bool)':
    /Users/user/Documents/Arduino/libraries/MySensors/drivers/AVR/DigitalWriteFast/digitalWriteFast.h:88:152: error: '__digitalPinToPortReg' was not declared in this scope
    #define digitalWriteFast(__pin, __value) do { if (__builtin_constant_p(__pin) && __builtin_constant_p(__value)) { bitWrite(__digitalPinToPortReg(__pin), (uint8_t)__digitalPinToBit(__pin), (__value)); } else { digitalWrite((__pin), (__value)); } } while (0)
    ^
    /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/Arduino.h:112:30: note: in definition of macro 'bitSet'
    #define bitSet(value, bit) ((value) |= (1UL << (bit)))
    ^
    /Users/user/Documents/Arduino/libraries/MySensors/drivers/AVR/DigitalWriteFast/digitalWriteFast.h:88:115: note: in expansion of macro 'bitWrite'
    #define digitalWriteFast(__pin, __value) do { if (__builtin_constant_p(__pin) && __builtin_constant_p(__value)) { bitWrite(
    __digitalPinToPortReg(__pin), (uint8_t)__digitalPinToBit(__pin), (__value)); } else { digitalWrite((__pin), (__value)); } } while (0)
    ^
    /Users/user/Documents/Arduino/libraries/MySensors/core/MyHwATMega328.h:62:40: note: in expansion of macro 'digitalWriteFast'
    #define hwDigitalWrite(__pin, __value) digitalWriteFast(__pin, __value)
    ^
    /Users/user/Documents/Arduino/libraries/MySensors/drivers/RF24/RF24.cpp:39:2: note: in expansion of macro 'hwDigitalWrite'
    hwDigitalWrite(MY_RF24_CS_PIN, level);
    ^
    /Users/user/Documents/Arduino/libraries/MySensors/drivers/AVR/DigitalWriteFast/digitalWriteFast.h:88:187: error: '__digitalPinToBit' was not declared in this scope
    #define digitalWriteFast(__pin, __value) do { if (__builtin_constant_p(__pin) && __builtin_constant_p(__value)) { bitWrite(__digitalPinToPortReg(__pin), (uint8_t)__digitalPinToBit(__pin), (__value)); } else { digitalWrite((__pin), (__value)); } } while (0)
    ^
    /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/Arduino.h:112:49: note: in definition of macro 'bitSet'
    #define bitSet(value, bit) ((value) |= (1UL << (bit)))
    ^
    /Users/user/Documents/Arduino/libraries/MySensors/drivers/AVR/DigitalWriteFast/digitalWriteFast.h:88:115: note: in expansion of macro 'bitWrite'
    #define digitalWriteFast(__pin, __value) do { if (__builtin_constant_p(__pin) && __builtin_constant_p(__value)) { bitWrite(
    __digitalPinToPortReg(__pin), (uint8_t)__digitalPinToBit(__pin), (__value)); } else { digitalWrite((__pin), (__value)); } } while (0)
    ^
    /Users/user/Documents/Arduino/libraries/MySensors/core/MyHwATMega328.h:62:40: note: in expansion of macro 'digitalWriteFast'
    #define hwDigitalWrite(__pin, __value) digitalWriteFast(__pin, __value)
    ^
    /Users/user/Documents/Arduino/libraries/MySensors/drivers/RF24/RF24.cpp:39:2: note: in expansion of macro 'hwDigitalWrite'
    hwDigitalWrite(MY_RF24_CS_PIN, level);
    ^
    /Users/user/Documents/Arduino/libraries/MySensors/drivers/RF24/RF24.cpp: In function 'void RF24_ce(bool)':
    /Users/user/Documents/Arduino/libraries/MySensors/drivers/AVR/DigitalWriteFast/digitalWriteFast.h:88:152: error: '__digitalPinToPortReg' was not declared in this scope
    #define digitalWriteFast(__pin, __value) do { if (__builtin_constant_p(__pin) && __builtin_constant_p(__value)) { bitWrite(__digitalPinToPortReg(__pin), (uint8_t)__digitalPinToBit(__pin), (__value)); } else { digitalWrite((__pin), (__value)); } } while (0)
    ^
    /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/Arduino.h:112:30: note: in definition of macro 'bitSet'
    #define bitSet(value, bit) ((value) |= (1UL << (bit)))
    ^
    /Users/user/Documents/Arduino/libraries/MySensors/drivers/AVR/DigitalWriteFast/digitalWriteFast.h:88:115: note: in expansion of macro 'bitWrite'
    #define digitalWriteFast(__pin, __value) do { if (__builtin_constant_p(__pin) && __builtin_constant_p(__value)) { bitWrite(
    __digitalPinToPortReg(__pin), (uint8_t)__digitalPinToBit(__pin), (__value)); } else { digitalWrite((__pin), (__value)); } } while (0)
    ^
    /Users/user/Documents/Arduino/libraries/MySensors/core/MyHwATMega328.h:62:40: note: in expansion of macro 'digitalWriteFast'
    #define hwDigitalWrite(__pin, __value) digitalWriteFast(__pin, __value)
    ^
    /Users/user/Documents/Arduino/libraries/MySensors/drivers/RF24/RF24.cpp:44:2: note: in expansion of macro 'hwDigitalWrite'
    hwDigitalWrite(MY_RF24_CE_PIN, level);
    ^
    /Users/user/Documents/Arduino/libraries/MySensors/drivers/AVR/DigitalWriteFast/digitalWriteFast.h:88:187: error: '__digitalPinToBit' was not declared in this scope
    #define digitalWriteFast(__pin, __value) do { if (__builtin_constant_p(__pin) && __builtin_constant_p(__value)) { bitWrite(__digitalPinToPortReg(__pin), (uint8_t)__digitalPinToBit(__pin), (__value)); } else { digitalWrite((__pin), (__value)); } } while (0)
    ^
    /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/Arduino.h:112:49: note: in definition of macro 'bitSet'
    #define bitSet(value, bit) ((value) |= (1UL << (bit)))
    ^
    /Users/user/Documents/Arduino/libraries/MySensors/drivers/AVR/DigitalWriteFast/digitalWriteFast.h:88:115: note: in expansion of macro 'bitWrite'
    #define digitalWriteFast(__pin, __value) do { if (__builtin_constant_p(__pin) && __builtin_constant_p(__value)) { bitWrite(
    __digitalPinToPortReg(__pin), (uint8_t)__digitalPinToBit(__pin), (__value)); } else { digitalWrite((__pin), (__value)); } } while (0)
    ^
    /Users/user/Documents/Arduino/libraries/MySensors/core/MyHwATMega328.h:62:40: note: in expansion of macro 'digitalWriteFast'
    #define hwDigitalWrite(__pin, __value) digitalWriteFast(__pin, __value)
    ^
    /Users/user/Documents/Arduino/libraries/MySensors/drivers/RF24/RF24.cpp:44:2: note: in expansion of macro 'hwDigitalWrite'
    hwDigitalWrite(MY_RF24_CE_PIN, level);
    ^
    /Users/user/Documents/Arduino/libraries/MySensors/drivers/RF24/RF24.cpp: In function 'bool RF24_initialize()':
    /Users/user/Documents/Arduino/libraries/MySensors/drivers/AVR/DigitalWriteFast/digitalWriteFast.h:91:170: error: '__digitalPinToDDRReg' was not declared in this scope
    #define pinModeFast(__pin, __mode) do { if (__builtin_constant_p(__pin) && __builtin_constant_p(__mode) && (__mode!=INPUT_PULLUP)) { bitWrite(__digitalPinToDDRReg(__pin), (uint8_t)__digitalPinToBit(__pin), (__mode)); } else { pinMode((__pin), (__mode)); } } while (0)
    ^
    /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/Arduino.h:112:30: note: in definition of macro 'bitSet'
    #define bitSet(value, bit) ((value) |= (1UL << (bit)))
    ^
    /Users/user/Documents/Arduino/libraries/MySensors/drivers/AVR/DigitalWriteFast/digitalWriteFast.h:91:134: note: in expansion of macro 'bitWrite'
    #define pinModeFast(__pin, __mode) do { if (__builtin_constant_p(__pin) && __builtin_constant_p(__mode) && (__mode!=INPUT_PULLUP)) { bitWrite(
    __digitalPinToDDRReg(__pin), (uint8_t)__digitalPinToBit(__pin), (__mode)); } else { pinMode((__pin), (__mode)); } } while (0)
    ^
    /Users/user/Documents/Arduino/libraries/MySensors/core/MyHwATMega328.h:64:35: note: in expansion of macro 'pinModeFast'
    #define hwPinMode(__pin, __value) pinModeFast(__pin, __value)
    ^
    /Users/user/Documents/Arduino/libraries/MySensors/drivers/RF24/RF24.cpp:388:2: note: in expansion of macro 'hwPinMode'
    hwPinMode(MY_RF24_CE_PIN,OUTPUT);
    ^
    /Users/user/Documents/Arduino/libraries/MySensors/drivers/AVR/DigitalWriteFast/digitalWriteFast.h:91:205: error: '__digitalPinToBit' was not declared in this scope
    #define pinModeFast(__pin, __mode) do { if (__builtin_constant_p(__pin) && __builtin_constant_p(__mode) && (__mode!=INPUT_PULLUP)) { bitWrite(__digitalPinToDDRReg(__pin), (uint8_t)__digitalPinToBit(__pin), (__mode)); } else { pinMode((__pin), (__mode)); } } while (0)
    ^
    /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/Arduino.h:112:49: note: in definition of macro 'bitSet'
    #define bitSet(value, bit) ((value) |= (1UL << (bit)))
    ^
    /Users/user/Documents/Arduino/libraries/MySensors/drivers/AVR/DigitalWriteFast/digitalWriteFast.h:91:134: note: in expansion of macro 'bitWrite'
    #define pinModeFast(__pin, __mode) do { if (__builtin_constant_p(__pin) && __builtin_constant_p(__mode) && (__mode!=INPUT_PULLUP)) { bitWrite(
    __digitalPinToDDRReg(__pin), (uint8_t)__digitalPinToBit(__pin), (__mode)); } else { pinMode((__pin), (__mode)); } } while (0)
    ^
    /Users/user/Documents/Arduino/libraries/MySensors/core/MyHwATMega328.h:64:35: note: in expansion of macro 'pinModeFast'
    #define hwPinMode(__pin, __value) pinModeFast(__pin, __value)
    ^
    /Users/user/Documents/Arduino/libraries/MySensors/drivers/RF24/RF24.cpp:388:2: note: in expansion of macro 'hwPinMode'
    hwPinMode(MY_RF24_CE_PIN,OUTPUT);
    ^
    /Users/user/Documents/Arduino/libraries/MySensors/drivers/AVR/DigitalWriteFast/digitalWriteFast.h:91:170: error: '__digitalPinToDDRReg' was not declared in this scope
    #define pinModeFast(__pin, __mode) do { if (__builtin_constant_p(__pin) && __builtin_constant_p(__mode) && (__mode!=INPUT_PULLUP)) { bitWrite(__digitalPinToDDRReg(__pin), (uint8_t)__digitalPinToBit(__pin), (__mode)); } else { pinMode((__pin), (__mode)); } } while (0)
    ^
    /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/Arduino.h:112:30: note: in definition of macro 'bitSet'
    #define bitSet(value, bit) ((value) |= (1UL << (bit)))
    ^
    /Users/user/Documents/Arduino/libraries/MySensors/drivers/AVR/DigitalWriteFast/digitalWriteFast.h:91:134: note: in expansion of macro 'bitWrite'
    #define pinModeFast(__pin, __mode) do { if (__builtin_constant_p(__pin) && __builtin_constant_p(__mode) && (__mode!=INPUT_PULLUP)) { bitWrite(
    __digitalPinToDDRReg(__pin), (uint8_t)__digitalPinToBit(__pin), (__mode)); } else { pinMode((__pin), (__mode)); } } while (0)
    ^
    /Users/user/Documents/Arduino/libraries/MySensors/core/MyHwATMega328.h:64:35: note: in expansion of macro 'pinModeFast'
    #define hwPinMode(__pin, __value) pinModeFast(__pin, __value)
    ^
    /Users/user/Documents/Arduino/libraries/MySensors/drivers/RF24/RF24.cpp:389:2: note: in expansion of macro 'hwPinMode'
    hwPinMode(MY_RF24_CS_PIN,OUTPUT);
    ^
    /Users/user/Documents/Arduino/libraries/MySensors/drivers/AVR/DigitalWriteFast/digitalWriteFast.h:91:205: error: '__digitalPinToBit' was not declared in this scope
    #define pinModeFast(__pin, __mode) do { if (__builtin_constant_p(__pin) && __builtin_constant_p(__mode) && (__mode!=INPUT_PULLUP)) { bitWrite(__digitalPinToDDRReg(__pin), (uint8_t)__digitalPinToBit(__pin), (__mode)); } else { pinMode((__pin), (__mode)); } } while (0)
    ^
    /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/Arduino.h:112:49: note: in definition of macro 'bitSet'
    #define bitSet(value, bit) ((value) |= (1UL << (bit)))
    ^
    /Users/user/Documents/Arduino/libraries/MySensors/drivers/AVR/DigitalWriteFast/digitalWriteFast.h:91:134: note: in expansion of macro 'bitWrite'
    #define pinModeFast(__pin, __mode) do { if (__builtin_constant_p(__pin) && __builtin_constant_p(__mode) && (__mode!=INPUT_PULLUP)) { bitWrite(
    __digitalPinToDDRReg(__pin), (uint8_t)__digitalPinToBit(__pin), (__mode)); } else { pinMode((__pin), (__mode)); } } while (0)
    ^
    /Users/user/Documents/Arduino/libraries/MySensors/core/MyHwATMega328.h:64:35: note: in expansion of macro 'pinModeFast'
    #define hwPinMode(__pin, __value) pinModeFast(__pin, __value)
    ^
    /Users/user/Documents/Arduino/libraries/MySensors/drivers/RF24/RF24.cpp:389:2: note: in expansion of macro 'hwPinMode'
    hwPinMode(MY_RF24_CS_PIN,OUTPUT);
    ^
    exit status 1
    Error compiling for board Arduino Pro or Pro Mini.

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


  • Mod



  • Ah,

    correct. What might be good to post on the my sensors page is that the 168 isn't supported, as a "noob" i didn't see / realist this information, it just says buy nano / pro mini or whatever but not that it's specifically the 328 which is supported and not the 168 🙂



  • @xelnaha
    Lazy sunday afternoon -got time to "fix" some problems.
    Not being capable of reading EBAY item descriptions properly, I got some Pro Mini 168 waiting for some work to do.

    Please be aware what the boss says:

    The atmega168 is not officially supported, due to the low flash / ram size, compared to atmega328 (tbowmo, ADMIN, 2 months ago)

    So far I remember are the Pro mini 168 essentially clones based upon Arduino Duemilanove just without power supply and USB.

    Within file "digitalWriteFast.h" in "<whatever>/Mysensors/drivers/avr/DigitalWriteFast/" at line 69

    #elif defined(ARDUINO_AVR_UNO) || defined(ARDUINO_AVR_DUEMILANOVE) || defined(__AVR_ATmega328__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega328PB__)
    

    I added

    #elif defined(ARDUINO_AVR_UNO) || defined(ARDUINO_AVR_DUEMILANOVE) || defined(__AVR_ATmega328__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega328PB__) || defined (__AVR_ATmega168__)
    

    because it is not fair to mention DUEMILANOVE and not to give credits to ATmega168.

    With this modification compiling and uploading work well.

    Please remember:

    • Changes will be lost with every MySensors update
    • I don´t know about side effects to other processor choices (e.g. Nano V2.3)

    tbowmo was (is) right about memory capacity. The "BinarySwitchSensor" example sketch uses 14258 bytes from 14336 maximal Bytes. This is a really tight fit. Stripping debug information results in 7604 bytes.


  • Mod

    @tboha nice that you got it working! Maybe this change can be included in next MySensors release, unless it breaks something else.


  • Admin

    @tboha
    Thanks for reporting, use of digitalFastWrite modified / restricted, ATmega168 should be ok now:

    https://github.com/mysensors/MySensors/pull/739



  • @mfalkvidd
    I am quite happy that this little trick has no hidden side effects.

    Would it be a good idea to give a crosslink to @Matt from https://forum.mysensors.org/topic/5426/cant-compile-2-01-for-atmega168/5 ?
    I could not figure out how to do this, and cross posting is bad behavior I think.


  • Mod

    @tboha thanks. I added a note in the other thread.

    cross-posting is generally bad yes, but since the other thread has the same problem and the solution is documented here cross-posting is actually useful.



  • @mfalkvidd woohoo! Time to resurrect some old nodes 😃
    Thanks for this...


Log in to reply
 

Suggested Topics

  • 33
  • 5
  • 2
  • 5
  • 8
  • 3

23
Online

11.2k
Users

11.1k
Topics

112.5k
Posts