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 » Getting FORTE boot files to work on Raspberry Pi(FORTE boot files don't seem to be loading on Raspberry Pi)
Getting FORTE boot files to work on Raspberry Pi [message #1772508] Mon, 11 September 2017 16:11 Go to next message
Marc Jakobi is currently offline Marc JakobiFriend
Messages: 67
Registered: April 2017
Member
Hello, it's me again...

I am having another problem with getting my IEC 61499 application running on the Raspberry Pi.

I have created a boot file via Export--> Create FORTE boot files. I have tried with the FORTE_PC's MGR_ID set to "localhost:61499" and "192.168.10.193:61499".
I renamed the fboot file to "forte.fboot" and copied it to the directory containing forte on the RPi.

I also added the line
/home/pi/forte &

to rc.local so that it would start automatically when the RPi boots. Additionally, I have created an SIFB that uses the Linux Watchdog API to make sure the device reboots if something goes wrong.

It seems like the fboot file is not found or loaded correctly. When I open 4diac on my PC and monitor the system, it just shows a load on NaNs at the FB inputs and outputs (I have the device's MGR_ID reconfigured to the RPi's address).
Changing the permissions for the fboot file (chmod u+x forte.fboot) doesn't seem to fix it.

If I download the application from 4diac, it downloads correctly and then monitoring works (indicating that FORTE starts up correctly, but there was no application loaded).

I read in an old documentation on source forge that FORTE_SUPPORT_BOOTFILE has to be enabled on FORTE. I can's seem to find that setting in CMake though. The only bootfile setting I can fine is "FORTE_BOOTFILELINEBUFSIZE", which is set to 300.
I assume this is an old, now obsolete setting and boot files are supported by default?

Thanks for any help!

Edit: If I kill FORTE and restart it manually, it works.
Could it be that the fboot file has to be in the same location as the rc.local script?


[Updated on: Mon, 11 September 2017 17:01]

Report message to a moderator

Re: Getting FORTE boot files to work on Raspberry Pi [message #1772509 is a reply to message #1772508] Mon, 11 September 2017 17:14 Go to previous messageGo to next message
Marc Jakobi is currently offline Marc JakobiFriend
Messages: 67
Registered: April 2017
Member
Changing the working directory to the directory containing forte in the startup script seems to solve it.
In the rc.local startup script:
cd /home/pi/
./forte &
cd /etc/

[Updated on: Tue, 12 September 2017 12:58]

Report message to a moderator

Re: Getting FORTE boot files to work on Raspberry Pi [message #1772512 is a reply to message #1772509] Mon, 11 September 2017 18:38 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1560
Registered: January 2014
Senior Member

You where faster then me. This was exactly what I was suggesting. Because forte looks in the directory it was started from. So if you type in your rc script /home/pi/forte it will be started from the directory the rcscript is invoked. This is a typical unix behavior and has also some advantages. Because you could now have several bootfiles and depending on the script start any of them.

to your other question: Yes bootfiles are no per default on. you still can disable them. But the option is hidden in the advanced options section. So if you open cmake gui and tick the advanced checkbox you will not that ther are a bunch more options to configure FORTE. however these are mainly needed for tweaking FORTE for very special usecases and the default value should be for most users be sufficient. Therefore it is in the advanced section.

Just as side information we are also working to get rid of the FORTE_BOOTFILELINEBUFSIZE option for version 1.9. This should make forte more stabel to different kinds of bootfile sizes.
Re: Getting FORTE boot files to work on Raspberry Pi [message #1772809 is a reply to message #1772512] Fri, 15 September 2017 14:50 Go to previous messageGo to next message
Marc Jakobi is currently offline Marc JakobiFriend
Messages: 67
Registered: April 2017
Member
Okay, now something strange is happening.
I have CSIFBs in my application that I use for requesting data and debug information remotely from Matlab.
When I start forte manually, it loads the boot file correctly and I can retrieve the data in Matlab.
But when I start it from rc.local, it appears to load the boot file (The tcpip object in Matlab opens the connection successfully), but the response from forte never arrives).
If forte is not running, or forte is running and the fboot file is not loaded, the tcpip object can't connect. This means that the boot file is loaded in both cases, but something goes wrong when it's loaded at startup.

Could this have something to do with permissions?
But if I add sudo to the startup script, it gets even stranger. It seemingly starts two root instances of forte (whereby killing one PID also kills the other instance) and the data transfer problem still persists.

[Updated on: Fri, 15 September 2017 14:52]

Report message to a moderator

Re: Getting FORTE boot files to work on Raspberry Pi [message #1772872 is a reply to message #1772809] Mon, 18 September 2017 08:18 Go to previous messageGo to next message
Jose Maria Jesus Cabral Lassalle is currently offline Jose Maria Jesus Cabral LassalleFriend
Messages: 199
Registered: February 2016
Senior Member
Maybe the IP interface of the RPI is not ready yet when booting and forte tries to use it. You could run your forte from your own script which waits a couple of seconds before acutally starting forte to see if that's the problem.

Regarding the sudo thing, I'm not sure, but it looks like you're not the only one that had the same issue:

https://stackoverflow.com/questions/43779636/why-is-my-python-script-running-twice-in-the-background-when-i-try-to-execute-it
Re: Getting FORTE boot files to work on Raspberry Pi [message #1772889 is a reply to message #1772872] Mon, 18 September 2017 12:27 Go to previous messageGo to next message
Marc Jakobi is currently offline Marc JakobiFriend
Messages: 67
Registered: April 2017
Member
Thanks.
Checking the IP as described in this thread fixes it:
https://raspberrypi.stackexchange.com/questions/7857/how-can-i-check-for-internet-connection-before-running-etc-rc-local-script
Re: Getting FORTE boot files to work on Raspberry Pi [message #1772893 is a reply to message #1772889] Mon, 18 September 2017 13:14 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1560
Registered: January 2014
Senior Member

thats interesting. I'm not very good at init scripts but I remember that you could specify a priority for the order of scripts to be started. So based on your observation it would be good to place it after network configuration.

Another option is to use systemd. Jens Reiman provided in the development branch a system.d configuration file fore forte. I think this could also work for the rapsi.
Re: Getting FORTE boot files to work on Raspberry Pi [message #1773116 is a reply to message #1772893] Thu, 21 September 2017 19:40 Go to previous message
Marc Jakobi is currently offline Marc JakobiFriend
Messages: 67
Registered: April 2017
Member
The systemd config option sounds interesting, too.

Here's my final startup script "startForte.sh" that includes logging outputs to a text file (assuming forte is in the /home/pi/ directory):

#!/bin/bash
#Checks for a network connection and then starts forte
STATE="error";
while [ $STATE == "error" ]; do
	# Check for an active network connection
	STATE=$(ping -q -w 1 -c 1 `ip r | grep default | cut -d ' ' -f 3` > /dev/null && 
	echo ok || echo error)
	# Wait for 2 seconds
	sleep 2
done
# cd to forte dir to enable boot file loading
cd /home/pi/
(
# Start FORTE...
./forte
# ...and log output
) &> /home/pi/forteLog.txt


After making it executable:
chmod +x startForte.sh

the script can be started at boot by adding the following line to rc.local
/home/pio/startForte.sh &

Previous Topic:Forte stops running on Raspberry Pi after a certain time
Next Topic:Raspberry Pi
Goto Forum:
  


Current Time: Thu Mar 28 20:23:36 GMT 2024

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

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

Back to the top