EMC2 running on Raspberry Pi?

More
19 Feb 2013 14:54 #30311 by kinsa
Replied by kinsa on topic EMC2 running on Raspberry Pi?
BTW, the maximum jitter I have obtained on RPi using the latency-test is around 55us. The test duration is more than 24hrs and the RPi is doing a lot of compiling in the background.

Please Log in or Create an account to join the conversation.

More
09 Mar 2013 19:31 #31130 by mungkie

I have documented the PIC32 expnasion board here: code.google.com/p/picnc/

A simple HAL SPI driver for testing is included in the source page.


I am finally getting round to looking at linuxcnc on the rpi again and spent 2 or 3 hours yesterday trying to select a suitable mcu for interfacing over spi, if only I had checked your work first, looks like you selected the ideal one and have done all the hard work (if only you had used a dev board with the DIP package chip, I would have saved 3 hours).

PIC's seem to have all the features I decided were necessary: spi dma, higher clock speed, available in DIP pakage, and under £3 per chip.

After messing with the atmega I decided it was probably a dead end and dma is probably a must have for the mcu.

PIC seem to have two nice cheap options with dma in DIP package
PIC18F26J11 @ £2.02
PIC32MX130F064B @ 2.45

I am not sure about supporting components yet, this weekend I should workout requirements for a breadboard layout, maybe make an order for components soon (rs seem to have a £20 minimum order now :( )

www.eevblog.com/forum/microcontrollers/pic32mx-quickstart/ , and www.ccsinfo.com/forum/viewtopic.php?t=47347 looks like my study material

I get the feeling linuxcnc is possibly getting towards a decent working system on the rpi, the PIC looks very promising to me after failure with the other attempts I have made.

I have not really looked at your code, and I am not really a good enough coder to understand anyways, but I assume it uses spi dma, any quick description of what the code does would be helpful.

Thanks for sharing all your hard work kinsa and I hope it encourages others to have a go at hacking on the PIC and rpi and getting some tests done and improving linuxcnc.

Please Log in or Create an account to join the conversation.

More
09 Mar 2013 22:19 #31136 by kinsa
Replied by kinsa on topic EMC2 running on Raspberry Pi?

I am finally getting round to looking at linuxcnc on the rpi again and spent 2 or 3 hours yesterday trying to select a suitable mcu for interfacing over spi, if only I had checked your work first, looks like you selected the ideal one and have done all the hard work (if only you had used a dev board with the DIP package chip, I would have saved 3 hours).


The chip I used was a left over from my previous experiment (rt-8p8c). I completely missed the DIP requirement, once you start doing SMD stuff you'll never look back :)

I'm actually planning to build a polulo stepstick interface, similar to Sanguinololu, on top of picnc. I think I'll design a new board using a DIP package instead, most likely a PIC32MX150F128 (thanks to your research ;)) as the current firmware is using a serial bootloader which already occupies ~10kb.

The existing code should be easy to port over; the only downside to using a 40MHz part would be a lower maximum stepgen frequency (40kHz instead of 80kHz).

