Go Down

Topic: Code's problem of Keypad (Membrance Switch Module) (Read 185 times) previous topic - next topic


Hi folks,

I am trying to upload the code from tutorial Lesson 11 to my Mega 2560 board but I have the error below:

"C:\Users\USER\Documents\Arduino\libraries\Keypad/Keypad.h: In member function 'pin_mode':

C:\Users\USER\Documents\Arduino\libraries\Keypad/Keypad.h:87:73: internal compiler error: Segmentation fault

  virtual void pin_mode(byte pinNum, byte mode) { pinMode(pinNum, mode); }
As I understand, the root of it comes from the "Keypad.h", the "virtual void pin_mode...." row might have syntax error and I am not sure how to fix it.

Thank you.



Maybe you should show us your complete code.

No technical PMs.
If you are asked a question, please respond with an answer.
If you are asked for more information, please supply it.
If you need clarification, ask for help.


Apr 23, 2019, 07:29 am Last Edit: Apr 23, 2019, 07:30 am by Montmorency
"Internal compiler error" means a bug in the compiler. But what triggered it and how to avoid it is a different story. Any seemingly unrelated change in the code might help.

Have you tried defining your virtual function out-of-class?


Although it seems maybe a bit different than yours, there is a segmentation fault bug that is specific to the 5.4.0-atmel3.6.1-arduino2 version of avr-gcc used by Arduino AVR Boards 1.6.22 and newer. It has been reported here:

Here's the traditional workaround:
  • Tools > Board > Boards Manager
  • Wait for downloads to finish.
  • When you move the mouse pointer over "Arduino AVR Boards", you will see a "Select version" dropdown menu appear. Select "1.6.21".
  • Click "Install".
  • Wait for installation to finish.
  • Click "Close".

Due to a bug, this workaround doesn't work with Arduino IDE 1.8.6, but it will work with any other version of the Arduino IDE.

If you have File > Preferences > Check for updates on startup checked, the Arduino IDE may occasionally notify you that a new version of Arduino AVR Boards is available, you'll need to refrain from updating back to the new Arduino AVR Boards version, otherwise you'll be back to seeing the segmentation fault error again.

Alternate workaround:
One of the Arduino developers recently worked on this and claims to have fixed it. There is a special beta testing hardware package you can install via the Arduino IDE's Boards Manager that has the fix:
  • (In the Arduino IDE) File > Preferences
  • In the "Additional Boards Manager URLs" field, enter: http://downloads.arduino.cc/packages/package_avr_7.3.0_index.json If you already have an additional Boards Manager URL in that field, you can separate multiple URLs with commas or click the button on the right side of the field to open a dialog that allows you to add each on its own line.
  • Click "OK"
  • Tools > Board > Boards Manager
  • Wait for the downloads to finish
  • Click on "Arduino AVR Boards by Arduino"
  • Click the "Update" button.
  • Wait for the update to finish.
  • Click "Close".

Go Up