<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>i.MX ProcessorsのトピックRe: basic CAN example</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/basic-CAN-example/m-p/787224#M121973</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In my code if I try to bind the can socket getting an error, please do let me know what could be the reason,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pleas find the code below,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;struct sockaddr_can addr;&lt;BR /&gt;&amp;nbsp;struct can_frame frame;&lt;BR /&gt;&amp;nbsp;struct ifreq ifr;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;const char *ifname = "vcan0";&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;if((s = socket(PF_CAN, SOCK_RAW, CAN_RAW)) &amp;lt; 0) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;perror("Error while opening socket");&lt;BR /&gt;&amp;nbsp;&amp;nbsp;return -1;&lt;BR /&gt;&amp;nbsp;}&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;strcpy(ifr.ifr_name, ifname);&lt;BR /&gt;&amp;nbsp;ioctl(s, SIOCGIFINDEX, &amp;amp;ifr);&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;addr.can_family&amp;nbsp; = AF_CAN;&lt;BR /&gt;&amp;nbsp;addr.can_ifindex = ifr.ifr_ifindex;&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;if(bind(s, (struct sockaddr *)&amp;amp;addr, sizeof(addr)) &amp;lt; 0) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;perror("Error in socket bind");&lt;BR /&gt;&amp;nbsp;&amp;nbsp;return -2;&lt;BR /&gt;&amp;nbsp;}&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 22 Nov 2018 08:20:19 GMT</pubDate>
    <dc:creator>dheeraj_k</dc:creator>
    <dc:date>2018-11-22T08:20:19Z</dc:date>
    <item>
      <title>basic CAN example</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/basic-CAN-example/m-p/787222#M121971</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Basic CAN communication example for IMX6ULL&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Nov 2018 10:44:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/basic-CAN-example/m-p/787222#M121971</guid>
      <dc:creator>dheeraj_k</dc:creator>
      <dc:date>2018-11-21T10:44:40Z</dc:date>
    </item>
    <item>
      <title>Re: basic CAN example</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/basic-CAN-example/m-p/787223#M121972</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dheeraj&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;one can try with:&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://source.codeaurora.org/external/imx/imx-test/tree/test/can/doc?h=imx_4.9.88_2.0.0_ga" title="https://source.codeaurora.org/external/imx/imx-test/tree/test/can/doc?h=imx_4.9.88_2.0.0_ga"&gt;doc\can\test - imx-test - i.MX Driver Test Application Software&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://github.com/linux-can/can-utils" title="https://github.com/linux-can/can-utils"&gt;GitHub - linux-can/can-utils: Linux-CAN / SocketCAN user space applications&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;BR /&gt;igor&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Nov 2018 23:49:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/basic-CAN-example/m-p/787223#M121972</guid>
      <dc:creator>igorpadykov</dc:creator>
      <dc:date>2018-11-21T23:49:55Z</dc:date>
    </item>
    <item>
      <title>Re: basic CAN example</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/basic-CAN-example/m-p/787224#M121973</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In my code if I try to bind the can socket getting an error, please do let me know what could be the reason,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pleas find the code below,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;struct sockaddr_can addr;&lt;BR /&gt;&amp;nbsp;struct can_frame frame;&lt;BR /&gt;&amp;nbsp;struct ifreq ifr;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;const char *ifname = "vcan0";&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;if((s = socket(PF_CAN, SOCK_RAW, CAN_RAW)) &amp;lt; 0) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;perror("Error while opening socket");&lt;BR /&gt;&amp;nbsp;&amp;nbsp;return -1;&lt;BR /&gt;&amp;nbsp;}&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;strcpy(ifr.ifr_name, ifname);&lt;BR /&gt;&amp;nbsp;ioctl(s, SIOCGIFINDEX, &amp;amp;ifr);&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;addr.can_family&amp;nbsp; = AF_CAN;&lt;BR /&gt;&amp;nbsp;addr.can_ifindex = ifr.ifr_ifindex;&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;if(bind(s, (struct sockaddr *)&amp;amp;addr, sizeof(addr)) &amp;lt; 0) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;perror("Error in socket bind");&lt;BR /&gt;&amp;nbsp;&amp;nbsp;return -2;&lt;BR /&gt;&amp;nbsp;}&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Nov 2018 08:20:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/basic-CAN-example/m-p/787224#M121973</guid>
      <dc:creator>dheeraj_k</dc:creator>
      <dc:date>2018-11-22T08:20:19Z</dc:date>
    </item>
  </channel>
</rss>

