About unexpected realtime delay ...

More
05 Feb 2019 14:59 #125738 by l2-max
Hi Guys,

After tweaking LinuxCNC on my ASROCK-J3455-ITX board, I got really good latency not exceeding 5000nS. However, the minimum BASE_PERIOD I can set without getting unexpected realtime dalay is 39500nS. That gives me confident 25.3kHz pulse rate. If I go less than 39500nS then as close I approach ~32000nS as sooner after starting LinuxCNC I get the error. I also noticed, that I needed to increase BASE_PERIOD after I added second parallel port. With one parallel port BASE_PERIOD was set to 37500nS and no error was seen.

My question is "Is that CPU speed limits BASE_PERIOD in my case?"

CPU J3455 1.5GHz.

Maksym

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

More
05 Feb 2019 15:36 - 05 Feb 2019 15:37 #125744 by Todd Zuercher
I don't think the speed of that CPU should be a limiting factor.
(in the ancient past Linuxcnc had been made to work on PCs as slow as a 500Mhz P3.) With today's OS and Linuxcnc, I would not try to set up a system with anything much slower than a 1Ghz Pentium D with 1G of ram and 2 would be preferable.

How much memory does your PC have? What OS and Kernel version are you running? How long did you run the latency test, and what other tasks did you try to run while testing it?
Last edit: 05 Feb 2019 15:37 by Todd Zuercher.

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

More
05 Feb 2019 16:02 - 05 Feb 2019 16:03 #125748 by l2-max
It has 8G dual channel RAM installed, but only 4 are visible because of 32bit kernel.

myLinuxCNC 3.4-9-rtai-686-pae #1 SMP PREEMPT Debian 3.4.55-4linuxcnc i686 GNU/Linux

LinuxCNC 2.8 from master branch.

I tried everything, many glxgears, mozilla, youtube .... until responce to UI became very slow. In that state I left latency test for approx. 1 hour.
Last edit: 05 Feb 2019 16:03 by l2-max.

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

More
05 Feb 2019 18:54 #125753 by Todd Zuercher
That certainly is enough memory (half or a fourth of that would have probably sufficed.)

I think it is OK to heavy load test it like that for a worst case scenario, but I think it is also very important to test it under more normal loads, and maybe even more so under light loads (when power saving features are most likely to kick in.)

For testing I like to run 2 or 3 GLXgears, open and close a few windows, brows the internet a bit, and copy some files to and from the network, plus let it set idle for several hours.

I'm not too up on the intricacies of setting up a Preem-RT pc. I've only just started messing with one install of it myself, and it isn't even finished. It will run the machine, but I still need to mount and button up all the boards and wiring to make it look neat. I did find that using isolcpus does seem to help latency on this machine

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

More
06 Feb 2019 16:34 #125822 by l2-max
Latest findings. "unexpected realtime delay" appears only if I add function write for second parallel port (it is actually primary integrated port)

addf parport.1.write base-thread

If this function commented then LinuxCNC works with BASE_PERIOD=25000 with no errors

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

More
06 Feb 2019 16:54 #125829 by PCW
integrated parallel ports on newer motherboards very often use the LPC interface
which is fairly slow compared to the PCI/PCIE bus used by add-in cards. It may take
several usec for the port write access to the on board port
The following user(s) said Thank You: l2-max

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

More
06 Feb 2019 17:32 #125832 by l2-max
That makes sens, but if I swap ports in HAL and use only one port (no matters which) then there is no real time delay. Delay appears only when I use both.

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

More
06 Feb 2019 17:39 - 06 Feb 2019 17:42 #125835 by PCW
Sure, the access times add up...

You should be able to get a estimate of the worst case access times by reading the tmax number for the read/write functions
(these are in CPU clock cycles)
Last edit: 06 Feb 2019 17:42 by PCW.
The following user(s) said Thank You: l2-max

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

More
06 Feb 2019 18:09 #125840 by l2-max
Thanks. You helped me a lot.

Estimating using these parameters gave me 16uS write to PCIe parport and 15uS to integrated port. While reading are 10uS and 11uS respectively.

So, what I did is I commented out read function for second parallel port as there are no inputs and reduced BASE_PERIOD by 10uS from stable 41000nS to 31000nS and no error messages appear!!

I think, I will separate all my inputs and outputs between parports thus will be able to decrease BASE_PERIOD even more.

Thanks again.

P.S. Still I am curious, why LinuxCNC reads second parport if no pins are connected for reading?

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

More
06 Feb 2019 19:02 #125849 by Todd Zuercher
I don't think Stepconfig checks if a port is read or write only, it automatically sets up both when you define a port.

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

Time to create page: 0.186 seconds
Powered by Kunena Forum