<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Can I use virtual can (vcan) in CoDeSys?</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/65eabe8c03/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Runtime/thread/65eabe8c03/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Runtime/thread/65eabe8c03/</id><updated>2023-06-01T18:04:37.565000Z</updated><subtitle>Recent posts to Can I use virtual can (vcan) in CoDeSys?</subtitle><entry><title>Can I use virtual can (vcan) in CoDeSys?</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/65eabe8c03/?limit=25#e21f" rel="alternate"/><published>2023-06-01T18:04:37.565000Z</published><updated>2023-06-01T18:04:37.565000Z</updated><author><name>damenx</name><uri>https://forge.codesys.com/u/damenx/</uri></author><id>https://forge.codesys.com4a4f684da282859746aa4310c362f087dfb92f0f</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I know this is old but I cant find other references of vcan implementation.&lt;br/&gt;
I followed this thread and I can see in candump that Codesys is transmitting to the virtual bus, But it does not recive any on the messages on the bus. I can see messages from my other device in candump but codesys cannot see them. Any advice would be appreciated.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Can I use virtual can (vcan) in CoDeSys?</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/65eabe8c03/?limit=25#a53a" rel="alternate"/><published>2020-02-27T17:48:14.313000Z</published><updated>2020-02-27T17:48:14.313000Z</updated><author><name>alt</name><uri>https://forge.codesys.com/u/alt/</uri></author><id>https://forge.codesys.comea89360fa9204a7f349447075f49936a0df45e7f</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Thank you very much, Edwin!&lt;br/&gt;
Works great!&lt;/p&gt;
&lt;p&gt;(advice for the future: try to spend more time &lt;strong&gt;documenting&lt;/strong&gt; your capabilities)&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Can I use virtual can (vcan) in CoDeSys?</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/65eabe8c03/?limit=25#9694" rel="alternate"/><published>2020-02-27T17:48:11.077000Z</published><updated>2020-02-27T17:48:11.077000Z</updated><author><name>eschwellinger</name><uri>https://forge.codesys.com/u/eschwellinger/</uri></author><id>https://forge.codesys.comff8762921302a773e204d659f1d12248a0be4e41</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi,&lt;br/&gt;
give this a try:&lt;/p&gt;
&lt;p&gt;&lt;span&gt;[CmpSocketCanDrv]&lt;/span&gt;&lt;br/&gt;
Loopback=1&lt;/p&gt;
&lt;p&gt;BR&lt;br/&gt;
Edwin&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Can I use virtual can (vcan) in CoDeSys?</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/65eabe8c03/?limit=25#5a85" rel="alternate"/><published>2020-02-27T17:48:10.010000Z</published><updated>2020-02-27T17:48:10.010000Z</updated><author><name>alt</name><uri>https://forge.codesys.com/u/alt/</uri></author><id>https://forge.codesys.comcaa4216983b77f877f41f6405c75c5f61f96a8bc</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;It took almost 2 weeks, but no answer!&lt;br/&gt;
At the same time, the ticket on store.codesys.com is closed!&lt;br/&gt;
Help me please!!!&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Can I use virtual can (vcan) in CoDeSys?</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/65eabe8c03/?limit=25#a8d3" rel="alternate"/><published>2020-02-27T17:48:06.965000Z</published><updated>2020-02-27T17:48:06.965000Z</updated><author><name>alt</name><uri>https://forge.codesys.com/u/alt/</uri></author><id>https://forge.codesys.comd8afccd36d7ab25b0afccfd4913fbbd0304b43a0</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello, Edwin!&lt;/p&gt;
&lt;p&gt;Excuse me, really, the "InterfaceName = vcan" setting works!&lt;br/&gt;
The problem was that the number of CAN interfaces used by CoDeSys should be no more than 2.&lt;br/&gt;
Now there is another problem, how to use the vcan interface?&lt;br/&gt;
The Candump utility program does not see the packets that the CoDeSys sends to the CAN bus via the vcan interface.&lt;/p&gt;
&lt;p&gt;For the physical CAN interface, this is not a problem. You can view the packets on the bus using another device, and for virtual CAN I did not find a suitable solution.&lt;/p&gt;
&lt;p&gt;Forwarding packets with socat or cangw utility programs&lt;br/&gt;
work ONLY to receive packets in the direction of CoDeSys&lt;/p&gt;
&lt;p&gt;socat INTERFACE: can0, pf = 29, type = 3, prototype = 1 INTERFACE: vcan0, pf = 29, type = 3, prototype = 1&lt;/p&gt;
&lt;p&gt;or via cangw&lt;/p&gt;
&lt;p&gt;cangw -A -s can0 -d vcan0&lt;br/&gt;
cangw -A -s vcan0 -d can0&lt;/p&gt;
&lt;p&gt;Thus, packet transmission in the direction "CoDeSys -&amp;gt; vcan0-&amp;gt; can0-&amp;gt; physical CAN device" does not work&lt;br/&gt;
But it works in the opposite direction.&lt;/p&gt;
&lt;p&gt;How to solve this problem?&lt;/p&gt;
&lt;p&gt;Most likely the reason is that when you open a socket in the Canopen CoDeSys driver, loopback mode is disabled:&lt;br/&gt;
&lt;br/&gt;
int loopback = 0;&lt;br/&gt;
       if (setsockopt (s_fd_write &lt;span&gt;[byNet]&lt;/span&gt;, SOL_CAN_RAW, CAN_RAW_LOOPBACK, &amp;amp; loopback, sizeof (loopback))) {&lt;br/&gt;
               DEBUGP ("setsockopt (CAN_RAW_LOOPBACK):% s", strerror (errno));&lt;br/&gt;
       }&lt;/p&gt;
