ros-industrial-attic / siemens_experimental

Apache License 2.0
8 stars 6 forks source link

Adding support to siemens CP1626 #14

Open farshbafdoustar opened 5 years ago

farshbafdoustar commented 5 years ago

I'm working on a project with cp1626 to drive different modules based on Profinet. I have found out that the main API from Siemens side (that is based on IO-Base PN Library) is the same for most of the CP boards. For example in comparision of CP1616 and CP1626, I have found some differences in IO Device side but the IO Controller is more or less the same.

As I want to contribute to ROS industrial Profinet packages, the question is how to share my code. Should we have another project for cp_1626 inside siemens_experimental or making the current cp_1626 generic to support more Siemens CP boards.

On one side, making it generic has some advantages for the future integration and applications but on the other side it needs more work for testing on different CP boards (Time requirements and avalability of the boards to test)

Any body has any idea how to proceed ? Thanks in advance

WaelTouzri commented 4 years ago

Hello, we are currently working on an university project, that is using the siemens CP 1626 Profinet PCIe in order to enable a Profinet communication between our IPC and the S7-1500 PLC. You have mentioned that you have found some differences between the IO Device part of the CP 1616 and the CP 1626. May you please share your CP 1626 related code. It will be a great assistance for our project. Thank you very much

farshbafdoustar commented 4 years ago

Hi, those days I have used the CP1626 as IO controller, ported the package to be a HW interface for ROS_CONTROL and did not continue to finalize the IO device side. You can find my repo here. I have made just a bug fix on initialization for IO controller. Generally, it is not that much difficult to configure and run PROFINET communication based on ROS TOPICS with this package. It is nearly straight forward and somehow well documented here. I would be happy to help if you encounter any problem.

WaelTouzri commented 4 years ago

Hi, thank you very much for your prompt reply. So what I have understood is that one has to use the codes of the CP 1616 also for the CP 1626, is it correct? We are also facing an issue regarding the installation of the driver of the PCIe. To install the driver, we were following the instructions given in the tutorial you have mentioned (wiki ros cp 1616), however we faced some errors after trying to execute the 'makefile'. (Some errors are related to linux-headers-4.15.0-45-generic which was already well installed). Do you think that is due to the compatibility between the CP 1626 and the ubuntu version we are using (Ubuntu 16.04) pdfjoiner.pdf

farshbafdoustar commented 4 years ago

You are right. You can use this package also with CP1626. about the wait_queue_t problem: I have also faced that. The problem is that after kernel version 4.13.0 the wait_queue is changed so in order to compile the driver without modification to the code we should use a version lower than this. I'm currently using kernel 4.9.178 that has a PREEMPT_RT patch(4.9.178-rt131). Just be careful about the drivers when you downgrade the kernel. Specially network driver should ( / may need to) be patched / updated on new HWs.

I have prepared one Kernel with the new drivers already patched and installed. You can find it in this branch. After cloning the repo, follow the procedure here .

WaelTouzri commented 4 years ago

Hello,

This would hopefully help us solve our issues for now. Thank you very much for your help and taking your time to reply to us.

prasanthRJ7 commented 4 years ago

Hello, Hope you are doing good! I have a similar doubt as @WaelTouzri has mentioned above. I have done every step you said and I have successfully downgraded the Kernel to 4.4.32 Apollo and to be able to log-in I had to uninstall the Nvidia Driver (in Terminal: Client has 410.79 and this kernel version has module 375.39 ) else I can't get access to the new kernel as It keep getting Login loop.

After being able to access the ubuntu 16.04, I figured out as you mention that we have a network problem (no LAN, no WLAN). (For the lo.. 127.0.0.1 and the mask 255.0.0.0 and for eth0 Ip address 172.170.1 and mask 255.255.0.0). Do you think, we need to install some packages to get a solution for the above stated issue? Thank you. Hope to hear from you soon .

Cheers Prasanth

farshbafdoustar commented 4 years ago

Hi Prasanth, What is the config of the HW you are using? you can find the driver for the Network Card and install it separately. Or as I have done here for e1000e_I21_LM12 , patch it inside the Kernel drivers. If you have the same Card as e1000e_I21_LM12 you can use the Kernel I prepared here.

Be careful to switch the branch after cloning to feature-branch-cp1626

prasanthRJ7 commented 4 years ago

