Sunday, November 20, 2016

DE0-Nano-Soc update on SD card Images

In my last entry I mentioned problems with the new SD card image and my use of a previous image.

This has now been resolved.

There was what equated to a typo in the device name specified in the .ini file for the sample configuration.
(I say 'equated', because the name was deliberate, but when it was deprecated in favour of a common one across Altera and Zynq platforms, the sample config was not updated)
Thus anything based upon the sample, as mine was, did not work.

The image build system is in the process of being regenerated, once some other glitches are straightened out.

There is now an image with the repo as of 14/02/2017 here
It includes the multicore code, with the updated hm2_soc_ol driver and
it has a 512MB swap partition, which makes it easier to rebuild and use both cores without running out of memory.

In my last entry, I also advocated the use of gparted to extend the rootfs partition to use the available SD card space.

Having twice had failures using gparted to do just this with SD cards recently, I have hit upon a successful command line strategy.

The images consist of a 1M uboot partition and an approx 3.6G rootfs partition.
If we use the designations on my desktop (which has a lot of other disks), they
/dev/sdf1 uboot
/dev/sdf2 rootfs

Because there are no partitions after /dev/sdf2, it is possible to delete the partition, then create a new one starting at exactly the same sector, but encompassing the whole SD card.
Then we need to fix up the file system and expand it to the new partition size.

# check it is as you expect                                                                              
$ fdisk -l /dev/sdf                                                                                                
$ umount /dev/sdf2                                                                                             
$ fdisk /dev/sdf                                                                                                    
# command d to delete partition                                                                     
# select partition 2                                                                                          
# w to write to disc                                                                                         
$ fdisk /dev/sdf                                                                                                    
# n to add, primary partition, same start sector as before, select full size    
# w to write to disc                                                                                         
# now fix the file system                                                                                 
$ e2fsck -f -y /dev/sdf2                                                                                        
# resize the filesystem                                                                                     
$ resize2fs /dev/sdf2                                                                                           

Usual caveats apply, back up any data etc. but works fine for me with a card that gparted just hung for 10 mins and produced an error with.

If you create the rootfs partition slightly smaller than full disk size, you can go back into fdisk and create a 3rd partition, then format that as swap and enter it into the /etc/fstab file.

$ fdisk /dev/sdf

# n add primary partition number 3 use full size

# w to write to disc

$ mkswap /dev/sdf3

$ echo "UUID=<output-from-mkswap-here> none swap sw 0 0" >> /etc/fstab

Helps greatly if you are actually rebuilding machinekit in-situ.

Or you can use the swapfile method detailed in Michael's gist . 
Cat skinning methods are plentiful 😼

Friday, November 18, 2016

DE0-Nano_Soc and the DB25 interface board - real world testing

You will recall, that a while back, Charles Steinkuehler announced the completion of the initial work to get the DE0-Nano board running with machinekit and FPGA programmed to act as a Mesa 5i25 replacement

In the next stage, Charles designed a DB25 connected interface board, with pin-outs matching the P2 and P3 headers on a 5i25.

I finally got hold of one of these interface boards, courtesy of the surface mount component soldering skills of Bas de Bruijn.

There was a comparatively simple way for me to test its capabilities.
I already had a turret knee-mill in my workshop, that I had converted to Machinekit and which utilised a 5i25 and 7i76 Mesa combo.

I simply needed to unplug the DB25 lead from the 5i25 to 7i76 and connect instead to the interface board P2.
I was utilising an encoder on the 5i25 second header, so I connected this to the interface board P3.

  • First steps.

I already had a SD card image built by Michael Haberler to run the board and program the FPGA.

( These images are now deprecated, use: )

You will need package bmap-tools to write this to SD and verify.

Then use gparted to expand the second (rootfs) partition to the full size of the remaining space on the card.
You could also create a swap partition if space allows, then edit /etc/fstab to use this.

  • Setting up the image
Quite uniquely, the NIC does not have a preset MAC code and one has to be set
Michaels gist deals with how to do this, via a UART connection into something like CuteCom.
You need to enter any keystroke whilst in the first stage of boot, set the environment to include the MAC address and then trigger a reboot.

=> env default -a
## Resetting to default environment
=> setenv ethaddr ba:d0:4a:9c:4e:ce
=> saveenv
Saving Environment to MMC...
Writing to MMC(0)... done
=> reset

At the second boot you will get a terminal prompt,
default user is machinekit, password machinekit

Do a sudo apt-get update and install any extra packages you require, 
but do NOT apt-get upgrade if you are using this image, because there is a later one, and upgrading will overwrite its components and I could not get that one to work.

  • Running 
(This section assumes familiarity with 5i25 configs.)

The only changes I needed to make to my config for the mill were at the top of the ini and hal files

CONFIG="firmware=socfpga/dtbo/DE0_Nano_SoC_DB25.7I76_7I76_7I76_7I76.dtbo num_encoders=2 num_stepgens=4"


loadrt trivkins
loadrt tp
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES  tp=tp kins=trivkins
loadrt hostmot2 debug_idrom=1 debug_modules=1


NB. if you copy & paste from the sample config, note that tp=tp kins=trivkins is commented out in that config

The eagle eyed amongst you may have spotted that I specified encoders=2 in the config line

Each header on the 5i25 and thus the Nano, only has 4 stepgens and 1 encoder, what this does is effectively enable the second DB25 header output socket on Charles's interface board (equivalent to the header P2 on the 5i25) and the encoder.01 can be accessed from that.

