Topic: Preparing firmware for a Panelolu - now with github download
UPDATE: scroll down to find github link
Without a Solidoodle in my hands it is impossible to verify if these changes will work, but so far I'm confident after finally getting the code to compile successfully. Perhaps if this works it might become a sticky and a guide in the future?
Key steps:
Installing software
Making simple changes to correct Solidoodle errors
Updating software to support 1284P chip required to run Panelolu.
Altering firmware to enable LCD support.
1. Download Arduino 022 from arduino.cc
Unzip into a folder of your choice.
2. Download Solidoodle firmware from Solidoodle site under how tos->updating firmware and unzip into a folder of your choice. I placed mine inside previous folder.
3. DELETE the Sanguino folder from within the solidoodle files. We are going to use a different one that recognises the 1284P.
4. Download zip from https://nodeload.github.com/jmgiacalone … all/master
Unzip the Sanguino folder to Sanguino-022\hardware\
Unzip and overwrite the avrdude.conf from tools to arduino-0022\hardware\tools\avr\etc\
When you open Arduino now, under Tools->Board instead of just saying Sanguino, it should now say Sanguino W/ ATmega644P, Sanguino W/ ATmega1284P 8mhz and Sanguino W/ ATmega644P 16mhz. For now, set it to the 644P option.
5. Time to make basic firmware changes as pointed out by Ian and Tony on the Google Group. Open Marlin.pde from within Solidoodle folders.
6. Select configuration.h tab and make the following changes:
Line 221:
#define Y_HOME_DIR -1
To
#define Y_HOME_DIR 1
Line 232:
#define HOMING_FEEDRATE {1500, 1500, 1000, 0} // set the homing speeds (mm/min)
To
#define HOMING_FEEDRATE {1500, 1500, 500, 0} // set the homing speeds (mm/min)
At this point save the file and click the plus to do a test compile, everything should work and a sketch size should appear in the log.
7. Time to setup the firmware for the 1284P. These changes are based on the research that the two chips are physically identical and have the same pin assignments.
Changing to the 1284P under hardware and compiling at this stage will get an error like the following:
Pins not assigned in fastio.h
To address this, in fastio.h:
line 427:
#if defined (__AVR_ATmega644__) || defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644PA__)
to:
#if defined (__AVR_ATmega644__) || defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644PA__) || defined (__AVR_ATmega1284P__)
Basically, we just add the 1284P to the list of chips with the same pin outs.
Compiling now brings another error where Arduino is trying to match a 644p since we have Sanguino board set.
We fix this in pins.h:
line 466:
#ifndef __AVR_ATmega644P__
#error Oops! Make sure you have 'Sanguino' selected from the 'Tools -> Boards' menu.
#endif
to:
#ifndef __AVR_ATmega644P__
#ifndef __AVR_ATmega1284P__
#error Oops! Make sure you have 'Sanguino' selected from the 'Tools -> Boards' menu.
#endif
#endif
Basically we tell t to check for a 1284P before it freaks out and throws an error.
At this stage the firmware compiles for me on either 644P or 1284P board setting.
8. Time to put in the panelolu-in-depth instructions from blog.think3dprint3d.com.
First steps, in configuration.h:
Uncomment Line 323 to:
#define ULTIPANEL
Uncomment line 325 to:
#define NEWPANEL //enable this if you have a click-encoder panel
The next step calls for the commenting of #define SDCARDDETECTINVERTED, but I can't find it anywhere in the Solidoodle firmware or the official Marlin firmware. So let’s hope that it doesn’t need to be commented out because it’s not there in the first place.
Almost finished, we now paste in a large chunk of text into pins.h at line 526:
#ifdef ULTRA_LCD
#ifdef NEWPANEL
//we have no buzzer installed
#define BEEPER -1
//LCD Pins
#define LCD_PINS_RS 4
#define LCD_PINS_ENABLE 17
#define LCD_PINS_D4 30
#define LCD_PINS_D5 29
#define LCD_PINS_D6 28
#define LCD_PINS_D7 27
//The encoder and click button
#define BTN_EN1 11 //must be a hardware interrupt pin
#define BTN_EN2 10 //must be hardware interrupt pin
#define BTN_ENC 16 //the switch
//not connected to a pin
#define SDCARDDETECT -1
//from the same bit in the RAMPS Newpanel define
//encoder rotation values
#define encrot0 0
#define encrot1 2
#define encrot2 3
#define encrot3 1
#define BLEN_C 2
#define BLEN_B 1
#define BLEN_A 0
#endif //Newpanel
#endif //Ultipanel
Compiling now gives unexpected errors about the BEEPER variable and some googling is required to fix.
The following is still not working properly:
As we have no beeper, this should be set to false, but is set to -1 which google says counts as a positive. So immediate update to the code we just pasted from:
#define BEEPER -1
to:
#define BEEPER 0
Test compile again fails with a similar error about SDCARDDETECT, so we also change it from:
#define SDCARDDETECT -1
to:
#define SDCARDDETECT 0
From googling this seems like a specific thing for a Panel Max/ramps board setup (which the Panelolu is based on), where an SDCARD is not automatically detected. Hopefully on Sanguinololu it doesn't prove to be trouble.
Firmware now compiles successfully on 1284P board setting!
Just need a tester now...