Loading TinyG2 in the Arduino DUE
I have been intrigued for a while with TinyG controller and their S-shaped speed
curves. It is an
evolution from simpler trapezoidal speed patterns used by GRBL software and by most 3D printer firmwares out there too.
However, TinyG (besides a South Korean music group) is not designed to work on a regular Arduino but over more powerful Atmel processors, the XMega series. While the software is open source, it does not help if you do not have the right processor. But lately I am giving a course where I have borrowed an Arduino DUE, which happens to be supported by TinyG project too.
Uploading the code has been a bit of challenge, partly due to my attempt of using a USB cable with broken data wires (I did not know that as I use it for charging my cellphone). But even with a good cable, the upload process, at least using OSX was a bit of a challenge. It all comes down to a not entirely cooked script from their github.
As I am not familiar with ARM development conventions, I see there is a binary file that I can download, but it is a .elf file. Apparently, the uploader program, bossac, cannot handle the .elf file for reasons I do not understand. It needs a binary file instead, and that can be obtained with an obscure command (at least for me): arm-none-eabi-objcopy -O binary tinyg.elf tinyg.bin
Once I have got the binary file, I can upload the code happily with command bossac -e -w -v -b tinyg.bin -R
However, the built-in script from the git, DueFromOSX.sh failed miserably on my computer.
As usual, my downloading of Arduino IDE that was required, 1.5.8 version, was not successful at first as the Java 7 version is apparently not the one that I have installed but Java 6. Nothing that could not be fixed downloading the right one. But I was surprised how tricky the process has been as a whole.
Unfortunately I have run out of time for testing the DUE with grbl shield on my ShapeOko to see if there is a big difference from its older brother GRBL. Maybe another future post.
stty -F /dev/ttyACM0 1200; sleep 1; bossac --port=ttyACM0 -U false -e -w -v -b TinyG2.bin -R
curves. It is an
evolution from simpler trapezoidal speed patterns used by GRBL software and by most 3D printer firmwares out there too.
However, TinyG (besides a South Korean music group) is not designed to work on a regular Arduino but over more powerful Atmel processors, the XMega series. While the software is open source, it does not help if you do not have the right processor. But lately I am giving a course where I have borrowed an Arduino DUE, which happens to be supported by TinyG project too.
Uploading the code has been a bit of challenge, partly due to my attempt of using a USB cable with broken data wires (I did not know that as I use it for charging my cellphone). But even with a good cable, the upload process, at least using OSX was a bit of a challenge. It all comes down to a not entirely cooked script from their github.
As I am not familiar with ARM development conventions, I see there is a binary file that I can download, but it is a .elf file. Apparently, the uploader program, bossac, cannot handle the .elf file for reasons I do not understand. It needs a binary file instead, and that can be obtained with an obscure command (at least for me): arm-none-eabi-objcopy -O binary tinyg.elf tinyg.bin
Once I have got the binary file, I can upload the code happily with command bossac -e -w -v -b tinyg.bin -R
However, the built-in script from the git, DueFromOSX.sh failed miserably on my computer.
As usual, my downloading of Arduino IDE that was required, 1.5.8 version, was not successful at first as the Java 7 version is apparently not the one that I have installed but Java 6. Nothing that could not be fixed downloading the right one. But I was surprised how tricky the process has been as a whole.
Unfortunately I have run out of time for testing the DUE with grbl shield on my ShapeOko to see if there is a big difference from its older brother GRBL. Maybe another future post.
Update
For Linux, I did not have much luck with the direct usage of bossac command, however I was puzzled at how Arduino IDE will work flawlessly in Linux while still it was using bossac. So I realized the culprit was the need of a previous setting the port to 1200 bps to reset the board and clear the memory, this is the command that worked for me to upload code to the Arduino DUE from Linux command line:stty -F /dev/ttyACM0 1200; sleep 1; bossac --port=ttyACM0 -U false -e -w -v -b TinyG2.bin -R
Comments
https://www.youtube.com/watch?v=OBSrpxp8AaI
configure with Cooltherm
https://www.youtube.com/watch?v=m95QGUlc0_Q
Send a settings file with Cooltherm to the Due:
Connection send Textfile............
example textfile settings for the A axis:
%
$aam:1 (A axis mode 1= standaard degree 3= radius)
$4tr:18 (verplaatsing per omwenteling)
$4pm:1 [power management 0=disabled,1=always on,2=in cycle,3=when moving]
$4pl:1
$avm:36000 (A-as G0 snelheid maximaal36x2=72)
$4mi:8 (microsteps 0 tot 32)
(Step Dir enable end - end +)
(D31 D 32 D 33 A 4 A 5)
$ajm:36 (jerk)
%
example for reading out the settins:
$aam (a axis mode 1= standaard degree 3= radius)
$4tr [verplaatsing mm/omw motor 1]
$4pm [power management 0=disabled,1=always on,2=in cycle,3=when moving]
$4sa [m4 step angle]
$4mi (m4 microsteps)
$avm [A vmax in ijlgang G0]
$4ma [ motor 4 maped to axis_0=X,1=Y,2=Z...]
$ajm (jerk)
$4pl
%
example tekst file:
%
G90 G94
G17
G21
(rotatie 360 graden met de A as)
G0 A360
G0 A0
M30
%
What can you put in your config file:
https://github.com/synthetos/g2/wiki/Configuration-for-Firmware-Version-0.98
Connecting the first3 stepper axis to the DUE.
The pinout is the same as for GRBL so you can use a simple cnc shield:
https://www.youtube.com/watch?v=kCDGEezyzfw
Make a better connection for multiple axis
https://www.djuke.nl/nl/producten?page=shop.getfile&file_id=150&product_id=406
for the CNC shield with DRV8825 you can make a connector to a external stepper driver with optocouplers.
DRV8825 footprint:
Pin 7 by a 2k2 to Fet step
Pin 8 by a 2k2 to Fet direction
Pin 1 via 2k2 naar Fet enable
Pen 16 3 opto couplers stepperdriver + 5 volt
Pen 9 (logic gnd) Fet to GND
For the simple cnc shield with the external stepper driver the V+ motors must be connected to the 5Volt from the Due