1 (edited by lawsy 2012-08-15 11:28:34)

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...

2 (edited by ysb 2012-08-13 16:43:03)

Re: Preparing firmware for a Panelolu - now with github download

why using arduino 022 instead of the last 1.01 ? (new to arduino here..)

edit : i found that the library WProgram.h" has been replaced with "Arduino.h" in arduino 1.0, is it because of that ?

3

Re: Preparing firmware for a Panelolu - now with github download

I couldn't flash my board with 1.01, I'm there were some library complaints when I tried to compile.  I suspect there is some reason like this.

4

Re: Preparing firmware for a Panelolu - now with github download

Ive seen a few posts where its recommended to use an older arduino version when compiling the firmware because the new 1.x versions break it somehow.

5

Re: Preparing firmware for a Panelolu - now with github download

It's a bit worrying that you've changed BEEPER and SDCARDDETECT from an invalid pin number (-1) to a valid pin number (0).

Pin assignments start at 0, so 0 can't be used as an invalid ID. So -1 is used to represent an invalid pin.

Also, pins.h already has an ULTRA_LCD section that defines BEEPER and SDCARDDETECT to pins 18 and 38. I don't know which is more correct, the pins.h or the section you added to configuration.h, but whichever is correct it should reside in one place.

Where did you get the ULTRA_LCD defines that you added to configuration.h?

6

Re: Preparing firmware for a Panelolu - now with github download

Hi Jinji,

upon reviewing the code, I see what you mean.

I was seeing a value of 0 as false but of course the pins can start from 0 which is already assigned to E0_DIR_PIN.

Another iisue was just a typo, however. The pin assignments were in fact place in pins.h not configuration.h.

They are based on the Panelolu instructions found at http://blog.think3dprint3d.com/2012/06/ … depth.html

According to that article the code is based on the RAMPS section because the Panelolu is based on the Panel Max which is for Ramps.

I can find no mention of BEEPER and SDCARDDETECT to pins 18 and 38 except for ulltimaker and other models where the pin assignments are obviously different.

7

Re: Preparing firmware for a Panelolu - now with github download

I have no idea what you guys are going on about but I really hope you can manage to eventually come up with a SD reader that can be easily added onto our printers.

Keep up the good work.

8

Re: Preparing firmware for a Panelolu - now with github download

Sounds good Lawsy. So if you change them both back to -1 do you still have a compile error?

9

Re: Preparing firmware for a Panelolu - now with github download

Sure do. The only reason I changed them was to avoid the errors.

The beeper error is coming from following code:

void beep()
{
  //return;
  #ifdef ULTIPANEL
    pinMode(BEEPER,OUTPUT);
    for(int8_t i=0;i<20;i++){
      WRITE(BEEPER,HIGH);
      delay(5);
      WRITE(BEEPER,LOW);
      delay(5);
    }
  #endif
}

void beepshort()
{
  //return;
  #ifdef ULTIPANEL
    pinMode(BEEPER,OUTPUT);
    for(int8_t i=0;i<10;i++){
      WRITE(BEEPER,HIGH);
      delay(3);
      WRITE(BEEPER,LOW);
      delay(3);
    }
  #endif  
}

The error for the SDCARDDETECT is coming from this code:

void buttons_init()
{
  #ifdef NEWPANEL
    pinMode(BTN_EN1,INPUT);
    pinMode(BTN_EN2,INPUT); 
    pinMode(BTN_ENC,INPUT); 
    pinMode(SDCARDDETECT,INPUT);
    WRITE(BTN_EN1,HIGH);
    WRITE(BTN_EN2,HIGH);
    WRITE(BTN_ENC,HIGH);
    WRITE(SDCARDDETECT,HIGH);
  #else
    pinMode(SHIFT_CLK,OUTPUT);
    pinMode(SHIFT_LD,OUTPUT);
    pinMode(SHIFT_EN,OUTPUT);
    pinMode(SHIFT_OUT,INPUT);
    WRITE(SHIFT_OUT,HIGH);
    WRITE(SHIFT_LD,HIGH); 
    WRITE(SHIFT_EN,LOW); 
  #endif
}

Basically it doesn't like the -1 value assigned, even though that syntax is used frequently throughout the firmware.

Next idea is to comment out parts of the functions but this is tricky to test without a printer. Any other ideas?

10

Re: Preparing firmware for a Panelolu - now with github download

I've spent some time comparing to the newest Marlin on Github and a lot of the problems above have been fixed:

  • 1284P support

  • -1 pin support

I think instead of starting with the old Solidoodle Marlin firmware and fiddling to make it work, we're better off starting with the new Marlin working firmware and making Solidoodle specific configuration.h changes.

11

Re: Preparing firmware for a Panelolu - now with github download