&lt;p&gt;If this is true, then how was the virtual can interface supposed to be used? After all, virtual can works only through loopback (correct, if I'm wrong).&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Can I use virtual can (vcan) in CoDeSys?</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/65eabe8c03/?limit=25#d144" rel="alternate"/><published>2020-02-27T17:48:05.872000Z</published><updated>2020-02-27T17:48:05.872000Z</updated><author><name>eschwellinger</name><uri>https://forge.codesys.com/u/eschwellinger/</uri></author><id>https://forge.codesys.com9e6ccb855cd2984717cab394d7c361e1d35fb52d</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I see no workaround...&lt;br/&gt;
it is possible to use CAN ( as interface name) but it stops after 2 interfaces... (hard coded) &lt;br/&gt;
BR&lt;br/&gt;
Edwin&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Can I use virtual can (vcan) in CoDeSys?</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/65eabe8c03/?limit=25#f9a9" rel="alternate"/><published>2020-02-27T17:48:02.929000Z</published><updated>2020-02-27T17:48:02.929000Z</updated><author><name>alt</name><uri>https://forge.codesys.com/u/alt/</uri></author><id>https://forge.codesys.come12c529ef5d2ce5abcbd812320620df045217e3f</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi! &lt;br/&gt;
NOT! I don't need to use real and virtual can at the SAME TIME! I need ONLY a virtual can! And the string "InterfaceName = vcan" does not work! Help me please! Already so much time there is no solution &lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Can I use virtual can (vcan) in CoDeSys?</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/65eabe8c03/?limit=25#b8b1" rel="alternate"/><published>2020-02-27T17:48:01.855000Z</published><updated>2020-02-27T17:48:01.855000Z</updated><author><name>eschwellinger</name><uri>https://forge.codesys.com/u/eschwellinger/</uri></author><id>https://forge.codesys.com3425210b8d1c880211c10a259de7cf75c43860eb</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi,&lt;br/&gt;
at the moment it is not possible to mix it up and use vcan and real can at the same time in CODESYS.&lt;br/&gt;
If you need this this need to be done by a improvement tracking entry ….!&lt;/p&gt;
&lt;p&gt;BR&lt;br/&gt;
Edwin&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Can I use virtual can (vcan) in CoDeSys?</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/65eabe8c03/?limit=25#c5db" rel="alternate"/><published>2020-02-27T17:48:00.791000Z</published><updated>2020-02-27T17:48:00.791000Z</updated><author><name>eschwellinger</name><uri>https://forge.codesys.com/u/eschwellinger/</uri></author><id>https://forge.codesys.comf33dca4a4a2619bad10b189d1681c90d9178ecf0</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;come on, &lt;br/&gt;
this is not good stile to post here screenshots from store requests!&lt;br/&gt;
Need some time....&lt;br/&gt;
BR &lt;br/&gt;
Edwin&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Can I use virtual can (vcan) in CoDeSys?</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/65eabe8c03/?limit=25#b838" rel="alternate"/><published>2020-02-27T17:47:57.851000Z</published><updated>2020-02-27T17:47:57.851000Z</updated><author><name>alt</name><uri>https://forge.codesys.com/u/alt/</uri></author><id>https://forge.codesys.com6b65b907aa35757acfb438c23ca290373173a456</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello!&lt;br/&gt;
Until now, there is no solution.&lt;br/&gt;
And the ticket on store.codesys.com is closed with redirection to this thread in the forum: (&lt;/p&gt;
&lt;p&gt;Are there any other ideas that you can try other than "InterfaceName = vcan"?&lt;br/&gt;
The test bench is on and available at any time.&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: ticket_close.jpg" rel="nofollow" src="https://forum.codesys.com//download/file.php?id=4552"/&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>