Welcome! Log In Create A New Profile

Advanced

RepRap Firmware on M0 Pro w CNC V3

Posted by badlandz 
RepRap Firmware on M0 Pro w CNC V3
January 11, 2018 07:04PM
I apologize in advance for my naive, clearly a noob here... Sorry, just point me to the manual rather than scream RTFM? winking smiley

With a Zero Pro in hand, I was trying to install, RepRap Firmware, or build from scratch failed, after several tries, as you will see, I’m a “hack,” and not sure what I’m doing.

Why? I’d like to see if the firmware can run on an Arduino Zero with a CNC V3 Shield. Zero get’s it’s power from USB, and the CNC V3 doesn’t pin back power from the 12V source, there aren’t any rectifiers on the CNC V3. So I don’t see any RAMPS/RADDS 5V/3.3V issues, as long as the grounds are good. (unless I missed something in how the stepsticks work). We are 3.3V, with 32 bit Arduino M0 Pro board, and the CNC V3 Shield pinouts are RADDS compatible, just no Power outs for Bed or Extruders (and no 4th stepstick control, unless I can enable that 4th stepstick slot that GRBL can’t seem to do). Both are Arduino M0, Pro is ATSAMD21G18, Due is ATSAM3X8E, at least it’s in the ballpark. Zero is 256k rather than Due’s 512k, which, whatever, maybe I can weed some heater libs and stuff out and shrink it? But no where near that far. (because I’m just a hack, not a coder). But right now the .bin is 214k, so, maybe…?

So, anyway, my pointless push to the bottom dollar of the Shield chain with the Zero with a CNC V3 shield is motivated by someday running minimal stuff on a WeMos ESP D1 with the shield. IMHO, CNC deserves some 32-bit precision that’s lower in price point than a SmoothieBoard, and nicer than GRBL on an Uno, again IMHO.

So, I thought Repeater or RepRap Firmware were the obvious choices, and I started with RepRap Firmware, maybe I’m forking, forgive me? I’d rather just figure it out, and author a How-To or something… anyway… How could it not just be same as RADDS, but the heaters aren’t used?

fork of dc42's fork of the RepRapFirmware but with additions to build using the scons command line tool rather than the Eclipse IDE. Says see the file INSTALL.md file doesn’t exist?

Fooled around, saw I’m at /dev/cu.usbmodem3A21 with the Zero, and tried
bossac --port=/dev/cu.usbmodem3A21  -e -w -v -U true -b RepRapFirmware-1.13a-radds.bin
bossac: extra arguments found

bossac --port=/dev/cu.usbmodem3A21  -e -w -v -b RepRapFirmware-1.13a-radds.bin 
SAM-BA operation failed
DC42 [github.com] is a dead page… BTW

I’m in MacOS, and I got as far as:
* the Arduino (and all relevant libraries) installed (via internal libs offered).
* Following the steps of the RepRapFirmware-RADDS build
* (https://github.com/dcnewman/RepRapFirmware-RADDS/blob/master/INSTALL.md)
* scons installed (wow, that sucked, but done)
* Installed (and set paths to) CoreDuet-master/
* ~/.rrf_arduino_paths.py is working fine (I think)

This wasn’t easy, not strictly in the “How-To” but I found and compiled the requirements, scons, BOSSA and all were installed and set the paths, I thought. Although, done nothing like the How-To, took some deduction work.

There, I’m failing. I’m not a coder, just a hacker…

I run “scons platform=” and it fails, with a few diffrent errors, depending on what I put in for board-name

scons platrorm=RADDS
scons: *** No SConstruct file found.
File "/usr/local/lib/scons-3.0.1/SCons/Script/Main.py", line 924, in _main

scons platform=
-bash: syntax error near unexpected token `newline'
So, I’m looking for the platform option, and maybe not sourcing the right paths somehow. And feeling like I’m barking up the wrong tree..

Any suggestions welcome, thanks in advance...
Re: RepRap Firmware on M0 Pro w CNC V3
January 12, 2018 02:05AM
Very recently, i got RRF v1.20 running on my Azteeg X5 mini (LPC1768 based board that used to run smoothieware) just for fun, so I have been though this.

I've never heard of scons before, the fact it uses python is enough to make me avoid it so I cant help with that. I'm sure adding a new profile (or editing i.e. the radds one) to the eclipse project would be simple enough. However, I ended up just writing a plain old makefile to compile everything. There are a few arduino makefile templates around which are a good starting point.

The zero and due use different processors so you'll also need to modify some of the arguments to the compiler (i.e. -mpcu and any other specific defines needed by libraries). One quick way to get the needed flags is to turn on debugging in arduino interface and compile a sketch for that target board and see what arduino uses, then add in any extras necessary for RRF (checking eclipse compile log).

Importantly, don't forget to modify the linker flags to use the correct linker script which defines the flash, ram etc locations and sizes, which are different on the zero to that on the due. Selecting Arduino M0 Pro in the arduino GUI gives the linker scripts location on a mac to be in ~/Library/Arduino15/packages/arduino/hardware/samd/1.6.17/variants/arduino_mzero/linker_scripts/gcc/ there is a bootloader and non-bootloader version.

RAM is more of a issue at the moment rather than Flash size. You will definitely need to remove unused parts as using the RADDs configuration, the memory usage is still well over the 32K SRAM on the zero. On my LPC port, it requires just over 51K when first booted and configured as a standard cartesian. Note that most of that memory is dynamically allocated.

Given that the clock speed is different (i think the zero is about half the speed?) you'd probably also need to check the prescaler values etc for setting up the step timer interrupts. Also, some parts write direct to registers which would need checking to make sure they are compatible, especially in your case the functions that set the driver step pins (in Platform.h).

Hope it helps.
Re: RepRap Firmware on M0 Pro w CNC V3
January 12, 2018 04:34PM
sdavi, Thank you! You've given me a few thoughts on what to try next. I haven't used Eclipse before, maybe I'll give that a try. And those are some great heads-up's on clock and ram.

I'm going to think about this a bit more before I continue, I'm not sure what the right choice for a starting point would be. I really would like to get the M0 Plus going with a CNC V3, maybe with an SD and little controller (16x2 Character and rotary encoder) and maximize it's abilities. But I think I need to carefully consider my starting point. RepRap Firmware was my first thought, but I did notice there is an active development bu ultimachine for Marlin4Due, and maybe that's worth a look, because it's the Arduino IDE, and more familiar to me. It'll still have the same issues, but I really haven't picked a starting point.
Re: RepRap Firmware on M0 Pro w CNC V3
January 12, 2018 08:30PM
I also forgot to mention that for RRF you also need to update some of the coreDUET to use the samd arduino core. At a very minimum the startup parts which setup the interrupt handlers, etc etc, and any thing else that is device specific.
Re: RepRap Firmware on M0 Pro w CNC V3
January 13, 2018 04:43AM
Quote
sdavi
I also forgot to mention that for RRF you also need to update some of the coreDUET to use the samd arduino core. At a very minimum the startup parts which setup the interrupt handlers, etc etc, and any thing else that is device specific.

CoreDuet was replaced by CoreNG many versions of RRF ago, back in mid 2016.

Edited 1 time(s). Last edit at 01/13/2018 03:19PM by dc42.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: RepRap Firmware on M0 Pro w CNC V3
January 13, 2018 06:50AM
Quote
dc42
CoreDuet was replaced by CoreNG many versions of RRF ago, back in mid 2016..
AhHa! I wasn't looking at the dates in your github correctly. Thank you dc42!
Sorry, only registered users may post in this forum.

Click here to login