Has anyone used a Shield Buddy (en lieu of a Arduino Mega2560) as the RAMPS 1.4 host board?

4

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, on the Arduino SE site, I wondered if anyone had used a Shield Buddy in conjunction with the standard RAMPS 1.4 board?

Shield Buddy

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.

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:

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.

Greenonline

Posted 2017-01-16T21:09:56.540

Reputation: 5 004

1It'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 – 2017-01-16T21:14:45.493

@TomvanderZanden - oh ok thanks. I haven't looked at Marlin's source code, as yet, so I wasn't aware of that. – Greenonline – 2017-01-16T21:32:41.883

2I 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 – 2017-01-25T18:54:02.693

1@MikeBeach This is not really the place to ask such questions. – Tom van der Zanden – 2017-01-25T20:23:56.020

@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 – 2017-01-26T00:40:13.133

Answers

2

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" \

Tom van der Zanden

Posted 2017-01-16T21:09:56.540

Reputation: 14 003