RaspberryPi - rmu75/linuxcnc-wiki GitHub Wiki
date: '2018-09-14T19:28:33' title: RaspberryPi
Raspberry Pi running linuxcnc
14Sep2018 news RPi3BPreemptRT prev version preserved for author Okay brief revision and I hope a better overview of current state.
Raspberry Pi will run linuxcnc but there are many problems still to overcome, I think maybe raspberry pi could be better in some respects than the beagleboneblack, but still too early to tell for certain.
linuxcnc will compile and run and drive motors simply from the base raspbian distro, but does not offer realtime unless you spend a large amount of time compiling a realtime kernel.
To compile linuxcnc from the standard raspbian distro use the following commands:
sudo apt-get install git
git clone git://git.mah.priv.at/emc2-dev.git
git branch --track rtos-integration-preview3 origin/rtos-integration-preview3
git checkout rtos-integration-preview3
sudo apt-get update
sudo apt-get install gettext autoconf libpth-dev bc gcc g++ make git libncurses5-dev libxaw7-dev libreadline-dev tcl8.5-dev tk8.5-dev bwidget blt libgtk2.0-dev python-dev python-tk python-lxml libboost-python-dev libtk-img python-imaging-tk python-xlib python-configobj python-gnome2 python-glade2 python-numpy libgl1-mesa-swx11 libgl1-mesa-swx11-dev python-gtkglext1 python-opengl freeglut3 libglu1-mesa libglu1-mesa-dev
cd emc*/src
./autogen.sh
./configure --with-threads=posix --with-platform=raspberry --enable-drivers --enable-simulator --enable-run-in-place
Does it need a name?
I thought maybe linuxcnc PiCNiC, or linuxcnc Raspberry PiCNiC as a fork although probably best not to fork as I doubt there is any need, but maybe a good name for interface boards etc.
Real Time
First realtime, there is a possibilty hard real time kernel may not be absolutely necessary if I/O is moved off to external hardware and handled properly with large prebuffering. Even the realtime kernels do not give great performance and this means a fast basethread and software step generation is not really possible.
When I define kernel as 'works' means that it compiles and runs linuxcnc and will drive I/O
*Xenomai works *RT_PREEMPT works *RTAI does not work, probably never will *Standard linux kernel with preempt and posix threads works, but maynot guarantee timing schedules
Interfacing
Due to the poor realtime performance I/O requires special consideration as software stepgen is probably not possible unless improvements can be made in the realtime kernels.
possible ways of constant step pulses and reducing load on processor
*GPIO direct by processor (limited by the base thread time) *Off board I/O hardware based on one to the serial buses(which have independant hardware buffers, but the buffering does not guarantee timing so intelligent mcu must be used ) *Off board I/O hardware based on GPIO paralell writing bulk blocks to the I/O hardware (probably much faster than serial but needs more cpu power) *GPIO switched by DMA (this is complicated by the problem of how to control step timing) *methods not yet considered??
The best options so far are a pic32 based SPI interface board called 'picnic' or using the DMA based gpio control, I do prefer the idea of the picnic as it probably protects the rpi and does voltage level conversions handles other IO types like pwm and ADC and other problems can be handled better, but unfortunatly maybe a large extra cost.
Important links
*Forum thread of discussions http://linuxcnc.org/index.php/english/forum/18-computer/20514-emc2-running-on-raspberry-pi *Michael's early latency test results http://linuxcnc.mah.priv.at/rpi/rpi-rtperf.html *kinsa pic32 base external I/O interface board http://code.google.com/p/picnc/
- RT_PREEMPT realtime kernel SD card image of linuxcnc with DMA based fast GPIO interface (I like to think this is currently the best way to demo linuxcnc on the rpi, but it is really only a test version for experts only to give feedback) http://soundproofingforum.co.uk/rpi_linuxcnc/raspberrypilinuxcnc.htm
Kernels
This section should describe what kernels can be used on the Raspberry Pi and links to relevant information.
*RT_PREEMPT (currently has possible problems with mmc card, but seems to work mostly) *raspbian default kernel. only for linuxcnc simulator build (simulator will drive motors but scheduling is not real time guaranteed). *RaspbianXenomaiBuild
Touchscreen
Sorry but I have erased most of this section as I have heard that rpi touchscreen will be developed by the rpi foundation for release within 6 months and will be far cheaper than any alternative, as I doubt linuxcnc will be suitable for real world use before the touchscreen is released it seems pointless considering anything other than the official touchscreen.
RPi3BPreemptRT 14sep2018