Got it working I believe. I have a version of the firmware that is based on the latest Marlin, but with all configuration.h and confifuration_adv.h changes made to match the Solidoodle provided firmware.

It is setup so that a single line can be commented/uncommented to enable Panelolu support.

Will upload tomorrow as a zip, probably easier than listed all the changes.

Good news is my printer is apparently going to be shipped within a week so hopefully I'll be able to test everything soon.

12

Re: Preparing firmware for a Panelolu - now with github download

Thanks for doing that.  I've been wanting to, but everytime I tried something came up.   Is the 1284 part of the Panelolu enable?  Does it work with the 644 (and printers as shipped) as is, or does it not matter to the firmware which chip you have?

13

Re: Preparing firmware for a Panelolu - now with github download

The newest Marlin has support for the 1284P already in place, with almost exactly the same changes I had made. All it is is a superficial mentioning of the chip name to avoid throwing errors.

Apart from that , you simply change the setting in Arduino to 1284P and click compile.

The sanguinololu files are still needed from

https://github.com/jmgiacalone/sanguino1284p

to make the 1284P option appear in Arduino.

14

Re: Preparing firmware for a Panelolu - now with github download

Nice work Lawsy. We can fix the old code by wrapping the usage of BEEPER with...

if (BEEPER>-1)
{
   // old BEEPER code
}

So that it's ignored if there isn't a valid beeper pin. Is that what the new Marlin code does?

Anyway, have you thought of uploading your version of the Marlin code to github? Open projects are free. I'm not yet interested in upgrading to 1284p for the sdcard stuff but I'd like to try the latest Marlin code.

15

Re: Preparing firmware for a Panelolu - now with github download

The new Marlin does pretty much what you've posted. I originally copied over the changes for the SDCARDDETECT and BEEPER sections but then further errors were appearing elsewhere. I figured it was easier to change the new Marlin to Solidoodle instead of changing the old Solidoodle to suit the new Marlin.

I will organise the github upload in the next day or so after I have sussed it out. Obviously I can't test that its working so that's the only thing that makes me hesitant, but I'll post it up anyway.

16

Re: Preparing firmware for a Panelolu - now with github download

If you post it we can test it, or you can zip it somewhere else.  You might be able to attach it in the Google group.

17

Re: Preparing firmware for a Panelolu - now with github download

The forum allows uploads of zip files as attachments to posts.

18

Re: Preparing firmware for a Panelolu - now with github download

Hit the "Post Reply" button at the bottom to get more options instead of using the quick reply form. Then you can "choose file"

19

Re: Preparing firmware for a Panelolu - now with github download

Alright, I've set it up on github. Quite frankly I found navigating github as a contributing user harder than doing the firmware changes. Took me ages to workout how to make the readme file.

Read the instructions carefully and remember that this is untested so far, so use at your own risk. Having said that I did go through the Solidoodle supplied configuration.h file line by line, checking each and making changes as necessary.

https://github.com/mlaws/solidoodle2-marlin

Feedback, testing and comment very welcome.

20

Re: Preparing firmware for a Panelolu - now with github download

Has anyone tested this out?

21

Re: Preparing firmware for a Panelolu - now with github download

It's working so far.  There was one more line to get commented out that kept causing the extruder to try and ram through the endstops, but that's been fixed now.  My Panelolu kit is still making its way from the UK and there will be some work to be done when it arrives, so I haven't been able to test that aspect of it.

22

Re: Preparing firmware for a Panelolu - now with github download

I've completely overhauled the github setup.

The previous firmware we have been using has been renamed and therefore relocated to:
https://github.com/mlaws/solidoodle2-marlin_old

A new version of the firmware has been made by forking the newest Marlin_v1 branch. This means that the firmware is up to date and hopefully improved. Obviously, the first commit I have made is to reapply the Solidoodle specific configuration. This repo has been renamed to match the original location:
https://github.com/mlaws/solidoodle2-marlin

Thanks to Neil Martin who is now officially a collaborator.

23

Re: Preparing firmware for a Panelolu - now with github download

as it's the last version of the marlin firmware .. is it a problem to use it with a stock solidoodle 2 ? (with no sdcard/screen/ etc..)

if no , do we need to change something in the start/end.gcode / other function of skeinforge to follow the new firmware ?

24

Re: Preparing firmware for a Panelolu - now with github download

Using the panel and card requires un-commenting a couple of lines in the settings, so it will work with the stock S2 as-is.  In fact I have those lines activated, but don't have the panel hooked up yet.  All it does is bring up an error about not finding a card, and goes on about its business.

25

Re: Preparing firmware for a Panelolu - now with github download

work like a charm on a standard Solidoodle 2 like you said... some functions like "cool" on skeinforge that didn't work (or randomly work) with original firmware are 100% ok now.. help a lot..

thanks for all your work