Welcome! Log In Create A New Profile

Advanced

Minimise Marlin to allow for SD support on ATmega644

Posted by remondo 
Minimise Marlin to allow for SD support on ATmega644
October 15, 2013 06:55AM
I have one of the original Melzi control boards which has an ATmega644 chip which means I have limited space for my firmware.

I've successfully transferred my settings from Sprinter to Marlin and uploaded to my board and all is working well but I had to disable SD support to fit the firmware on the chip. With SD Support enabled the sketch size is something like 66000 bytes but my board only has a maximum of 63488 bytes. With SD Support disabled, the sketch size is 49362 bytes. Obviously, I only need to free up ~3000 bytes to enable SD Support but I don't know what else I can remove. EEPROM is already disabled by default.

Is there anything else I can disable which is unnecessary and will free up some space so that I can enable SD Support?

Edited 2 time(s). Last edit at 10/15/2013 06:59AM by remondo.
Re: Minimise Marlin to allow for SD support on ATmega644
October 15, 2013 07:11AM
You can disable PID regulator and for control method use only bang-bang, for both extruder and bed. Dunno if you tried this already or not, but i think its worth saying.
Re: Minimise Marlin to allow for SD support on ATmega644
October 15, 2013 07:25AM
Thanks, after a bit more googling I found this suggestion but was unsure what caveats may arise from doing this. The obvious one is that the temperature may fluctuate a lot but how much of a problem is this?

Having completed a few test prints with Marlin and comparing them to the same prints with Sprinter, I can't see any difference whatsoever. Marlin claims to create better arcs but I don't see it, I can still see the segmentation of the lines just as clearly as with Sprinter. I'm considering just switching back to Sprinter to avoid these 'hacks'. Is there any reason why I shouldn't switch back? Is Marlin with PID disabled any better than Sprinter?
Re: Minimise Marlin to allow for SD support on ATmega644
October 15, 2013 08:02AM
You could always put the 1284 chip on,
I'm willing to do it for anyone who's interested, only takes 5 minutes with the right soldering kit!


=======================================================
A wise man once told me "Never trust a man who doesn't own a shed!"
=======================================================
Gen 6 daughter board
[forums.reprap.org]
Mendel PCB heatbed
[forums.reprap.org]
=======================================================
Re: Minimise Marlin to allow for SD support on ATmega644
October 15, 2013 08:10AM
slymike Wrote:
-------------------------------------------------------
> You could always put the 1284 chip on,
> I'm willing to do it for anyone who's interested,
> only takes 5 minutes with the right soldering kit!

Another reason to always use CPU sockets (along with when you blow the chip by accident).
Re: Minimise Marlin to allow for SD support on ATmega644
October 15, 2013 10:09AM
slymike Wrote:
-------------------------------------------------------
> You could always put the 1284 chip on,
> I'm willing to do it for anyone who's interested,
> only takes 5 minutes with the right soldering kit!

I might take you up on that offer, my soldering skills are appalling. Will there be any compatibility issues from doing this?

Edited 1 time(s). Last edit at 10/15/2013 10:10AM by remondo.
Re: Minimise Marlin to allow for SD support on ATmega644
October 15, 2013 10:13AM
Reprap's PID control means PID is used to calculate the pwm timings only, as the output of that would be some sort of pwm. On the other hand with bang-bang control, the mosfets will turn on and off when temperature reaches tripping point +/- hysteresis. As a side note, imo bang-bang shouldnt use pwm even if its on a pwm pin, though i think some config.h files do make something like that as a default (e.g. defining min and max pwm for bang-bang, parameters different than 0 and 255).

The old style (vanilla) heaters with heater wire - without heater block, those need pwm. The heaters with resistors in a metal block can work with bang-bang. With something like 1-2C hysteresis, i dont think there will be much difference in temperature graphs. You certainly dont "loose" anything essential.

It can be discussed and perhaps opinions may be split about this. My opinion is bang-bang is actually better. In modern switch mode converters, the "switching" losses nowadays are most part of losses. These are losses when the fet transitions between states, because in its triode region the losses are so huge, even a few nanoseconds more and it matters alot. And arduino's pwm wave i suspect isnt terrible perfect either, so if it would be a matter of choice, personally i wouldnt use it for this. Bottom line, my opinion, if not for both then at the very least for heated bed, dont use pid or its pwm.
Re: Minimise Marlin to allow for SD support on ATmega644
October 15, 2013 10:30AM
The old version of Marlin I use works on a 644 chip with SD. It was before PID was added for the bed. That was need for some kapton heaters that cause the glass to flex in time with the bang bang.

[github.com]


[www.hydraraptor.blogspot.com]
Re: Minimise Marlin to allow for SD support on ATmega644
October 15, 2013 12:46PM
Many thanks for the help and explanations. I'll try commenting out PID and see if I can get it all to fit.
Re: Minimise Marlin to allow for SD support on ATmega644
October 15, 2013 05:19PM
I've disabled PID and the sketch is still too big by 1086 bytes. Any other suggestions?
Re: Minimise Marlin to allow for SD support on ATmega644
October 16, 2013 01:27AM
Using Latest Marlin and arduino 0023, under linux (just in case it make a difference, It shouldn’t)

I downloaded latest marlin with git clone [github.com]

Edit configuration.h

Set Motherboard #define MOTHERBOARD 63
comment out PIDTEMP eg //#define PIDTEMP
enable SD with #define SDSUPPORT

I get Binary sketch size: Binary sketch size: 63092 bytes (of a 63488 byte maximum)

I don't have a melzi to try it though.
Re: Minimise Marlin to allow for SD support on ATmega644
October 16, 2013 09:05AM
Teacup firmware is about 20.000 bytes with PID and look-ahead. Rudimentary support for SD cards exists in the sdcard branch. Just saying.


Generation 7 Electronics Teacup Firmware RepRap DIY
     
Sorry, only registered users may post in this forum.

Click here to login