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 » 4Diac Forte and Bacnet(Using Forte on STM32MP257C Device with BacNet)
4Diac Forte and Bacnet [message #1817317] Wed, 20 November 2019 11:21 Go to next message
Niklas Huhs is currently offline Niklas HuhsFriend
Messages: 13
Registered: October 2019
Junior Member
Hello all,

I am working on a project using a STM32MP157C-DK2 which is running FORTE on the openSTlinux Kernel.
So far everything was very straight forward as the setup is similar to a raspberry pi.
It uses posix architecture and the sysfs Processinterface.
I am now looking for a way to use the System with BacNet support.
If anyone is already working on it, every bit of help would be appreciated.

best regards,
Niklas Huhs
Re: 4Diac Forte and Bacnet [message #1817373 is a reply to message #1817317] Thu, 21 November 2019 11:14 Go to previous messageGo to next message
Alexander Tepaev is currently offline Alexander TepaevFriend
Messages: 3
Registered: November 2019
Junior Member
Hello Niklas,

I am currently working on a bachelor's thesis which focuses on integrating BACnet into 4DIAC. I am using the BACnet stack library [1] for all of the BACnet related operations.

How to use it on your system? One possible (and the easiest) way is to use Client/Server Service FBs and to implement a new communication protocol following this page [2], which will use the functionality provided by the BACnet Stack library (see bacnet-stack/demos folder for examples). This means that for every BACnet Service Request/Object you will need a Client/Server Function block.

Another possible approach (that's the one I am implementing) is to use a number of daisy-chained service function blocks, which are responsible for setting up the communication sockets and needed BACnet objects (in case you want your 4diac app to act as a server), or configuring BACnet service requests (in case your app is a client). This approach is based on the generic I/O concept introduced in FORTE 1.9.0. ATM I am able to configure and to issue ReadProperty service. My plan is to implement the WriteProperty and COVSubscribe services for the client-side, and Analog/Binary Input/Output/Value objects for the server-side. Here, again, I am using the BACnet Stack for encoding/decoding the PDUs and managing transaction state machines.

Hope it helps :)

Regards,
Alexander Tepaev

P.S. I work at a slow but steady pace, so I cannot tell you when I am going to finish it, but If you are interested in the second approach, feel free to contact me. Any piece of feedback would be highly appreciated.

[Updated on: Thu, 21 November 2019 19:03]

Report message to a moderator

Re: 4Diac Forte and Bacnet [message #1817446 is a reply to message #1817373] Fri, 22 November 2019 09:58 Go to previous messageGo to next message
Jose Maria Jesus Cabral Lassalle is currently offline Jose Maria Jesus Cabral LassalleFriend
Messages: 168
Registered: February 2016
Senior Member
Hi Niklas,

I'm using a similar board as yours (STM32MP157A-DK1), and I have a forte running on openSTlinux. But in the terminal, I cannot find the sysfs folders for the gpio. If I look in /sys/class/ folder, there's no gpio in it, which is the case for the RPi. Did you do something special to access the IOs in your board, or your board just showed the gpios by default?

Regards,

Jose
Re: 4Diac Forte and Bacnet [message #1817454 is a reply to message #1817446] Fri, 22 November 2019 11:45 Go to previous messageGo to next message
Niklas Huhs is currently offline Niklas HuhsFriend
Messages: 13
Registered: October 2019
Junior Member
Thanks for your help Alexander. I will give the first option a try as a start. but the second one looks very interesting as well. I am sure that I will contact you about that soon.

To Jose:
I had the same problem. I reconfigured the Kernel. (used the developer version) like its shown here: https://wiki.st.com/stm32mpu/wiki/Modify,_rebuild_and_reload_the_Linux®_kernel
make sure the SDK is installed first.( step 5.1 here: https://wiki.st.com/stm32mpu/wiki/STM32MP1_Developer_Package#Starting_up_the_SDK )

and before step 4 I used "make menuconfig" and under "Device drivers ->GPIO support" activated "sys/class/gpio interface"(its called something like that but you will see it).

after building the image, pushing it into the board and rebooting, I was able to use the GPIOs.

Best regards
Niklas

[Updated on: Fri, 22 November 2019 23:38]

Report message to a moderator

Re: 4Diac Forte and Bacnet [message #1817495 is a reply to message #1817454] Sun, 24 November 2019 08:30 Go to previous messageGo to next message
Jose Maria Jesus Cabral Lassalle is currently offline Jose Maria Jesus Cabral LassalleFriend
Messages: 168
Registered: February 2016
Senior Member
Hi Niklas,

thanks a lot for the tip! it worked perfectly... I can see now the /sys/class/gpio folder. Thanks!

I want to test the sysFs layer of forte now. I have two questions, maybe you could help me with them:
1- Do you know where to find the mapping from gpio number to actual IOs in the board? I thought in using one of the LEDs and a button, but I cannot find any documentation that gives me an idea to which gpio they correspond?
2- I was previously trying to enable the SPI4 and tried some things in the linux source. When I updated now with only the changes you mentioned, I can still se /sys/class/spide/spi0.0 /sys/class/spide/spi0.1 which according to the registers ($ ls -l /sys/cass/spidev/ ), they correspond to SPI4. I'm not sure if I forgot to disable them somewhere, or they are enabled by default when enabling the /sys/class/gpio interface. Do you also see them in your board?

Again, thanks for tip!

Jose
Re: 4Diac Forte and Bacnet [message #1817514 is a reply to message #1817495] Mon, 25 November 2019 09:36 Go to previous messageGo to next message
Niklas Huhs is currently offline Niklas HuhsFriend
Messages: 13
Registered: October 2019
Junior Member
Hi Jose,
I will do my best to answer your questions:
1. here https://wiki.st.com/stm32mpu/wiki/STM32MP157X-DKX_-_hardware_description#GPIO_expansion_connector at no. 6 you can find an overview of the GPIO mapping. If you cant find everything you need there, maybe you could use the STM32CubeMX. Use the board selector in the software, select the board and load the default layout. Then you should see all the Pins and their function.

2.On my board I cannot see the directory you mentioned. I only see the spi-master and the spidev directory which seem to be empty.

hope I was able to help you.

best regards,
Niklas
  • Attachment: spide.png
    (Size: 131.74KB, Downloaded 6 times)
Re: 4Diac Forte and Bacnet [message #1817531 is a reply to message #1817373] Mon, 25 November 2019 13:39 Go to previous messageGo to next message
Niklas Huhs is currently offline Niklas HuhsFriend
Messages: 13
Registered: October 2019
Junior Member
Hello Alexander,

I just have some questions to make sure I understand correctly:

To implement a new communications protocol I will have to create code which uses the described functions like sendData recvData and so on. where sendData creates and object?

Is it right to create top, middle and bottom layer or is it possible to use existing layers from the com_infra in forte?

thanks again for the help.

regards
Niklas




Re: 4Diac Forte and Bacnet [message #1817596 is a reply to message #1817531] Tue, 26 November 2019 11:53 Go to previous messageGo to next message
Jose Maria Jesus Cabral Lassalle is currently offline Jose Maria Jesus Cabral LassalleFriend
Messages: 168
Registered: February 2016
Senior Member
Hi Niklas,

thanks for your answers. Exactly what I needed. The Pinout seems to be exactly as in the rpi.

Re: 4Diac Forte and Bacnet [message #1817626 is a reply to message #1817531] Tue, 26 November 2019 21:41 Go to previous messageGo to next message
Alexander Tepaev is currently offline Alexander TepaevFriend
Messages: 3
Registered: November 2019
Junior Member
Hey ;)

Niklas Huhs wrote on Mon, 25 November 2019 13:39
where sendData creates and object?


If I understood you correctly and by "sendData creates an object" you mean "creates a network packet", then yeah, that is how I see it as well.

Niklas Huhs wrote on Mon, 25 November 2019 13:39
Is it right to create top, middle and bottom layer or is it possible to use existing layers from the com_infra in forte?


I remember that I put top+middle layers into one layer and I wanted to use the existing CIPComLayer class (see cominfra/ipcomlayer.[h | cpp]) as a bottom layer for managing the UDP sockets, but something stopped me from doing it and eventually everything ended up in a single layer (a layer + an external event handler for doing the sendto(...)/recv(...) thing). I can't tell you what exactly stopped me, since I don't have access to my code during weekdays, but I will be able to look at it on the coming weekend. What really helped me is to look at the implementation of supported protocols, especially HTTP and OPC_UA (forte 1.10, 'cause there is a new OPC_UA implementation in 1.11).
Re: 4Diac Forte and Bacnet [message #1817657 is a reply to message #1817626] Wed, 27 November 2019 10:55 Go to previous messageGo to next message
Niklas Huhs is currently offline Niklas HuhsFriend
Messages: 13
Registered: October 2019
Junior Member
thanks a lot!
Re: 4Diac Forte and Bacnet [message #1818173 is a reply to message #1817657] Mon, 09 December 2019 10:48 Go to previous messageGo to next message
Niklas Huhs is currently offline Niklas HuhsFriend
Messages: 13
Registered: October 2019
Junior Member
Hi Alexander,

I was working on a different topic for the last couple of days and will probably look into bacnet support again next week.
I was just wondering if you were able to look into your code at the weekend?

best regards,
Niklas Huhs
Re: 4Diac Forte and Bacnet [message #1818486 is a reply to message #1818173] Tue, 17 December 2019 09:25 Go to previous messageGo to next message
Alexander Tepaev is currently offline Alexander TepaevFriend
Messages: 3
Registered: November 2019
Junior Member
Sorry for the delayed answer - preholiday stress :)
I am looking at it right now, and yeah, I implemented it as a single layer.

Were you able to include the bacnet stack library into your communication layer code? There is a naming conflict between FORTE's device.cpp and the library, simply rename [bacnet_root]/demo/object/device.c before compiling it.
I am ready to share my code with you, write me a PM if you're interested.

KR
Re: 4Diac Forte and Bacnet [message #1818520 is a reply to message #1818486] Wed, 18 December 2019 12:03 Go to previous message
Niklas Huhs is currently offline Niklas HuhsFriend
Messages: 13
Registered: October 2019
Junior Member
No Problem. :)

I actually took another approach. Because my project will only need the write property/read property functionality, I want to implement those as Service Interface FBs where each Block creates and sends out/receives Data packets. (I used Wireshark to analyse the content of the messages being sent between BacNet devices and will simply rebuild the header/payload in the SIFB code).
Still it would be interesting to see your code.

edit: private messaging seems to be disabled in the forum. would you kindly post an email address where I could contact you? or just contact me under "n.huhs@stud.hs-wismar.de"


best regards

[Updated on: Wed, 18 December 2019 15:52]

Report message to a moderator

Previous Topic:Error when using the INIT event
Next Topic:Integrating LUA with Docker
Goto Forum:
  


Current Time: Thu Jan 23 06:02:37 GMT 2020

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

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

Back to the top