I am not sure about supporting components yet, this weekend I should workout requirements for a breadboard layout, maybe make an order for components soon (rs seem to have a £20 minimum order now :( )

A stripboard would be preferable due to higher clock frequency.

I think linuxcnc + RPi would serve the reprap and shapeoko crowd well.

Cheers!

Please Log in or Create an account to join the conversation.

More
10 Mar 2013 11:20 #31158 by otto_pjm
Wow,

I haven't checked in for a few months, it looks like a lot of progress has been made to get LinuxCNC going on ARM / RPi. I'm curious if it would be helpful to try and get the code working on a bit faster ARM board, something like the pcDuino (1Ghz but no SPI unfortunately) or a Odroid-U2 (1.7Ghz quad core, it seems that SPI is via a USB expansion, not sure if that would work). This Ordoid has SPI on a 50 pin header but it's not out yet and it's 4x what an RPi cost, ouch

So, any advice, is it worth pursuing any of these options or is the RPi the best way to test the code? Also are any PICnc boards available? I see the files and BOM are posted, but that's quite a bit beyond my soldering abilities with the SMD PIC.

Thanks for all the great effort.

Pete

Please Log in or Create an account to join the conversation.

More
10 Mar 2013 13:23 #31161 by mhaberler
Pete,

Wow,

I haven't checked in for a few months, it looks like a lot of progress has been made to get LinuxCNC going on ARM / RPi.


the code builds on Raspberry and the BeagleBone; the branch you want to consider at this moment is

git.mah.priv.at/gitweb?p=emc2-dev.git;a=...integration-preview3

and

git.mah.priv.at/gitweb?p=emc2-dev.git;a=...m335x-hal-pru-module

in case you use a BeagleBone -- this branch sports an advanced stepgen driver using the AM335X PRU coprocessor

The issue with ARM boards is finding a realtime kernel, Xenomai being really the only option at this point. The effort to build such a kernel might be considerable if it is not already done; you might want to check the Xenomai mailing list, and the emc-developers archives before going about it. It is not just getting a kernel compiled; you need some high resolution timer support which isnt typically found in stock kernels, and that usuablly is quite hardware dependent.

Eric Johnson (found on emc-developers) has made considerable progress on getting the Xenomai build to run on an Olinuxino; I will integrated this work once stable.

- Michael

I'm curious if it would be helpful to try and get the code working on a bit faster ARM board, something like the pcDuino (1Ghz but no SPI unfortunately) or a Odroid-U2 (1.7Ghz quad core, it seems that SPI is via a USB expansion, not sure if that would work). This Ordoid has SPI on a 50 pin header but it's not out yet and it's 4x what an RPi cost, ouch

So, any advice, is it worth pursuing any of these options or is the RPi the best way to test the code? Also are any PICnc boards available? I see the files and BOM are posted, but that's quite a bit beyond my soldering abilities with the SMD PIC.

Thanks for all the great effort.

Pete

Please Log in or Create an account to join the conversation.

More
11 Mar 2013 01:33 #31188 by otto_pjm
Michael

Great thanks for the pointer on the Olinuxino stuff. It looks like the A13 would be the board to get to pursue this route. (which looks like the same components as the pcDuino, to my untrained eyes) I'm not terribly savvy about all of this but it appears they are working towards using the native GPIO as opposed to off-loading to another processor as with the SPI to PIC mentioned above?

I'll poke around the Olinuxino forums some more and try and work out a few more details. This is getting quite exciting it looks like LinuxCNC on ARM in a supported fashion is getting closer.

Thanks

Pete

Please Log in or Create an account to join the conversation.

More
11 Mar 2013 21:11 #31228 by mhaberler
Pete,

yes, hardware drivers are open issues for such boards. there's hal_gpio and kinsamanka's rpi SPI driver for a start, plus Charle's PRU stepper.

Generally, any linux driver for candidate peripherals are useless, since those cannot be used from a realtime thread - the system call for say open/read/write/ioctl/ etc would kill realtime behavior.

So writing a HAL driver means excerpting the interesting stuff out of existing kernel drivers, disabling those, and replicating that in a HAL module. Whether it's offloaded with SPI or done through GPIO is really a question of performance (eg Stepper) and pin availablity. On the Beaglebone there are lots of pins which are also available for the PRU coprocessors, so there isnt much point in doing the stunt kinsamanka did with the picnc - the PRU performs better than any 8bit uC and there are negligible communication delays too.

As for boards - that is a matter of taste to some extent; I think the BeagleBone boards are an excellent base - lots of pins, good stepper performance, no outboard needed.

The stability of the rtos-integration-preview3 branch is reasonably good - there have only been retouche patches over the last two months. It should hit the main repo within weeks, not months.

- Michael

Michael

Great thanks for the pointer on the Olinuxino stuff. It looks like the A13 would be the board to get to pursue this route. (which looks like the same components as the pcDuino, to my untrained eyes) I'm not terribly savvy about all of this but it appears they are working towards using the native GPIO as opposed to off-loading to another processor as with the SPI to PIC mentioned above?

I'll poke around the Olinuxino forums some more and try and work out a few more details. This is getting quite exciting it looks like LinuxCNC on ARM in a supported fashion is getting closer.

Thanks

Pete

Please Log in or Create an account to join the conversation.

More
12 Mar 2013 02:51 #31252 by otto_pjm
Michael,

Thanks that a great overview of the current and possible options for ARM.

Pete

Please Log in or Create an account to join the conversation.

More
15 Mar 2013 03:22 #31431 by mhaberler
re highspeed stepgen on Raspberry:

I just stumbled over this and it looks like the method described there could be subverted for a high-speed, precise, low-overhead stepgen directly on the Pi:

pythonhosted.org/RPIO/pwm_py.html#subcycles

(I did not try; I will not try and it looks non-trivial to start with)

- Michael

Please Log in or Create an account to join the conversation.

More
15 Mar 2013 21:18 #31449 by andypugh

I just stumbled over this and it looks like the method described there could be subverted for a high-speed, precise, low-overhead stepgen directly on the Pi:


It seems to say that the max frequency is 500Hz (2mS minimum time). I might be miss-reading it.

Please Log in or Create an account to join the conversation.

Time to create page: 0.109 seconds
Powered by Kunena Forum