<p>It's not quite as simple as you would suggest.</p>

<p>You can't just recompile Marlin for another device. You'd need to rewrite large parts of it. It may be compatible with the Arduino IDE, but that doesn't mean you can just run firmware intended for the AtMega2560 on it. All the timings (e.g. those of the pulses sent to the stepper motors) would be off, if you managed to get it to compile at all.</p>

<p>As some examples, here are some pieces of code from Marlin that would be broken, as they're written directly in AVR assembly:</p>

<pre><code>#define DELAY_1_NOP  __asm__("nop\n\t")
#define DELAY_2_NOP  __asm__("nop\n\t" "nop\n\t")

[...]

// ensure 100ns delay - a bit extra is fine
asm("nop");//50ns on 20Mhz, 62.5ns on 16Mhz
asm("nop");//50ns on 20Mhz, 62.5ns on 16Mhz

[...]

#define MultiU24X32toH16(intRes, longIn1, longIn2) \
asm volatile ( \
             "clr r26 \n\t" \
             "mul %A1, %B2 \n\t" \
             "mov r27, r1 \n\t" \
             "mul %B1, %C2 \n\t" \
             "movw %A0, r0 \n\t" \
             "mul %C1, %C2 \n\t" \
             "add %B0, r0 \n\t" \
             "mul %C1, %B2 \n\t" \
             "add %A0, r0 \n\t" \
             "adc %B0, r1 \n\t" \
</code></pre>

CC BY-SA 3.0
2017-01-16T23:00:15.247Z
2017-01-16T23:00:15.247Z
Tom van der Zanden
<p>I have read a few times<sup>1</sup> that the Arduino Mega can struggle to perform the tasks required for 3D printer control, as the AVR chip is working at its limits, and this is why some manufacturers have moved away from the ATmega2560, to make custom (and integrated) controller boards using ARM processors.</p>

<p>Having just seen the latest answer to this question, <a href="https://arduino.stackexchange.com/questions/18538/multithreading-with-arduino">Multithreading with the Arduino</a>, on the Arduino SE site, I wondered if anyone had used a <a href="http://uk.rs-online.com/web/p/processor-microcontroller-development-kits/1245257/" rel="nofollow noreferrer">Shield Buddy</a> in conjunction with the standard RAMPS 1.4 board?</p>

<p><a href="https://i.sstatic.net/OEeU9.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/OEeU9.jpg" alt="Shield Buddy"></a></p>

<p>It is pin for pin compatible with the Arduino Mega (and Arduino IDE compatible - once the appropriate add-ons have been installed), but it has a much faster three core processor. Obviously only one core would be used, leaving the other two idling, but even so the performance is <em>apparently</em> much better.</p>

<p>See <a href="https://www.rs-online.com/designspark/bringing-multicore-to-the-arduino-world-with-shieldbuddy-tc275" rel="nofollow noreferrer">Bringing Multicore To The Arduino World With ShieldBuddy TC275</a>.</p>

<p>If anyone has experience of using this board, I would like to know whether it was successful or not? I don't see why it should not, although the Marlin firmware would need recompiling, for the Aurix TC275 processor. Would any improvement be seen? Is it worth paying the high price tag of £89?</p>

<hr>

<p><sup>1</sup> One of the places was <a href="http://hackaday.com/2013/09/06/3d-printering-electronics-boards/" rel="nofollow noreferrer">3D Printering: Electronics boards</a>:</p>

<blockquote>
  <p>While they work for what they’re intended to do, there are a few
  limitations. Arcs and circles are a little weird to program, and using
  these boards for something other than a cartesian 3D printer – a CNC
  machine, or a laser cutter, for example – is a bit out of the
  ordinary.</p>
</blockquote>

CC BY-SA 3.0
2017-01-16T21:14:45.493Z
It's not just a matter of recompiling Marlin. You'd need to rewrite large parts of it. It may be compatible with the Arduino IDE, but that doesn't mean you can just run firmware intended for the AtMega2560 on it. All the timings (e.g. those of the pulses sent to the stepper motors) would be off, if you managed to get it to compile at all.
Tom van der Zanden
CC BY-SA 3.0
2017-01-16T21:32:41.883Z
@TomvanderZanden - oh ok thanks. I haven't looked at Marlin's source code, as yet, so I wasn't aware of that.
Greenonline
CC BY-SA 3.0
2017-01-25T18:54:02.693Z
I am currently trying to port the Marlin RC6 to the ShieldBuddy. I have managed to get most of it to compile and I have converted a lot of the AVR assembler to C (the TC275 is so fast that assembler code is not needed!)
What I am having difficulty with is the interrupts. I can see that there is an interrupt for the serial receive and there is a timer0 interrupt for the stepper driver. Are there any others? Also, what frequency does the timer0 interrupt run at?
I am doing the work in Eclipse but using the Arduino/ShieldBuddy HAL.
I would welcome any help anyone can give!!!
Mike Beach
CC BY-SA 3.0
2017-01-25T20:23:56.020Z
@MikeBeach This is not really the place to ask such questions.
Tom van der Zanden
CC BY-SA 3.0
2017-01-26T00:40:13.133Z
@MikeBeach - Nice work, I would definitely like to hear how the work pans out. Once you get it working, your should post an answer to my question... :-) However, in the meanwhile, your question, _may_ be better suited for StackExchange Arduino, there are some clever chaps there, who may know the answer (although they maybe more ATmega oriented)... Or failing that maybe StackOverflow?
Greenonline
<ramps-1.4><arduino-mega-2650><hardware>
Has anyone used a Shield Buddy (en lieu of a Arduino Mega2560) as the RAMPS 1.4 host board?
Greenonline
# Has anyone used a Shield Buddy (en lieu of a Arduino Mega2560) as the RAMPS 1.4 host board?

