Hello community,
I am trying to exchange some data between a Codesys solution with a RevPi_Virtual device and a Python script that accesses the virtual device's process image via "f = open("/dev/piControl0", "wb+",0);", thinking this is one of the virtual device's intentions. I couldn't run it, so I decided to investigate the problem.
It shows the same behavior when I use "piTest -w ..." on the command line, as you can see in the attached images. When I write into the first byte of the device, all the other bytes are also set. When writing into the other bytes, nothing happens.
From there I don't know if I'm doing something wrong or if the connection (data processing) between Codesysruntime and RevPi is not working?
Can anyone confirm the behavior or give advice on how to do it right?
RevPi Virtual Device wrong data handling for Inputs
RevPi Virtual Device wrong data handling for Inputs
- Attachments
-
- set0.png (54.82 KiB) Viewed 16530 times
-
- set1.png (61.48 KiB) Viewed 16530 times
Re: RevPi Virtual Device wrong data handling for Inputs
Hello beusterh,
I want to let you know that CODESYS override the configuration of PiCtory. CODESYS writes all 32 bytes of Virtual outputs cyclically. Two applications cannot have write access to those virtual bytes address space, and they would be overwritten by CODESYS application. Could you please post here the device Tree of your System in CODESYS?
Make sure you are running your application on a suitable system. For that, please have a look at the CODESYS checklist.
I recommand you an easier way to access to the Process Image with python Using RevPiModIODriver from the Framework RevPiModIO.
In help file of Revolution Pi Library for CODESYS V1.3.0.0 (ID: 9721) is a note under chapter
How to Configure RevPi Virtual Device
Note: The outputs of the RevPi Virtual device in CODESYS are written to the virtual inputs (Input_11_1 to Input_11_32) of the RevPi process image. External applications can write to virtual outputs (Output_1 to Output_32). These are then available as inputs of the RevPi Virtual device in CODESYS.<<
The python script should not write to address space where CODESYS writes all 32 bytes. It can write to aread of 32 bytes which CODESYS reads
Best Regards
Ulrich Kouatang Biakoup | Technical Support
I want to let you know that CODESYS override the configuration of PiCtory. CODESYS writes all 32 bytes of Virtual outputs cyclically. Two applications cannot have write access to those virtual bytes address space, and they would be overwritten by CODESYS application. Could you please post here the device Tree of your System in CODESYS?
Make sure you are running your application on a suitable system. For that, please have a look at the CODESYS checklist.
I recommand you an easier way to access to the Process Image with python Using RevPiModIODriver from the Framework RevPiModIO.
In help file of Revolution Pi Library for CODESYS V1.3.0.0 (ID: 9721) is a note under chapter
How to Configure RevPi Virtual Device
Note: The outputs of the RevPi Virtual device in CODESYS are written to the virtual inputs (Input_11_1 to Input_11_32) of the RevPi process image. External applications can write to virtual outputs (Output_1 to Output_32). These are then available as inputs of the RevPi Virtual device in CODESYS.<<
The python script should not write to address space where CODESYS writes all 32 bytes. It can write to aread of 32 bytes which CODESYS reads
Best Regards
Ulrich Kouatang Biakoup | Technical Support
Re: RevPi Virtual Device wrong data handling for Inputs
Hello,
and thank you very much for your support.
My configuration followed exactly all the guidelines and I understand the swapping of inputs and outputs. But in the end, only using the following versions of all software components gave the desired success:
CODESYS Runtime 3.5.17
CODESYS Controller for Raspberry Pi MC SL - 4.6.0.0
Revolution Pi library for CODESYS RevolutionPiBridge V1.2.1.0
2022-07-28-revpi-buster.img
I don't know if there is another solution, but I think this should be marked as a bug in the current versions and fixed.
With kind regards
HB
and thank you very much for your support.
My configuration followed exactly all the guidelines and I understand the swapping of inputs and outputs. But in the end, only using the following versions of all software components gave the desired success:
CODESYS Runtime 3.5.17
CODESYS Controller for Raspberry Pi MC SL - 4.6.0.0
Revolution Pi library for CODESYS RevolutionPiBridge V1.2.1.0
2022-07-28-revpi-buster.img
I don't know if there is another solution, but I think this should be marked as a bug in the current versions and fixed.
With kind regards
HB
Re: RevPi Virtual Device wrong data handling for Inputs
Hello,
I recommend you this:
- CODESYS Controller for Raspberry Pi MC SL - 4.6.0.0
- CODESYS Runtime 3.5.18
-Revolution Pi Library for CODESYS V1.3.0.0 (ID: 9721)
CODESYS Runtime 3.5.17 is incompatible with CODESYS Controller for Raspberry Pi MC SL - 4.6.0.0
Best Regards
Ulrich Kouatang Biakoup | Technical Support
I recommend you this:
- CODESYS Controller for Raspberry Pi MC SL - 4.6.0.0
- CODESYS Runtime 3.5.18
-Revolution Pi Library for CODESYS V1.3.0.0 (ID: 9721)
CODESYS Runtime 3.5.17 is incompatible with CODESYS Controller for Raspberry Pi MC SL - 4.6.0.0
Best Regards
Ulrich Kouatang Biakoup | Technical Support