1

Our PCB uses an ATmega2560 chip and uses most of the pins, including some that are not defined in the standard pins_arduino.h module, since that module only provides for the pins that are brought out to headers on the Arduino Mega2560 PCB.

We have a modified pins_arduino.h module that has all pins defined, but it doesn't get included in the Arduino IDE compile. It was cataloged in the same directory as the standard module (that we renamed original). The path where the modified module is stored is C:/Arduino/hardware/arduino/avr/variants/mega, where the original was also located.

In the sketch, we added #include "pins_arduino.h" as well as #include <pins_arduino.h>, but neither seemed to have included the modified module, so the extra pins are not accessible. Putting the module in the same library as the sketch didn't help either.

Any suggestions?

3
  • Did you try a folder within C:\Users\Username\Documents\Arduino\libraries\? – Spehro Pefhany Jun 28 '18 at 23:22
  • Thanks for suggestion, however it still doesn't give access to the extra pins. – DavidCyr2000 Jun 28 '18 at 23:57
  • I'd vote for another board variant. Or you can use MegaCore – KIIV Jun 29 '18 at 5:22
1

Now have 2560 “full pin definition” working. This is what I think I did:

1) Download IDE with "Windows ZIP file for non admin install " from https://www.arduino.cc/en/Main/Software

2) Download pins.arduino.h from https://forum.arduino.cc/index.php?action=dlattach;topic=200887.0;attach=60348

3) Open the IDE distribution zip file and extract all files into the location where you want the IDE files and your sketches to reside. Could be anywhere.

4) Before starting arduino.exe from the extracted files, replace the pins.arduino.h file that came with the IDE, with the "all pins defined" version. It is replaced in folder path: .../arduino-1.8.5/hardware/arduino/avr/variants/mega/pins.arduino.h

5) Place sketch within the same path as everything else (e.g. create a folder like “12.My_Sketches” inside “examples”). For example, I put my test sketch Blinky-2560 in folder path: .../arduino-1.8.5/examples/12.My_Sketches/Blinky-2560/Blinky-2560.ino

Why it worked this time? The only difference I can see is I got the new pins file inserted in the right place before running the IDE. It is also possible the sketch has to be in the same path as the rest of the IDE (saw that somewhere!?!?). Otherwise I don’t think there was anything else different from what I was doing with the previously installed IDE.

Since the “all pins defined” file is a superset of the standard mega pins.arduino.h file, there is full compatibility with the Arduino ATmega2560 PCB. It would be great if Arduino would make this fully defined pins file the standard that comes with the IDE.

Never did get MegaCore to upload the sketch after the compile.

0

Add another folder in the /variant folder, and put your modified pins_arduino.h in there. Then in boards.txt, create another section of lines like the exsting Mega section, use a new board name, and add the path to your new folder.

Adding Megacore to the IDE in a similar manner pretty much does all that for you.

4
  • Added folder Mega2560DJC in /variants with new pins.ardruino,h module. Duplicated "Genuino Mega or Mega 2560" with name "Mega2560DJC". Not sure how to add the path to the new folder. New board doesn't show up in IDE Board list. – DavidCyr2000 Jun 29 '18 at 18:28
  • Look at how board types are shown in boards.txt. Make a section like that with your new info. I can't look it up further until I get home. Which Arduino revision are you using? 1.8.5? – CrossRoads Jun 29 '18 at 18:36
  • Yes, using IDE "Arduino 1.8.5 (Windows Store 1.8.10.0)" reinstalled but no change. – DavidCyr2000 Jun 30 '18 at 11:46
  • @KIIV I have added a new board type "allmega" that points to the new “pins.arduino.h” file in C:/arduino/hardware/arduino/avr/variants/allmega with all 2560 pins defined, however, the new board does not show up in the IDE Tools-Board drop-down menu. Is there something you have to do to make the new board type active in the IDE? – DavidCyr2000 Jun 30 '18 at 23:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.