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 » SPI on Raspberry Pi | 4DIAC(how can i wrap an SPI Library into 4DIAC)
SPI on Raspberry Pi | 4DIAC [message #1817906] Mon, 02 December 2019 22:25 Go to next message
Jakob Blum is currently offline Jakob BlumFriend
Messages: 5
Registered: December 2019
Junior Member
Hello,

i am new to 4DIAC and would need some help please.

I want to use 4DIAC to setup a CAN Network running on Raspberry PI's. I am using DEBO CAN MODULES that can be controlled via an SPI Interface. Therefore i would need SPI functionality in DIAC4.

The problem is i dont really know how to proceed here. I read somewhere else that C libraries can be integrated into function blocks. Are there any tutorials on this topic or could someone explain to me how its done?

thank you very much and best regards

Re: SPI on Raspberry Pi | 4DIAC [message #1818010 is a reply to message #1817906] Wed, 04 December 2019 08:11 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 916
Registered: January 2014
Senior Member
Hi,

you can have a look at the FB creation tutorial and their specifically on the Service Interface Function Block section. What kind of CAN communication do you like to do? Is it like publish/subscribe then pelase read the documentation section on the communication architecture. If it is I/Os then I can only offer you code examples. Especially the Embrick module should be similar to what you need.

I hope this helps to get you started.
Re: SPI on Raspberry Pi | 4DIAC [message #1818021 is a reply to message #1818010] Wed, 04 December 2019 10:19 Go to previous messageGo to next message
Jakob Blum is currently offline Jakob BlumFriend
Messages: 5
Registered: December 2019
Junior Member
thank you for your reply! Some new questions came up now :)

I did not think of what kind of Can Communication i like to do, isnt the can communication handled by the Can Modules which are controlled via the SPI interface?

Do you know of a more direct way to incorporate Can Communication to 4DIAC without having to use an additional protocol? I would need as much control over the communication as possible. Maybe i have to rethink my concept

thank you and best regards
Re: SPI on Raspberry Pi | 4DIAC [message #1818048 is a reply to message #1818021] Wed, 04 December 2019 18:18 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 916
Registered: January 2014
Senior Member
The reason I'm asking is mainly target towards how you would like to represent your requried CAN communication in IEC 61499. The most flexiblity you have when you are using a Publish subscirbe interface where you send plain CAN messages. However then you have to write FBs that will generate the messages and do all the padding and stuff (i.e., CAN messages have at max 8 bytes).

If you have other use cases you may want to do more in C++ code and have a simpler interface on IEC 61499 side.
Re: SPI on Raspberry Pi | 4DIAC [message #1818054 is a reply to message #1818048] Wed, 04 December 2019 21:05 Go to previous messageGo to next message
Jakob Blum is currently offline Jakob BlumFriend
Messages: 5
Registered: December 2019
Junior Member
i am planningto expand the CAN communication later with an ECYCLE FB in order to realise a time triggered behaviour

therefore would it be neccessary to use the Publish Subscripe interface approach or would it be sufficient to use C++?
Re: SPI on Raspberry Pi | 4DIAC [message #1818055 is a reply to message #1818054] Wed, 04 December 2019 21:10 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 916
Registered: January 2014
Senior Member
With the information given so far I would say both is possible. However if on the other end of the CAN only IO modules or IO module like devices are connected I think the IO concept is the better solution.

However for starting the pub/sub approach may be easier (especially better documented)
Re: SPI on Raspberry Pi | 4DIAC [message #1818056 is a reply to message #1818055] Wed, 04 December 2019 21:42 Go to previous messageGo to next message
Jakob Blum is currently offline Jakob BlumFriend
Messages: 5
Registered: December 2019
Junior Member
The plan is to have a network of Pi's that communicate over the bus in that way, so no IO modules i guess.

As for the documentation, can you provide me a few links or is the documentation section on the communication architecture all there is? I am really just at the beginning for now..

thank you for your help so far. it is very much appreciatet!

Re: SPI on Raspberry Pi | 4DIAC [message #1818057 is a reply to message #1818056] Wed, 04 December 2019 21:50 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 916
Registered: January 2014
Senior Member
This speaks more for the pub/sub solution. In our documentation there is a section on our communication architecture [1]. But I would strongly recommend to also work through the tutorials first. Feedback on both is very welcome. The documentation is maintained as part of the 4diac IDE source code.

[1] https://www.eclipse.org/4diac/en_help.php?helppage=html/development/forte_communicationArchitecture.html
Re: SPI on Raspberry Pi | 4DIAC [message #1818059 is a reply to message #1818057] Wed, 04 December 2019 22:22 Go to previous message
Jakob Blum is currently offline Jakob BlumFriend
Messages: 5
Registered: December 2019
Junior Member
thank you! i will read through the docs and let you know when there are any uncertainties
Previous Topic:Profinet support
Next Topic:Problems to compile FORTE+Modbus
Goto Forum:
  


Current Time: Sun Dec 15 01:07:44 GMT 2019

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

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

Back to the top