<?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>S32VのトピックRe: Access CAN-FD on S32V234</title>
    <link>https://community.nxp.com/t5/S32V/Access-CAN-FD-on-S32V234/m-p/741959#M112</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Some update. i was able to bring up the can0 and can1 with the linux SocketCAN command:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;ip link set can0 type can bitrate 500000&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;ip link set can0 up&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, when i try to enable can fd with&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;ip link set can0 type can bitrate 500000 dbitrate&amp;nbsp;dbitrate 4000000 fd on&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I got the error message:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;RTNETLINK answers: Operation not supported&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems like CAN-FD is not supported, although the documentation of the S32V234 board specified that the CAN port is a CAN-FD port. It this has something to do with the linux bsp setting? I am using the bsp come with S32DS for vision.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since i was able to bring up the raw can, i did some test with some simple SocketCAN example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TO write:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;int&amp;nbsp;&lt;/P&gt;&lt;P&gt;main(int argc, char** argv)&lt;BR /&gt;{&lt;BR /&gt; int s;&lt;BR /&gt; int nbytes;&lt;BR /&gt; struct sockaddr_can addr;&lt;BR /&gt; struct can_frame frame;&lt;BR /&gt; struct ifreq ifr;&lt;/P&gt;&lt;P&gt;const char *ifname = argv[1];&lt;/P&gt;&lt;P&gt;if((s = socket(PF_CAN, SOCK_RAW, CAN_RAW)) &amp;lt; 0) {&lt;BR /&gt; perror("Error while opening socket");&lt;BR /&gt; return -1;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;strcpy(ifr.ifr_name, ifname);&lt;BR /&gt; ioctl(s, SIOCGIFINDEX, &amp;amp;ifr);&lt;/P&gt;&lt;P&gt;addr.can_family = AF_CAN;&lt;BR /&gt; addr.can_ifindex = ifr.ifr_ifindex;&lt;/P&gt;&lt;P&gt;printf("%s at index %d\n", ifname, ifr.ifr_ifindex);&lt;/P&gt;&lt;P&gt;if(bind(s, (struct sockaddr *)&amp;amp;addr, sizeof(addr)) &amp;lt; 0) {&lt;BR /&gt; perror("Error in socket bind");&lt;BR /&gt; return -2;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;frame.can_id = 0x123;&lt;BR /&gt; frame.can_dlc = 2;&lt;BR /&gt; frame.data[0] = 0x11;&lt;BR /&gt; frame.data[1] = 0x22;&lt;/P&gt;&lt;P&gt;nbytes = write(s, &amp;amp;frame, sizeof(frame));&lt;BR /&gt; printf("Wrote %d bytes\n", nbytes);&lt;BR /&gt; perror("write");&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; return 0;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To Read:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#include &amp;lt;stdio.h&amp;gt;&lt;BR /&gt;#include &amp;lt;stdlib.h&amp;gt;&lt;BR /&gt;#include &amp;lt;unistd.h&amp;gt;&lt;BR /&gt;#include &amp;lt;string.h&amp;gt;&lt;/P&gt;&lt;P&gt;#include &amp;lt;net/if.h&amp;gt;&lt;BR /&gt;#include &amp;lt;sys/types.h&amp;gt;&lt;BR /&gt;#include &amp;lt;sys/socket.h&amp;gt;&lt;BR /&gt;#include &amp;lt;sys/ioctl.h&amp;gt;&lt;/P&gt;&lt;P&gt;#include &amp;lt;linux/can.h&amp;gt;&lt;BR /&gt;#include &amp;lt;linux/can/raw.h&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;int&lt;BR /&gt;main(int argc, char** argv)&lt;BR /&gt;{&lt;BR /&gt; int s;&lt;BR /&gt; int nbytes;&lt;BR /&gt; struct sockaddr_can addr;&lt;BR /&gt; struct can_frame frame;&lt;BR /&gt; struct ifreq ifr;&lt;/P&gt;&lt;P&gt;const char *ifname = argv[1];&lt;/P&gt;&lt;P&gt;if((s = socket(PF_CAN, SOCK_RAW, CAN_RAW)) &amp;lt; 0) {&lt;BR /&gt; perror("Error while opening socket");&lt;BR /&gt; return -1;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;strcpy(ifr.ifr_name, ifname);&lt;BR /&gt; ioctl(s, SIOCGIFINDEX, &amp;amp;ifr);&lt;/P&gt;&lt;P&gt;addr.can_family = AF_CAN;&lt;BR /&gt; addr.can_ifindex = ifr.ifr_ifindex;&lt;/P&gt;&lt;P&gt;printf("%s at index %d\n", ifname, ifr.ifr_ifindex);&lt;/P&gt;&lt;P&gt;if(bind(s, (struct sockaddr *)&amp;amp;addr, sizeof(addr)) &amp;lt; 0) {&lt;BR /&gt; perror("Error in socket bind");&lt;BR /&gt; return -2;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;while(true){&lt;BR /&gt; nbytes = read(s, &amp;amp;frame, sizeof(frame));&lt;BR /&gt; if(nbytes &amp;gt; 0){&lt;BR /&gt; printf("%d\n",frame.can_id);&lt;BR /&gt; }&lt;BR /&gt; else&lt;BR /&gt; {&lt;BR /&gt; usleep(1e6);&lt;BR /&gt; }&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; return 0;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This code is working fine when i test it with a virtual can setup in the S32V234 board. However, i&amp;nbsp;cannot read any thing when run on can0 or can1.&amp;nbsp;Is this mean the physical can bus has to connect to another physical can bus for read() / write() ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 28 Mar 2018 19:19:21 GMT</pubDate>
    <dc:creator>xuewong</dc:creator>
    <dc:date>2018-03-28T19:19:21Z</dc:date>
    <item>
      <title>Access CAN-FD on S32V234</title>
      <link>https://community.nxp.com/t5/S32V/Access-CAN-FD-on-S32V234/m-p/741958#M111</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am planing to use the CAN-FD on the S32V234 for sending out can message. Is there any example on how to do this on the linux enviornment?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Mar 2018 19:02:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32V/Access-CAN-FD-on-S32V234/m-p/741958#M111</guid>
      <dc:creator>xuewong</dc:creator>
      <dc:date>2018-03-27T19:02:18Z</dc:date>
    </item>
    <item>
      <title>Re: Access CAN-FD on S32V234</title>
      <link>https://community.nxp.com/t5/S32V/Access-CAN-FD-on-S32V234/m-p/741959#M112</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Some update. i was able to bring up the can0 and can1 with the linux SocketCAN command:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;ip link set can0 type can bitrate 500000&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;ip link set can0 up&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, when i try to enable can fd with&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;ip link set can0 type can bitrate 500000 dbitrate&amp;nbsp;dbitrate 4000000 fd on&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I got the error message:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;RTNETLINK answers: Operation not supported&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems like CAN-FD is not supported, although the documentation of the S32V234 board specified that the CAN port is a CAN-FD port. It this has something to do with the linux bsp setting? I am using the bsp come with S32DS for vision.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since i was able to bring up the raw can, i did some test with some simple SocketCAN example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TO write:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;int&amp;nbsp;&lt;/P&gt;&lt;P&gt;main(int argc, char** argv)&lt;BR /&gt;{&lt;BR /&gt; int s;&lt;BR /&gt; int nbytes;&lt;BR /&gt; struct sockaddr_can addr;&lt;BR /&gt; struct can_frame frame;&lt;BR /&gt; struct ifreq ifr;&lt;/P&gt;&lt;P&gt;const char *ifname = argv[1];&lt;/P&gt;&lt;P&gt;if((s = socket(PF_CAN, SOCK_RAW, CAN_RAW)) &amp;lt; 0) {&lt;BR /&gt; perror("Error while opening socket");&lt;BR /&gt; return -1;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;strcpy(ifr.ifr_name, ifname);&lt;BR /&gt; ioctl(s, SIOCGIFINDEX, &amp;amp;ifr);&lt;/P&gt;&lt;P&gt;addr.can_family = AF_CAN;&lt;BR /&gt; addr.can_ifindex = ifr.ifr_ifindex;&lt;/P&gt;&lt;P&gt;printf("%s at index %d\n", ifname, ifr.ifr_ifindex);&lt;/P&gt;&lt;P&gt;if(bind(s, (struct sockaddr *)&amp;amp;addr, sizeof(addr)) &amp;lt; 0) {&lt;BR /&gt; perror("Error in socket bind");&lt;BR /&gt; return -2;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;frame.can_id = 0x123;&lt;BR /&gt; frame.can_dlc = 2;&lt;BR /&gt; frame.data[0] = 0x11;&lt;BR /&gt; frame.data[1] = 0x22;&lt;/P&gt;&lt;P&gt;nbytes = write(s, &amp;amp;frame, sizeof(frame));&lt;BR /&gt; printf("Wrote %d bytes\n", nbytes);&lt;BR /&gt; perror("write");&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; return 0;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To Read:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#include &amp;lt;stdio.h&amp;gt;&lt;BR /&gt;#include &amp;lt;stdlib.h&amp;gt;&lt;BR /&gt;#include &amp;lt;unistd.h&amp;gt;&lt;BR /&gt;#include &amp;lt;string.h&amp;gt;&lt;/P&gt;&lt;P&gt;#include &amp;lt;net/if.h&amp;gt;&lt;BR /&gt;#include &amp;lt;sys/types.h&amp;gt;&lt;BR /&gt;#include &amp;lt;sys/socket.h&amp;gt;&lt;BR /&gt;#include &amp;lt;sys/ioctl.h&amp;gt;&lt;/P&gt;&lt;P&gt;#include &amp;lt;linux/can.h&amp;gt;&lt;BR /&gt;#include &amp;lt;linux/can/raw.h&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;int&lt;BR /&gt;main(int argc, char** argv)&lt;BR /&gt;{&lt;BR /&gt; int s;&lt;BR /&gt; int nbytes;&lt;BR /&gt; struct sockaddr_can addr;&lt;BR /&gt; struct can_frame frame;&lt;BR /&gt; struct ifreq ifr;&lt;/P&gt;&lt;P&gt;const char *ifname = argv[1];&lt;/P&gt;&lt;P&gt;if((s = socket(PF_CAN, SOCK_RAW, CAN_RAW)) &amp;lt; 0) {&lt;BR /&gt; perror("Error while opening socket");&lt;BR /&gt; return -1;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;strcpy(ifr.ifr_name, ifname);&lt;BR /&gt; ioctl(s, SIOCGIFINDEX, &amp;amp;ifr);&lt;/P&gt;&lt;P&gt;addr.can_family = AF_CAN;&lt;BR /&gt; addr.can_ifindex = ifr.ifr_ifindex;&lt;/P&gt;&lt;P&gt;printf("%s at index %d\n", ifname, ifr.ifr_ifindex);&lt;/P&gt;&lt;P&gt;if(bind(s, (struct sockaddr *)&amp;amp;addr, sizeof(addr)) &amp;lt; 0) {&lt;BR /&gt; perror("Error in socket bind");&lt;BR /&gt; return -2;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;while(true){&lt;BR /&gt; nbytes = read(s, &amp;amp;frame, sizeof(frame));&lt;BR /&gt; if(nbytes &amp;gt; 0){&lt;BR /&gt; printf("%d\n",frame.can_id);&lt;BR /&gt; }&lt;BR /&gt; else&lt;BR /&gt; {&lt;BR /&gt; usleep(1e6);&lt;BR /&gt; }&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; return 0;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This code is working fine when i test it with a virtual can setup in the S32V234 board. However, i&amp;nbsp;cannot read any thing when run on can0 or can1.&amp;nbsp;Is this mean the physical can bus has to connect to another physical can bus for read() / write() ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Mar 2018 19:19:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32V/Access-CAN-FD-on-S32V234/m-p/741959#M112</guid>
      <dc:creator>xuewong</dc:creator>
      <dc:date>2018-03-28T19:19:21Z</dc:date>
    </item>
    <item>
      <title>Re: Access CAN-FD on S32V234</title>
      <link>https://community.nxp.com/t5/S32V/Access-CAN-FD-on-S32V234/m-p/741960#M113</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Xue,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;S32V234 devices supports CAN-FD. So it may be some BSP settings that needs to be done. You can download Yocto distribution and modify BSP according to your need. Please visit &lt;A href="http://www.nxp.com/s32v"&gt;www.nxp.com/s32v&lt;/A&gt;&amp;nbsp;&amp;gt;&amp;gt; SOFTWARE &amp;amp; TOOLS to download Linux BSP and its user manual. Linux BSP User Manual has information to download Yocto.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For physical connections please make sure right port and pins are connected to probe/other device. You do simple test by connection can0 and can1 of the same device.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kushal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Apr 2018 20:03:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32V/Access-CAN-FD-on-S32V234/m-p/741960#M113</guid>
      <dc:creator>KushalShahNXP</dc:creator>
      <dc:date>2018-04-30T20:03:25Z</dc:date>
    </item>
  </channel>
</rss>