(Asked by: username_0 on 2017-01-16)

I have read a few times1 that the Arduino Mega can struggle to perform the tasks required for 3D printer control, as the AVR chip is working at its limits, and this is why some manufacturers have moved away from the ATmega2560, to make custom (and integrated) controller boards using ARM processors.

Having just seen the latest answer to this question, [Multithreading with the Arduino](https://arduino.stackexchange.com/questions/18538/multithreading-with-arduino), on the Arduino SE site, I wondered if anyone had used a [Shield Buddy](http://uk.rs-online.com/web/p/processor-microcontroller-development-kits/1245257/) in conjunction with the standard RAMPS 1.4 board?

[![Shield Buddy](https://i.sstatic.net/OEeU9.jpg)](https://i.sstatic.net/OEeU9.jpg)

It is pin for pin compatible with the Arduino Mega (and Arduino IDE compatible - once the appropriate add-ons have been installed), but it has a much faster three core processor. Obviously only one core would be used, leaving the other two idling, but even so the performance is *apparently* much better.

See [Bringing Multicore To The Arduino World With ShieldBuddy TC275](https://www.rs-online.com/designspark/bringing-multicore-to-the-arduino-world-with-shieldbuddy-tc275).

If anyone has experience of using this board, I would like to know whether it was successful or not? I don't see why it should not, although the Marlin firmware would need recompiling, for the Aurix TC275 processor. Would any improvement be seen? Is it worth paying the high price tag of £89?

---

1 One of the places was [3D Printering: Electronics boards](http://hackaday.com/2013/09/06/3d-printering-electronics-boards/):

> While they work for what they’re intended to do, there are a few
> limitations. Arcs and circles are a little weird to program, and using
> these boards for something other than a cartesian 3D printer – a CNC
> machine, or a laser cutter, for example – is a bit out of the
> ordinary.

**Tags:** ramps-1.4, arduino-mega-2650, hardware
> **Comments:**
> **username_1**: It's not just a matter of recompiling Marlin. You'd need to rewrite large parts of it. It may be compatible with the Arduino IDE, but that doesn't mean you can just run firmware intended for the AtMega2560 on it. All the timings (e.g. those of the pulses sent to the stepper motors) would be off, if you managed to get it to compile at all.  
> **username_0**: @TomvanderZanden - oh ok thanks. I haven't looked at Marlin's source code, as yet, so I wasn't aware of that.  
> **username_2**: I am currently trying to port the Marlin RC6 to the ShieldBuddy. I have managed to get most of it to compile and I have converted a lot of the AVR assembler to C (the TC275 is so fast that assembler code is not needed!) What I am having difficulty with is the interrupts. I can see that there is an interrupt for the serial receive and there is a timer0 interrupt for the stepper driver. Are there any others? Also, what frequency does the timer0 interrupt run at? I am doing the work in Eclipse but using the Arduino/ShieldBuddy HAL. I would welcome any help anyone can give!!!  
> **username_1**: @MikeBeach This is not really the place to ask such questions.  
> **username_0**: @MikeBeach - Nice work, I would definitely like to hear how the work pans out. Once you get it working, your should post an answer to my question... :-) However, in the meanwhile, your question, _may_ be better suited for StackExchange Arduino, there are some clever chaps there, who may know the answer (although they maybe more ATmega oriented)... Or failing that maybe StackOverflow?  

---

## 1 answers

### Answer by username_1 on 2017-01-16. Score: 2 | Accepted answer

It's not quite as simple as you would suggest.
You can't just recompile Marlin for another device. You'd need to rewrite large parts of it. It may be compatible with the Arduino IDE, but that doesn't mean you can just run firmware intended for the AtMega2560 on it. All the timings (e.g. those of the pulses sent to the stepper motors) would be off, if you managed to get it to compile at all.
As some examples, here are some pieces of code from Marlin that would be broken, as they're written directly in AVR assembly:
#define DELAY_1_NOP  __asm__("nop\n\t")
#define DELAY_2_NOP  __asm__("nop\n\t" "nop\n\t")

[...]

// ensure 100ns delay - a bit extra is fine
asm("nop");//50ns on 20Mhz, 62.5ns on 16Mhz
asm("nop");//50ns on 20Mhz, 62.5ns on 16Mhz

[...]

#define MultiU24X32toH16(intRes, longIn1, longIn2) \
asm volatile ( \
             "clr r26 \n\t" \
             "mul %A1, %B2 \n\t" \
             "mov r27, r1 \n\t" \
             "mul %B1, %C2 \n\t" \
             "movw %A0, r0 \n\t" \
             "mul %C1, %C2 \n\t" \
             "add %B0, r0 \n\t" \
             "mul %C1, %B2 \n\t" \
             "add %A0, r0 \n\t" \
             "adc %B0, r1 \n\t" \


---

