By continuing to use this site, you agree to our use of cookies. Find out more
Forum sponsored by:
Forum sponsored by Forum House Ad Zone

The printer port isn't dead! (linuxcnc is cool and powerful)

All Topics | Latest Posts

Search for:  in Thread Title in  
Michael Gilligan09/09/2022 15:57:50
avatar
23121 forum posts
1360 photos

Great stuff, Sam … that all looks very encouraging

MichaelG.

SillyOldDuffer10/09/2022 15:40:58
10668 forum posts
2415 photos
Posted by sam sokolik on 01/09/2022 18:38:22:

Posted by SillyOldDuffer on 01/09/2022 18:03:00:

...

Any idea how a parallel port's performance compares with twiddling pins on a Raspberry Pi 4? What's the highest frequency a parallel pin can output...

I've experimented with a Pi4 in various real-time modes to see how fast it's IO pins can be made to go and results are both good and bad. Output is quick except for awkward pauses due to the scheduler...

Dave

...

...

The base thread speed really depends on how well the computer can run the realtime kernel. The computer I am using in the video is a 3rd gen i5 HP. It has pretty decent latency and allows for a base thread of around 40-50 khz. I have not seen computer hardware get much higher than that with linux/linuxcnc.

I have not seen much of a difference between onboard, pci and pci-e printer port cards. (other than some features are there or not depending on how it was made)

I have have tested linuxcnc with gpio on the rpi 4 - the base thread I got was 20khz - but because some functionality is missing in the linuxcnc gpio driver - you can only get 10khz step pulses

Sorry about the delay replying - having a busy week. I wrote this user-space code to test rPi output speed:

real-timegpio.jpg

Assuming the library is efficient, I believe the program gets close to the maximum General Purpose IO output achievable from a Pi4. About 4.0MHz, two hundred times faster than linuxCNC's 20kHz, but unlike linuxCNC my code does absolutely nothing useful!

rpigpio2.jpg

I think the scheduler and memory lock settings used have the effect of dedicating one of the 4 CPUs to my process, maximising the time between scheduler interruptions, and forbidding swapping (admittedly unlikely on a lightly loaded computer).

Next oscilloscope screen shot shows the scheduler to be working in blocks of 1 second, in which my program runs for 956mS, and is paused for 44mS in every second:

rpigpio1.jpg

44mS is too long for my taste - needs investigation. Reading is more difficult I haven't found a quick way of responding to incoming bits in user-space yet.

Whilst busy flat out pin flipping the pi4 supports other activity more or less normally - the other 3 CPU cores handle business as usual and seem unaware that the 4th core is running flat out. Pretty sure the chip has ways and means of generating faster output in hardware, but that's cheating.

I looked at the linuxCNC source to see how it manages real-time IO and couldn't find it. There's a lot of code!

Dave

sam sokolik10/09/2022 23:43:26
126 forum posts

Very cool! Yes - the hard part is making it deterministic... I can't say I fully understand how linuxcnc does it. It uses the rt_preempt kernel (which is now part of the Debian repository)

They use the real time api to create the threads.

You can isolate cores for real time - it helps but you won't get mhz thread. (at least in my experience)

For machine control - most of the 'control' can be done in a relatively slow thread. (1 - 10khz) calculating the PID, Trajectory and stuff.. The faster stuff can be moved to hardware. (but again - still doable in the computer as long as 50khz works..)

sam

There is also an RTAI patched kernel which is still available - but requires a bit more work. It used to be that it performed better than the rt_preempt kernel but in my experience they usually have similar latency now.

sam

sam sokolik20/09/2022 05:01:28
126 forum posts

Saving a pin on the printer port using missing tooth functionality.. (to create an index pulse)

sam sokolik29/11/2022 18:11:13
126 forum posts

Finally scored a compact 5 turret!

 

Edited By sam sokolik on 29/11/2022 18:11:46

sam sokolik29/11/2022 18:13:33
126 forum posts

A bit of ladder for testing...

sam sokolik04/12/2022 18:11:11
126 forum posts

an hour you won't get back...

Robin05/12/2022 11:17:11
avatar
678 forum posts

Happy days when you could actually take over the timer interrupt with Bill Gates blessing. I still have the original IBM PC Technical reference manual with all the circuit diagrams including the printer port.

It looked suspiciously like IBM made a motherboard with active low interrupts and expansion cards with active high dont know

Rather than do a massive trip to the dump they found a weird edge-triggered interrupt and pretended that was what they always intended. Of course you only got one bite of the cherry, miss the edge and it was gone, but that was how things were and everyone muddled through laugh

bestest

Robin

sam sokolik07/08/2023 16:38:39
126 forum posts

Finally had a little time to work on this project. I got the X ball nut assembly done - it took some creative machining...

sam sokolik12/08/2023 16:18:35
126 forum posts

+/- 10 volts out of the printer port..

Found some circuits here.. **LINK**

The first one from the forum seemed simple enough to try - although it took me a bit to figure out the filter was setup as a high pass - not low pass.. After figuring that out it made sense..

It should be more than good enough to do closed loop spindle control - and constant surface speed...

sam sokolik14/09/2023 15:20:59
126 forum posts

Getting closer.....

george baker 115/09/2023 22:27:39
39 forum posts

Hi

I knew of the whereabouts one of those Emco's, from memory it was complete and in good nick. Any idea what it would be worth?

George

All Topics | Latest Posts

Please login to post a reply.

Magazine Locator

Want the latest issue of Model Engineer or Model Engineers' Workshop? Use our magazine locator links to find your nearest stockist!

Find Model Engineer & Model Engineers' Workshop

Sign up to our Newsletter

Sign up to our newsletter and get a free digital issue.

You can unsubscribe at anytime. View our privacy policy at www.mortons.co.uk/privacy

Latest Forum Posts
Support Our Partners
cowells
Sarik
MERIDIENNE EXHIBITIONS LTD
Subscription Offer

Latest "For Sale" Ads
Latest "Wanted" Ads
Get In Touch!

Do you want to contact the Model Engineer and Model Engineers' Workshop team?

You can contact us by phone, mail or email about the magazines including becoming a contributor, submitting reader's letters or making queries about articles. You can also get in touch about this website, advertising or other general issues.

Click THIS LINK for full contact details.

For subscription issues please see THIS LINK.

Digital Back Issues

Social Media online

'Like' us on Facebook
Follow us on Facebook

Follow us on Twitter
 Twitter Logo

Pin us on Pinterest

 

Donate

donate