Hi, Thanks for providing the required information which solved the issue of mine. If you don't mind I have doubt regarding configuration of cp 1626 in TIA portal v15.1 as I tried to add the cp 1626 to the pc station to configure the card I was not able to add the specific card in the version v14 and v 15.1 as well . so i tried with cp 1616 since the are largely similar even then I faced error in loading the compatible device. WhatsApp Image 2020-07-28 at 10 23 00 AM WhatsApp Image 2020-07-28 at 12 21 29 PM WhatsApp Image 2020-07-28 at 12 21 38 PM

.

WaelTouzri commented 4 years ago

Hi @farshbafdoustar thank you very much for the information you have provided, this was really helpful. We were finally able to downgrade correctly the kernel and to fix the network driver issue, and we could finally install the driver on Ubuntu. Before using the CP 1626 module, one has to finalize the configuration on TIA Portal. The configuration process on TIA Portal of the CP 1626 is different from the one of CP 1616 (According to siemens the cp1626 should not be configured into a PC-Station like the cp 1616). Do you know how the configuration process of the CP 1626 should be done? It would be very kind of you to provide me with more information related to the manipulation of TIA Portal.

Thank you again for your time and Consideration !!

farshbafdoustar commented 4 years ago

Hi @prasanthRJ7 and @WaelTouzri ,

Nice to hear that the information helped. As I can remember, the difference between CP1616 and CP1626 was that the CP1616 should be installed inside a PC in TIA portal but CP1626 is a Development Kit. Capture

Normally TIA portal filters the Catalog of available devices based on what is already selected inside the topology view. So disable the Filter check box.

CP1626 DevKit should be found in the following location in catalog tree (beside the other cards like CP1616): PC Systems > Communications Model > PROFINET/Ethernet > CP1626 > 6GK1 123-6AA01

You can also Update your TIA portal via Totally Integrated Automation UPDATER inside the Siemens Automation(Program Files Menu). Inside the updater select also the supported Packages and install all of them when approprate.

prasanthRJ7 commented 4 years ago

Hi,

Thank you for taking your time and explaining to us in much clear way and we solved the previous issue. But I am still having the issue of not able to connect to the internet. I tried wih open suse 13.2 kernel version 3.16 and ubuntu 16.06 with the kernel version which you provide above 4.4.32 apollo but still the issue is same. After installing the OS the network driver is not working. Could you please help me out here and if possible can you please provide me the for procedure for 4.9.178 that has a PREEMPT_RT patch(4.9.178-rt131) for installing which you said your currently using it successfully for communication between cp 1626 and ros which might be really helpful for us as well.

If its okay with you can I contact you via e-mail? if please provide me the same here.

looking forward to hear from you soon.

Regards, Prasanth

prasanthRJ7 commented 4 years ago

Hallo,

I have a update to my previous post. We can now connect to the internet and able to login without any issue in the Suse Linux 13.2. But for installing the cp 1626 driver we are facing the issue after the make file command I attached the picture that shows the error which we are facing currently. Can you please provide some insights to them. It would be really helpful. Looking forward to your response.

Best regards, Prasanth WhatsApp Image 2020-08-04 at 4 54 47 PM WhatsApp Image 2020-08-04 at 4 55 24 PM

farshbafdoustar commented 4 years ago

Hi,

Thank you for taking your time and explaining to us in much clear way and we solved the previous issue. But I am still having the issue of not able to connect to the internet. I tried wih open suse 13.2 kernel version 3.16 and ubuntu 16.06 with the kernel version which you provide above 4.4.32 apollo but still the issue is same. After installing the OS the network driver is not working. Could you please help me out here and if possible can you please provide me the for procedure for 4.9.178 that has a PREEMPT_RT patch(4.9.178-rt131) for installing which you said your currently using it successfully for communication between cp 1626 and ros which might be really helpful for us as well.

If its okay with you can I contact you via e-mail? if please provide me the same here.

looking forward to hear from you soon.

Regards, Prasanth

Hi Prasnth, for building the 4.9.178-rt131, clone the repo and change the branch to feature-branch-cp1626. then inside the linux folder run : ./build.sh rt this will generate the Kernel inside the kernel folder. then you can extract the generated achive file and runn the script ./install_kernel.sh inside.

Best

prasanthRJ7 commented 4 years ago

Hallo farshbafdoustar,

Thanks for your reply and sorry for late reply. Unfortunately, Due to time constraints we used open suse to solve the issue but thank you once again foryour guidance thought to let you know and thanks for helping us by taking your time and replying to our doubts. But Saying that we might still need your guidance:) for connecting cp 1626 via development kit to establish connect communication between them. And we would like to know how you managed to connect cp card IO base library (C++ language) and the python? regards, prasanth