Synthetos and TinyG2

Discussion in 'Arduino IDE' started by Forrest, Jan 17, 2014.

  1. Forrest

    Forrest New Member

    Dec 6, 2013
    Likes Received:
    Can anyone tell me if I can program into the Due using the method below to install TinyG2. I then want to feed it the GCode from UDOO Linux
    I have highlighted the main command I am wondering if will work.
    Also, what port and how to set it up?
    Thanks in advance for any help. This seems ideal application for UDOO!
    .... Forrest

    G2 runs on the Arduino Due, and can be used with the gShield to build a high performance 3 axis motion control system.

    G2 has a number of advanced features, including:

    Full 6 axis motion control - XYZ linear axes and ABC rotary axes
    Jerk controlled motion for acceleration planning (S curve 3rd order motion planning)
    RESTful interface using JSON
    Complete status and system state displays
    Refer to the G2 wiki for more information

    Flashing TinyG2 to the Arduino Due w/ Apple OSX
    Step 1 - Get the TinyG2.elf file

    Get the tinyg2.elf binary firmware files from the link below.

    Step 2 - Install the Arduino Due environment

    If you already have the Arduino Due environment installed you can skip this step

    Download the Arduino 1.5 BETA (not the 1.0.5 release at the top of the page) from for OS X.

    Expand the downloaded zip file and move to /Applications on your hard drive. (Often, this is found on the sidebar of Finder windows.)

    Step 3 - Program TinyG2 onto the Due

    Open and change to the directory with this programmer:

    Type "cd " (That's lowercase "c", then "d", then space), DON'T hit return.
    Now drag the folder that you found this ReadMe.txt file in to the window that has the "cd " you just typed. It should type in a path for you.
    Now hit return.
    Either place the .elf file you want to program into that directory or remove the trailing version number from the elf file that is present; e.g.

    mv TinyG2.elf.13.01 TinyG2.elf
    Plug a USB cable from the computer to the Programming port of the Due (the one closest to the power jack). Make sure there are no shields, programmers, debuggers or other devices plugged into the Due. The Due does not need external power for programming - it will be powered by the USB programming cable.

    Copy and paste the following line into the Terminal window:

    ./ -f TinyG2.elf -p /dev/cu.usbmodem*

    The output should look something like this (the numbers after cu.usbmodem will be different):

    Forcing reset using 1200bps open/close on port /dev/cu.usbmodem241311
    Starting programming of file TinyG2.elf -> TinyG2.bin on port cu.usbmodem241311
    Erase flash
    Write 119380 bytes to flash
    [==============================] 100% (467/467 pages)
    Verify 119380 bytes of flash
    [==============================] 100% (467/467 pages)
    Verify successful
    Set boot flash true
    CPU reset.
    Now disconnect the Due and plug the USB cable into the other port. You now have a Due/TinyG2.
  2. jayfehr

    jayfehr New Member

    Oct 26, 2013
    Likes Received:
    How was your experience with this setup? I'm about to build a CNC machine also using a UDOO and gShield.
  3. New Member

    Dec 1, 2013
    Likes Received:
    I am also trying to build a CNC machine using a UDOO dual and gShield. I get an error trying to compile TinyG2.bin from github source on the UDOO. "gcc cannot execute binary" . I have a TinyG2.elf file but don't know how to upload it to the Arduino chip using the UDOO. Is there a Udoobuntu equivalent of the "./" ?
  4. New Member

    Dec 1, 2013
    Likes Received:
    I compiled the tinyg2 code on my Ubuntu 14.02 machine. The synthetos github repository is built for x86 machines. I transfered the gShield.bin (and .elf .map .elf.txt) files to the UDOO. then I used the bossac utility in /opt/arduino-1.58/hardware/tools to flash the SAM3X with the gShield.bin using bossac --port=ttymxc3 -e -w -v -b gShield.bin -R.
    It erased and flashed the bin file. I am still working on getting Chilipeppr to connect with the SAM3X using serial-port-json-server.
  5. tdeyle

    tdeyle New Member

    Oct 8, 2016
    Likes Received:
    Resurrecting this thread for posterity's sake:
    Using Kendall's post above, and this thread there, I have been able to have TinyG2 (g2core) communicate with the Udoo through Chilipeppr.

    First, I compiled the latest g2core, (fw 100), in Windows, using Atmel Studio using the instructions found on the g2core wiki. I used bossac to flash the code to the Due in UDOOBUNTU, after erasing and resetting it by using the jumper from J18 and throwing it onto J22 for one second, removing it, then putting onto J16 for a second, then removing it and placing it back onto J18.

    With that out of the way, I recompiled the Linux Kernel, using make menuconfig all on the UDOO and after disabling the USB_Gadget driver and enabling the OTG_Support (which was already enabled, so I believe disabling the USB_Gadget driver fixed it), I copied it onto the SD Card.

    After rebooting, I used the instructions in the thread mentioned above to set the two GPIOs:

    # GPIO 128 = USB_OTG_SEL
    echo 128 > /sys/class/gpio/export
    echo out > /sys/class/gpio/gpio128/direction
    echo 1 > /sys/class/gpio/gpio128/value
    # GPIO 203 = VBUS_EN
    echo 203 > /sys/class/gpio/export
    echo out > /sys/class/gpio/gpio203/direction
    echo 1 > /sys/class/gpio/gpio203/value

    I have still yet to install the above into a script that will start upon boot.

    I start the serial-port-JSON-server on the UDOO, and see that the TinyG2 is recognized through ttyACM0 and ttyACM1, and not ttymxc3. On a PC, I start Chilipeppr, input the UDOO's IP address, and connect to the TinyG2.

    After this, I can jog the motors and even run the sample gcode. There is an issue however, where, if the terminal is closed on the UDOO, the SAM3 has to be reset by removing the J18 and putting onto J16 for a second, putting it back onto J18, in order to reset it. After doing this, and restarting the device in the "Serial Port JSON Server" widget in Chilipeppr, I am able to continue using the controller.

    I hope this helps someone.

    - Theo
    theGarz and Andrea Rovai like this.
  6. theGarz

    theGarz New Member

    Dec 21, 2016
    Likes Received:
    Hello Forum,
    i'm guessing if there's a simple way to prepare an udoo quad to operate as a CNC controller.
    I'm not very into this chilipepper thing, then maybe my situation is easier.

    As far as i know i can use the precompiled firmware for an arduino 2 and flash it on the arduino (from UDOOBUNTU).

    I can use a g-code sender in the UDOOBUNTU environment to send g-code to the onboard arduino 2 (now flashed with g2core), for example the "universal g-code sender" made for GRBL, which is java based.

    I can use the cheap but good-enough cnc-shield (protoneer clone) that is compatible with an arduino Uno + GRBL. Is the pinout the same of the g-shield v5? I saw that the g-shield v5 is compatible with an arduino uno flashed with GRBL, then since the cnc-shield is actually made for GRBL i assume that is backward compatible with an arduino Due + g2core.

    Are those statements correct?
    If yes i'll proceed with this project, otherwise i'll probably abandon it.
    Thanks in advance for yours advice!
  7. waltervl

    waltervl UDOOer

    Dec 12, 2015
    Likes Received:
    The Udoo contains a Arduino Due so it is not sure an Arduino Uno code will work on a Udoo as it is not guaranteed it will work on a Due.
    Also the uno shield could not be compliant if it is not 3.3V, the output pins may not create 5V and the input pins and circuits behind it have to be able to react on 3.3V as high signal. it is pin compliant though.
  8. theGarz

    theGarz New Member

    Dec 21, 2016
    Likes Received:
    Thank you for the explanation, i don't actually want to run an arduino 1 code on an arduino 2, but i forgot this 3v3 - 5v issue.
    Anyway, this isn't an unsolvable issue, i think that it's possible to use the cnc-shield if the input pins are limited with a voltage divider (a common trick that's usual with bluetooth module).
    I'll give this project a try...
  9. Andrea Rovai

    Andrea Rovai Well-Known Member

    Oct 27, 2014
    Likes Received:

Share This Page