Fighting with computers

Computers are not always friendly.

Tuesday, November 25, 2014

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, 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.


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


Post a Comment

<< Home