Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » 4DIAC - Framework for Distributed Industrial Automation and Control » Board optimization
Board optimization [message #1815775] Thu, 10 October 2019 11:23 Go to next message
Mike Wazowski is currently offline Mike WazowskiFriend
Messages: 23
Registered: October 2019
Junior Member
Hi, I have the simple project, which task is to read signals from GPIO Input and to write current state to GPIO Output (pic1.png).

I launched this project on BeagleBone and Raspberry 3B+ on linux with and without Real-Time kernel "cover". Having cycle time equal 1 ms, I had delay between input and output signals about 5 ms in average and one time of thousands it was 10 ms (pic2.png).
The main goal is to achieve a delay of 5 milliseconds at maximum. Average delay must be less than this value.

How can this be fixed? And could you recommend which kernel configuration parameters I should change?

Explanation to pic2.png:
yellow - input signal
green - output signal
  • Attachment: pic1.png
    (Size: 105.47KB, Downloaded 98 times)
  • Attachment: pic2.png
    (Size: 19.64KB, Downloaded 82 times)

[Updated on: Thu, 10 October 2019 11:24]

Report message to a moderator

Re: Board optimization [message #1815826 is a reply to message #1815775] Fri, 11 October 2019 14:22 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1582
Registered: January 2014
Senior Member

I had a look into the implementation of the sysfs IO interface. There I saw that it has an implementation of a scanning thread, which is updating the inputs with a scan-time of 10ms. See for reference line 235 in src/modules/sysfsprocint.cpp.

Currently this is unfortunately hardcoded. so the first thing what I would do for testing is to get this time down to 1ms. The second thing what you can do now is to use the IND output of your IX FB. This will trigger everytime the input changes. I hope with that you should be much faster.

If this is then still not sufficient I think the next step would be to look into other ways of accessing IOs on raspberryPis. then also the new IO design should be implemented. In that we can have more control on the scan cycles.

I hope this helps.

Cheers,
Alois
Re: Board optimization [message #1815887 is a reply to message #1815826] Mon, 14 October 2019 12:16 Go to previous messageGo to next message
Mike Wazowski is currently offline Mike WazowskiFriend
Messages: 23
Registered: October 2019
Junior Member
Thanks. Much better.

Can you answer on second question: Mike Wazowski wrote on Thu, 10 October 2019 11:23
And could you recommend which kernel configuration parameters I should change?l

Re: Board optimization [message #1815892 is a reply to message #1815887] Mon, 14 October 2019 14:48 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1582
Registered: January 2014
Senior Member

First of all, deactivate as many linux processes as possible. Then you can also consider changing the real-time priority of 4diac FORTE as a whole. The chrt command can be used for that. However it requires root rights.

At which time levels are you currently? It would definitely be worth to look where the most time is currently spent. Perf could be used for that. Based on that I would then look into improving that parts of 4diac FORTE
Re: Board optimization [message #1815991 is a reply to message #1815892] Wed, 16 October 2019 15:35 Go to previous messageGo to next message
Mike Wazowski is currently offline Mike WazowskiFriend
Messages: 23
Registered: October 2019
Junior Member
Ok, I'll try it. Later I will write how it works and attach screenshots of experiment.

Now I have a maximum 8ms on the BeagleBone board and 2-5 ms at RaspberryPi 3B+. But when the square signal at the GPIO input is set, I have the following problems:
1) "External event queue is full, external event dropped" can happen if I set the signal frequency to 1 kHz;
2) it can rarely miss the active signal at the GPIO input and not transmit it at the GPIO output.

What could be the reason for this? And how can this be fixed?
FORTE will show best perfomanse if I set sleepThread equal 0 ms - sleepThread(0).

And could you help me with FreeRTOS?
https://www.eclipse.org/forums/index.php/t/1100779/

[Updated on: Wed, 16 October 2019 15:37]

Report message to a moderator

Re: Board optimization [message #1816088 is a reply to message #1815991] Sun, 20 October 2019 18:40 Go to previous message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1582
Registered: January 2014
Senior Member

The "External event queue is full, external event dropped" indicates that you are generating events much faster then 4diac FORTE can process them. To be more accurate the code within one function block is blocking so long that the external events can not be correctly queued. I would assume that this happens in the QX block now. This speaks for looking at other options to access the IO interface. Although maybe here the chrt could help.
Previous Topic:Error updating 4diac IDE
Next Topic:HMI with 4diac FORTE on raspberryPI using scadaBR
Goto Forum:
  


Current Time: Fri Apr 19 09:21:29 GMT 2024

Powered by FUDForum. Page generated in 0.02334 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top