CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum by 3S-Smart Software Solutions GmbH | A member of the CODESYS Group
Deutsche Version English version russian version 
It is currently Sun Dec 16, 2018 6:49 pm

All times are UTC+01:00




Post new topic  Reply to topic  [ 8 posts ] 
Author Message
 Post subject: CANbus Baud rate issue
PostPosted: Mon Oct 22, 2018 2:56 am 
Offline

Joined: Thu Feb 11, 2016 4:06 am
Posts: 37
I've been running a Pi3 with sp13 and Canbus at 250k for a few months now without issue. I've had to extend my network and have decided to lower the rate to 100k.
I switched the modules and then the codesys master and found that once I make the change, codesys stops transmitting packets. It will recieve packets but not transmit them.
If i bring up the interface using ifconfig, I can see that the can0 interface is receiving messages but not transmitting any. I add a sniffer to the network and connect at 100k and can confirm that the modules are transmitting at 100k but the master is not sending messages over the network. As soon as I change the slaves and the master within codesys back to 250k, then codesys transmits messages again. I've included the log file but there is nothing abnormal about it.

Any idea what would cause codesys to stop transmitting messages at different baudrates?


You do not have the required permissions to view the files attached to this post.


Top
   
PostPosted: Tue Oct 23, 2018 6:11 am 
Offline

Joined: Thu Feb 11, 2016 4:06 am
Posts: 37
I've been able to narrow the issue down to codesys. With the network set to 100kbs I can send and receive can messages using the cansend can0 and candump can0 commands without any issue. However, Codesys will receive all can messages but will never transmit a message. If i use the Ifconfig command. The RX count increases but the TX count only increases when I use the CANsend command.
If I change the baudrate of the field modules to 250kbs and then change the baud rate in codesys to 250kbs, codesys sends and receives CAN messages correctly. So with only a change of the CAN network baud rate, codesys only works at 250kbs and nothing else.

Any idea what could cause this?

See the attached log file


You do not have the required permissions to view the files attached to this post.


Top
   
PostPosted: Tue Oct 23, 2018 9:52 pm 
Offline

Joined: Thu Feb 11, 2016 4:06 am
Posts: 37
I am dead in the water here any help would be appreciated!


Top
   
PostPosted: Thu Oct 25, 2018 11:33 pm 
Offline

Joined: Thu Feb 11, 2016 4:06 am
Posts: 37
Any Help Edwin?


Top
   
PostPosted: Fri Oct 26, 2018 6:08 pm 
Offline
Site Admin

Joined: Mon Sep 05, 2005 9:42 am
Posts: 3019
Hi,
not really, sorry have no hardware(Pi with CAN) to check...

BR
Edwin


Top
   
PostPosted: Fri Oct 26, 2018 11:53 pm 
Offline

Joined: Thu Feb 11, 2016 4:06 am
Posts: 37
Has anyone used CANbus with a pi running at something other than 250kb/s?


Top
   
PostPosted: Sun Oct 28, 2018 7:15 pm 
Offline

Joined: Thu Feb 11, 2016 4:06 am
Posts: 37
So I am continue to try an trouble shoot this issue.

I've replace the pi
I've replaced all the MCP2515 boards
I've tested different pi images

All produce the same results. Using the CAN socket utility, I can send and receive packets on any CANbus baudrate. However, through codesys, I can receive CANbus packets on every baudrate but can only transmit when the CANbus baudrate is 250kb/s.

I've used the pi CAN utility to confirm codesys is changing the CANbus baudrate using sudo ip -s -d link show can0

Everything I do points to some issue within Codesys.

Has anyone experienced this issue with different Canbus baud rate settings?


Top
   
PostPosted: Sun Oct 28, 2018 8:32 pm 
Offline

Joined: Thu Feb 11, 2016 4:06 am
Posts: 37
So I finally figured it out!

I was using a low level CanBus init instruction in my code that set the baudrate to 250 even though the canbus master was set at a different speed. Once I set my init instruction to 100kb/s it worked just fine.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 8 posts ] 

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited