Page 1 of 1

Codesys cannot find ConCAN

Posted: 29 Jan 2021, 16:11
by Elon Sha
Hi,

I am using Connect module and ConCAN module. I want to use Codesys to implement CanOpen communication. However, things didn't go so smoothly.

I have updated my image to the latest version. I am using CODESYS Control for Raspberry PI 3.5.16.0.package and RevolutionPiBridgeV1.0.1.99.package.

At the left side of the connect module, I attached an AIO module and it worked well in codesys. I attached a ConCAN module on the left side of connect module. But, when I tried to run the program, a red triangle appears on the left side of the ConCAN module which means Codesys cannot find the ConCAN module.

I tried to create a script in this tutorial and reboot the device. But it doesn't work.
https://revolution.kunbus.com/tutorials ... en-master/

If I use the command "ifconfig -a", I can see the can0 interface in the list. But it doesn't work in codesys.

I also tried to see the codesys log, please see the attachments.

Re: Codesys cannot find ConCAN

Posted: 01 Feb 2021, 08:14
by f_und_e
Elon Sha wrote: 29 Jan 2021, 16:11 I attached a ConCAN module on the left side of connect module. But, when I tried to run the program, a red triangle appears on the left side of the ConCAN module which means Codesys cannot find the ConCAN module.
Hello,

You need to attach it to the right side of the connect, you have to do the same thing in Codesys as well - then it will be detected.
concacn_codesys.PNG
concacn_codesys.PNG (5.83 KiB) Viewed 7494 times

Sadly, I do not understand how to use it once it's attached in Codesys... If I follow the procedure from the tutorial, nothing works.

Best regards

Re: Codesys cannot find ConCAN

Posted: 01 Feb 2021, 08:55
by Elon Sha
I made a mistake in the previous post. I did connect the ConCAN module to the right side of the connect module and did the same thing in Codesys. I can also see the CAN interface through the "ifconfig -a" command, but codesys cannot detect the existence of the ConCAN module.

Re: Codesys cannot find ConCAN

Posted: 17 Feb 2021, 10:40
by Amar
Here is an example Codesys Connect project with Con CAN.
Download Link:
https://kunbusgmbh-my.sharepoint.com/:u ... g?e=EiwGB0
or
https://kunbusgmbh-my.sharepoint.com/:u ... Q?e=Wl0ZD6


For Configuring Con CAN module you need to :
create script for setting baud rate:
sudo nano /var/opt/codesys/rts_set_baud.sh

#!/bin/sh
BITRATE=`expr $2 \\* 1000`
ifconfig $1 down
echo ip link set $1 type can bitrate $BITRATE
ip link set $1 type can bitrate $BITRATE
ifconfig $1 up

Make the script executable
sudo chmod +x /var/opt/codesys/rts_set_baud.sh

Enable con CAN from command
sudo revpi-config enable revpi-con-can

or
Enable con CAN from pictory

Download the Codesys Program

Important: Thereafter, a reboot is required

Then check codesys status
also cross check with command piTest -d if Con CAN module is found.

If you still have issues, then please send us your Project and kernel log for investigation.

Regards,
Amar