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 » How to add wiringPi library to access the softPWM functions.
How to add wiringPi library to access the softPWM functions. [message #1740478] Sun, 14 August 2016 14:37 Go to next message
Santosh Kumar Panda is currently offline Santosh Kumar PandaFriend
Messages: 9
Registered: June 2016
Junior Member
Hi All,

I want to generate a software based PWM in Raspberry Pi. For this I have installed wiringPi library.

Now I want to add the wiringPi library to Forte while compiling it. How this can be done? Also do I need to compile the same in the local forte?

Thanks,
Santosh
Re: How to add wiringPi library to access the softPWM functions. [message #1740482 is a reply to message #1740478] Sun, 14 August 2016 18:20 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 866
Registered: January 2014
Senior Member
Hi,

you need to specify the library you want to add in the CMakeList.txt file with the forte_add_link_library command. You can have a look at the mqtt_paho module for examples on how you can do this.

No you don't need to add this to your local forte. You only need add the libraries for the specific platforms.

Alois
Re: How to add wiringPi library to access the softPWM functions. [message #1777912 is a reply to message #1740478] Wed, 06 December 2017 06:46 Go to previous messageGo to next message
Barry wan is currently offline Barry wanFriend
Messages: 40
Registered: July 2017
Member
hi,i also want to control a motor with pwm use 4diac on raspberry board,
have you finished it ?
Re: How to add wiringPi library to access the softPWM functions. [message #1778362 is a reply to message #1777912] Wed, 13 December 2017 13:15 Go to previous messageGo to next message
Jose Maria Jesus Cabral Lassalle is currently offline Jose Maria Jesus Cabral LassalleFriend
Messages: 136
Registered: February 2016
Senior Member
I have created a PWM as a Servcie Function Block that only works on posix, so it would work for the rpi. It is a software PWM that turns on and off an output in its own thread. I could attach the .fbt, the .cpp and the .h file here, but I'm not sure if that's what you are looking for
Re: How to add wiringPi library to access the softPWM functions. [message #1778497 is a reply to message #1778362] Fri, 15 December 2017 01:44 Go to previous messageGo to next message
Barry wan is currently offline Barry wanFriend
Messages: 40
Registered: July 2017
Member
would you mind sharing it with me ? thank you
Re: How to add wiringPi library to access the softPWM functions. [message #1778578 is a reply to message #1778497] Mon, 18 December 2017 08:25 Go to previous messageGo to next message
Jose Maria Jesus Cabral Lassalle is currently offline Jose Maria Jesus Cabral LassalleFriend
Messages: 136
Registered: February 2016
Senior Member
Hi, here are the FBT file to be used in 4DIAC and the cpp and h file to compile in forte. Follow https://www.eclipse.org/4diac/documentation/html/installation/install.html#ownFORTE to build forte with the new FB.
  • Attachment: PWM.fbt
    (Size: 5.47KB, Downloaded 140 times)
  • Attachment: PWM.h
    (Size: 3.32KB, Downloaded 69 times)
  • Attachment: PWM.cpp
    (Size: 5.78KB, Downloaded 61 times)
Re: How to add wiringPi library to access the softPWM functions. [message #1778630 is a reply to message #1778578] Tue, 19 December 2017 06:37 Go to previous messageGo to next message
Barry wan is currently offline Barry wanFriend
Messages: 40
Registered: July 2017
Member
Thank you very much for your sharing

[Updated on: Tue, 19 December 2017 06:55]

Report message to a moderator

Re: How to add wiringPi library to access the softPWM functions. [message #1795057 is a reply to message #1778578] Thu, 13 September 2018 18:25 Go to previous messageGo to next message
Rodrigo Esposito is currently offline Rodrigo EspositoFriend
Messages: 24
Registered: August 2016
Junior Member
How do i import this block on 4diac IDE?
Re: How to add wiringPi library to access the softPWM functions. [message #1795063 is a reply to message #1795057] Thu, 13 September 2018 19:58 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 866
Registered: January 2014
Senior Member
jsut copy paste the fbt file into your projects type library directory.
Re: How to add wiringPi library to access the softPWM functions. [message #1795176 is a reply to message #1795063] Mon, 17 September 2018 20:20 Go to previous messageGo to next message
Rodrigo Esposito is currently offline Rodrigo EspositoFriend
Messages: 24
Registered: August 2016
Junior Member
Thank you very much for your response.
I'm trying to use the pwm block and I'm having this Response ID: "Unsupported_Type" The runtime Device Manager has returned an Error of type Unsupported_Type . In the images are the console outputs. I'm running the fort on raspberry and the version was built according to image 3. Could someone help me? I have the wiringPi library installed on raspberry and I ran a test with an application in c and it worked.
Re: How to add wiringPi library to access the softPWM functions. [message #1795205 is a reply to message #1795176] Tue, 18 September 2018 11:25 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 866
Registered: January 2014
Senior Member
If you are getting unsuported type it typcially means that the forte you are running does not contain the FB. Have you ensured that during recompilation of FORTE the cpp file of your pwm was compiled. I noticed that in some odd cases the build process didn't generate a forte executable. Therefore it make sense to check if the data of your forte executable file has changed (this costed me last week at least half an hour error searching).

Then if you have several fortes are you starting the right one.

Finally is there already a forte running on your system, e.g., started from systemd or init.d. Better check with ps -aux | grep forte and if yes kill it first.
Re: How to add wiringPi library to access the softPWM functions. [message #1795232 is a reply to message #1795205] Tue, 18 September 2018 20:46 Go to previous messageGo to next message
Rodrigo Esposito is currently offline Rodrigo EspositoFriend
Messages: 24
Registered: August 2016
Junior Member
I was compiling it an external module and it was not working, so i just created a directory under src/modules and cmake could read and compile in the right way. Thank you once again!
Re: How to add wiringPi library to access the softPWM functions. [message #1795233 is a reply to message #1795232] Tue, 18 September 2018 20:51 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 866
Registered: January 2014
Senior Member
Oh. Thanks to let us know. It looks like that the external modules directory feature is still a bit fragile to use. The important point here is that the structure of the external modules directory is simular to the internal modules directory. That means the directory you specify as external modules directory has to have the different modules as sub directories and not directly the module itself.
Re: How to add wiringPi library to access the softPWM functions. [message #1798458 is a reply to message #1740482] Mon, 19 November 2018 12:08 Go to previous messageGo to next message
Siyu Zhang is currently offline Siyu ZhangFriend
Messages: 3
Registered: August 2018
Junior Member
Alois Zoitl wrote on Sun, 14 August 2016 18:20
Hi,

you need to specify the library you want to add in the CMakeList.txt file with the forte_add_link_library command. You can have a look at the mqtt_paho module for examples on how you can do this.

No you don't need to add this to your local forte. You only need add the libraries for the specific platforms.

Alois


Thank you Alois.

Could you kindly provide some detailed information on how to change the CMakeList file and inside which folder?

For example, I want to add libiec61850 library https://libiec61850.com/libiec61850/documentation/. I downloaded it and moves it inside the FORTE folder. After compiling, a static library libiec61850.a is created.

Thank you.
Re: How to add wiringPi library to access the softPWM functions. [message #1798602 is a reply to message #1798458] Tue, 20 November 2018 23:00 Go to previous message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 866
Registered: January 2014
Senior Member
You would normally do that in your own modules. The best is to setup an external modules directory outside of your 4diac FORTE source code and reference it in your cmake setup (look for the external modules directory option). This keeps your changes nicely seperated from the 4diac FORTE code and makes it easier to update 4diac FORTE.

In the CmakeList.txt in your module you can then add your own FBs and additional C/C++ code you need or reference libraries and include directories. For the latter you can use:
* forte_add_include_directories
* forte_add_link_directories
*forte_add_link_library

You can see the different 4diac FORTE modules for examples of how these options are used.

In all cases to make your life easier keep the code of the libraries, your code, 4diac FORTE code separate.

Cheers,
Alois

P.S.: Just in case you missed it: When you are not paying libiec61850 is provided under GPLv3. GPLv3 is not compatible with 4diac's EPL. This may cause legal issues.

[Updated on: Tue, 20 November 2018 23:01]

Report message to a moderator

Previous Topic:fatal error LNK1169 when building forte
Next Topic:Forte not compiling for Wago PFC200
Goto Forum:
  


Current Time: Thu Aug 22 00:52:53 GMT 2019

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

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

Back to the top