EMC2 running on Raspberry Pi?

More
12 years 10 months ago #41687 by ADBensi
Hello!

I am using rpi_stepgen.so with type 0
loadrt rpi_stepgen step_type=0,0,0 step_pins=30,28,22,10,11,9

addf rpi_stepgen.make-pulses servo-thread

addf rpi_stepgen.capture-position servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf rpi_stepgen.update-freq servo-thread

and

setp rpi_stepgen.0.steplen 2000
setp rpi_stepgen.0.stepspace 2000
setp rpi_stepgen.0.dirhold 800
setp rpi_stepgen.0.dirsetup 800

setp rpi_stepgen.1.steplen 2000
setp rpi_stepgen.1.stepspace 2000
setp rpi_stepgen.1.dirhold 800
setp rpi_stepgen.1.dirsetup 800

setp rpi_stepgen.2.steplen 2000
setp rpi_stepgen.2.stepspace 2000
setp rpi_stepgen.2.dirhold 800
setp rpi_stepgen.2.dirsetup 800

and

MAX_FEED_OVERRIDE = 0.2
BASE_PERIOD = 175000
SERVO_PERIOD = 1000000

and

[AXIS_0 1 2]
[AXIS_0 1 2]
[AXIS_0 1 2]
TYPE = LINEAR
HOME = 0.000
MAX_VELOCITY = 44.64
MAX_ACCELERATION = 20.0
STEPGEN_MAXACCEL = 21.0
BACKLASH = 0.000
SCALE = 4000
OUTPUT_SCALE = 1.000
MIN_LIMIT = -1000.0
MAX_LIMIT = 1000.0
FERROR = 1.7
MIN_FERROR = 1
HOME_OFFSET = 0.0
HOME_SEARCH_VEL = 0.0
HOME_LATCH_VEL = 0.0
HOME_USE_INDEX = NO
HOME_IGNORE_LIMITS = NO

I forgot something?
Thanks a lot!

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

More
12 years 10 months ago #41695 by kinsa
Replied by kinsa on topic EMC2 running on Raspberry Pi?

ADBensi wrote: Hello!

I am using rpi_stepgen.so with type 0


Sorry but I'm not familiar with this HAL driver.

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

More
12 years 10 months ago #41798 by ADBensi
Hi,

Maybe Mungkie should know how do.. rpi_stepgen was created in this tread by he. Stepgen procedure works fine in my tests, the problem occurs with linuxcnc intervention.

I am put the video:

See the wave period varying and in some cases minor than 1 us.

Best Regards.

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

More
12 years 10 months ago #41829 by andypugh
I am not sure that the RPi stepgen driver actually works. The code has never been submittted to the LinuxCNC project.
I think that the principle of operation is probably sound, so it is a pity that it never seems to have been finished and added to the code base.

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

More
12 years 10 months ago #41847 by mungkie
Interesting that comments are here just as I am thinking about looking at this again over christmas.

I never seem to get time to actually catch up with this project as everytime I look things have changed, and I am waiting for some kernel improvements .

I am sure the stepgen driver I wrote will not get into the upcoming linuxcnc release, there are so many things that need to get done the major one being the RT_PREEMPT kernel. I have read that apparently both the rpi and RT_PREEMPT patches will become mainline for kernel 3.12, so I am waiting for that.

The current 3.12 and 3.10 kernels seem to have very poor RT performance, I don't really have the knowledge to trace the problems, but average cyclictest always seems around 60us but spikes of 2000 or even 5000us can easily be created by running midori.

I have a feeling that there maybe problems with DMA usage in the rpi kernel with busy waits, I really don't know and it seem more hardware will be using the DMA engine in future kernels and the new fbturbo X server also, so not sure how the DMA may conflict with that?.

I will definitly be releasing a full updated and debuggered driver at some point soon, but I feel like the target is still moving too fast for it to be worth putting in large amount of effort.

The driver on the SD image that was released is basically the same as the one shown on this post
linuxcnc.org/index.php/english/forum/18-...y-pi?start=140#32939

I am hoping to add GPIO inputs and variable period settable at load time, I will release the code, but I am also considering creating a kickstarter project so I can buy myself some test equipment to work on the driver with.

I am also looking at cross platform gui options linuxcnc.org/index.php/english/forum/41-...uture?start=10#41846

I imagine there could be problems with the driver if RT_PREEMPT has a latency greater than 2000us, and if there is cumulative latency then the code will need to implement some sort of catchup procedure.

It will all probably get done eventually, but this is just a hobby project so I am guessing it could take at least a year. If of course I realise its all not possible I will post details if anyone else wants to try and fix my mistakes :laugh: :lol:
The following user(s) said Thank You: ADBensi

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

More
12 years 10 months ago - 12 years 10 months ago #41849 by ADBensi
Hi!

The idea is very good, it's a shame not to have the expectations achieved.

I made a comparison between the codes, they should work. Basically what has been implemented is the BCM2835 DMA GPIO API. I did several tests with several options in the HAL and INI files, including maximum overclocking in the System.

That's when I did a test to just run the pass drive in the maximum speed (my engine only goes up to 270RPM) and then realized that the wave was stable. The problem occurs when the linuxcnc interferes and adjusts the frequencies.

So I think que there are no serious errors to correct, and I agree that the DMA resource must be reassessed beyond the RT Kernel in this version.

Mungkie, you can count me as a collaborator and testing :D
Best Regards,
Last edit: 12 years 10 months ago by ADBensi. Reason: fix translate verbs

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

Time to create page: 0.338 seconds
Powered by Kunena Forum