I use the second encoder solely for a hardware pendant MPG on this mill, all the IO for the switches etc on that pendant go onto the 7i76 and are dealt with on the primary header. 

It really was as simple as that.

I ssh'd into the Nano from another computer, using X forwarding
(ie. ssh -X machinekit@192.168.1.XX
entered the /home/machinekit/machinekit directory which houses the pre-built RIP build.

Invoke `machinekit`, select the relevant config and it worked seamlessly, just as it had before.

This is a major achievement by Charles Steinkuehler, Michael Haberler, Michael Brown and Devin Hughes in particular.

Much kudos to them all. 

Monday, September 12, 2016

Introducing a blog about Machinekit, 3D printing, QtQuickVcp and more

Hello Machinekit community,
I recently started a new blog about Machinekit, 3D printing, QtQuickVcp and more (probably tech related) - My intention is to write a new article at least once a week.
Since I would like this blog to be a useful resource for any Machinekit interested person, I would very much appreciate if you propose topics that interest you most.
I think there is some interest in basic Machinekit getting started tutorials. Of course, I will try to merge things back to the main Machinekit docs if they prove useful.
Four blog posts are already waiting for you on

Alex Rössler (Machine Koder)

Sunday, June 5, 2016

ANNOUNCE: Machinekit Europe meeting

We are pleased to invite anyone interested to the first Machinekit meeting in Europe, taking place on July 2nd and 3rd at the Electrolab Hackerspace in Paris/Nanterre, France.

Please feel free to join us - share your plans, exchange experience, and help shape the future of Machinekit!

The agenda is not yet fixed. However, so far following ideas have been collected:

  • Frederic will present his Emco 120 + Intelys C3000 retrofits and demonstrate the XHC-HB04 pendant + DIY lathe control panel.
  • Alex will give a hands-on Machinekit workshop, including HAL and remote user interfaces with QtQuickVcp (help appreciated).
  • Bas will show a ROS configuration for the Matilda robot arm and talk about how the connection with Machinekit works.

... and anything you would want to bring up/contribute to! Please propose talks, bring your hardware and share your Machinekit experience.

More venue and agenda details will be posted shortly, so watch for details, and speak up if you're planning to attend.  So far, most folks are arriving sometime Friday and leaving Sunday evening.

More details about hotels, transportation and agenda are available in
this TitanPad:

Alex Bas Frederic Clement

Tuesday, May 31, 2016

Machinekit documentation goes on-line

We are very pleased to announce that the existing machinekit-docs repository is now rendered automatically in html on the website.

It was an intense 3 weeks of brain storming, document conversion and creation, struggling with a Jekyll rendering engines, within a docker container, within a Jenkins project deployment server, but now the worst is over and the docs are out there.

Michael Haberler deserves the Order of the Duct Tape 1st Class, for managing to get the whole thing stuck together!

The overriding aim of the work, was to have the whole process be automatically regenerative, any edit to the base repo documents being quickly reflected in the rendered site, no human intervention required, after a pull request is merged.

Currently this takes as little as 2 minutes!

A secondary objective was to make editing and adding to existing documents and contributing new documents as easy as possible.
Only if the user base get actively involved in the documentation, will it transform into the information portal everyone wants.


A site wide search engine, powered by Google.
Already very useful and will expand with time as indexing requests propagate.

An 'Edit this page' link.
This considerably lowers the bar to contribution, requiring only that the user has a GitHub account and user name, to allow them to edit docs and submit the edit as a Pull Request directly via a temporary branch reference.

A SandBox page.
This is for any kind of Machinekit connected contribution.
It could be a HowTo on using a particular board with Machinekit,
a blog type project progress report on a particular machine build,
anything whatsoever.

The document can be created by the same 'Edit this page' link and will be visible in the SandBox from the outset, whilst the maintainers consider how best to incorporate it into the document base.

There is still more work to be done, but already we can see a 100% improvement.

Please get involved and contribute your knowledge for all to benefit from.

Mick, Bas and Michael.

Thursday, April 21, 2016

Necitec CNC Cape

Necitec has a kickstarter going for their new CNC cape, which supports 16 isolated inputs and buffered outputs for 4 step/dir drivers and 8 additional signals.  Along with the cape, you also get a uSD card for the BeagleBone with Machinekit pre-installed, sample configurations, and a setup program for adapting system parameters.

Wednesday, April 13, 2016

Altera SoC running Machinekit with hostmot2 firmware

Thanks to the tireless efforts of Michael Brown and others, the open-source hostmot2 firmware from Mesa Electronics has been ported to the Altera SoC family and can be controlled with Machinekit running on the ARM core(s) using a Debian OS image.  The DE0-Nano development board from Terasic was the first board supported, but the DE1-SoC and SoCKit boards also work.

The hardware design files can be found in Michael's mksocfpga GitHub repo, and instructions for creating a build machine VM are available for those who do not already have an Altera Quartus development system setup.

The OS is essentially stock Debian Jessie, but custom kernels, dtb files, and boot loaders are required for the various boards.  Michael is working on build scripts to create full OS images, and the goal is to get builds integrated into RCN's excellent image build infrastructure, so updated images would be automatically built and released every few weeks.

If you want to start testing with any of the SoC platforms, subscribe to the Machinekit issues tracker, and ask any questions on the Machinekit Google group.

Tuesday, March 8, 2016

Furaday BeagleBone Cape

Marius Alksnys and have a new cape available for the BeagleBone, the Furaday.

This is the first commercially available cape that directly supports isolated I/O, encoders, and servo amplifiers.  If you need something to work with traditional servos or quadrature encoders, this may be the cape you want.