<?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>topic How to configure CAN Loop-back for S32R274  in S32 Design Studio</title>
    <link>https://community.nxp.com/t5/S32-Design-Studio/How-to-configure-CAN-Loop-back-for-S32R274/m-p/769082#M2875</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;I'm developing on S32R274,when I try to configure CAN0' Loop-back mode ,I set a breakpoint in the interupt handle function but it dosn't hit.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Here is &amp;nbsp;my init code:&lt;/P&gt;&lt;P&gt;void FlexCAN_0_Init(void)&lt;BR /&gt;{&lt;BR /&gt; int i = 0;&lt;/P&gt;&lt;P&gt;//configure I/O&lt;/P&gt;&lt;P&gt;SIUL2.MSCR[16].B.SSS = 1; /* CAN0_TXD L15: Source signal is CAN0_TX */&lt;BR /&gt; SIUL2.MSCR[16].B.OBE = 1; /* &lt;SPAN&gt;CAN0_TXD L15&lt;/SPAN&gt;: Output Buffer Enable */&lt;BR /&gt; SIUL2.MSCR[16].B.SRC = 3; /* &lt;SPAN&gt;CAN0_TXD L15&lt;/SPAN&gt;: Maximum slew rate */&lt;/P&gt;&lt;P&gt;SIUL2.MSCR[17].B.IBE = 1; /*CAN0_RXD M17: Enable pad for input - CAN0_RXD */&lt;BR /&gt; SIUL2.IMCR[0].B.SSS = 0; /* CAN_0_RXD: connected to pad &lt;SPAN&gt;M17&lt;/SPAN&gt; */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*Module enable*/&lt;BR /&gt; CAN_0.MCR.B.MDIS = 0;//frank: 0 is enable&lt;/P&gt;&lt;P&gt;/*Source clk is oscillator clock (40MHz)*/&lt;BR /&gt; CAN_0.CTRL1.B.CLKSRC = 0;&lt;/P&gt;&lt;P&gt;/*Error correction configuration register enable*/&lt;BR /&gt; CAN_0.CTRL2.B.ECRWRE = 1;&lt;/P&gt;&lt;P&gt;/*Enable unrestricted write access to FlexCAN memory*/&lt;BR /&gt; CAN_0.CTRL2.B.WRMFRZ = 1;&lt;/P&gt;&lt;P&gt;/*Error configuration register write enable*/&lt;BR /&gt; CAN_0.MECR.B.ECRWRDIS = 0;&lt;/P&gt;&lt;P&gt;/*Disable memory error correction*/&lt;BR /&gt; CAN_0.MECR.B.ECCDIS = 1;&lt;/P&gt;&lt;P&gt;/*Keep normal operation*/&lt;BR /&gt; CAN_0.MECR.B.NCEFAFRZ = 0;&lt;/P&gt;&lt;P&gt;/*Error configuration register write disable*/&lt;BR /&gt; CAN_0.MECR.B.ECRWRDIS = 1;&lt;/P&gt;&lt;P&gt;/*Disable unrestricted write access to FlexCAN memory*/&lt;BR /&gt; CAN_0.CTRL2.B.WRMFRZ = 0;&lt;/P&gt;&lt;P&gt;/*Error correction configuration register disable*/&lt;BR /&gt; CAN_0.CTRL2.B.ECRWRE = 0;&lt;/P&gt;&lt;P&gt;/*CAN bit timing - 40MHz oscillator, 100kbps bitrate,*/&lt;BR /&gt; CAN_0.CTRL1.B.PRESDIV = 39;//frank: this field can be written only in Freeze mode&lt;BR /&gt; CAN_0.CTRL1.B.RJW = 3;//frank: this value is 0-3&lt;BR /&gt; CAN_0.CTRL1.B.PSEG1 = 3;//frank: this field can be written only in Freeze mode&lt;BR /&gt; CAN_0.CTRL1.B.PSEG2 = 3;//frank: this field can be written only in Freeze mode&lt;BR /&gt; CAN_0.CTRL1.B.PROPSEG = 0;&lt;BR /&gt; CAN_0.CTRL1.B.LPB=1;//frank:enable loop-back mode&lt;/P&gt;&lt;P&gt;/*Clear all RX individual Mask Registers The corresponding bit in the&lt;BR /&gt; * filter is "don't care."*/&lt;BR /&gt; for(i = 0; i &amp;lt; 64; i++)//frank:change 64 to 96 CAN0 support CAN-FD(96)&lt;BR /&gt; {&lt;BR /&gt; CAN_0.RXIMR[i].R = 0x00000000;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;/*Set all message buffers RX inactive*/&lt;BR /&gt; for(i = 0; i &amp;lt;64; i++)&lt;BR /&gt; {&lt;BR /&gt; CAN_0.MB[i].CS.R = 0x0000;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;/*No freeze mode request*/&lt;BR /&gt; CAN_0.MCR.B.HALT = 0;&lt;BR /&gt; CAN_0.IMASK1.R=0x0F;//frank: add&lt;BR /&gt; INTC.PSR[522].B.PRC_SELN0=1;//frank: sent interupt to core0&lt;BR /&gt; INTC.PSR[522].B.PRIN=2;//frank: set the interupt priority&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//configure RX buffer,&lt;/P&gt;&lt;P&gt;CAN_0.MB[0].CS.B.CODE = 0x0; //MB inactive&lt;BR /&gt; CAN_0.MB[0].CS.B.IDE = 1;&lt;BR /&gt; CAN_0.MB[0].ID.R = 0; //set standard ID&lt;BR /&gt; CAN_0.MB[0].DATA.W[1] = 0x00000000; //data1 set (optional)&lt;BR /&gt; CAN_0.MB[0].DATA.W[0] = 0x00000000; //data0 set (optional)&lt;BR /&gt; CAN_0.MB[0].CS.B.CODE = 0x4; //MB empty - ready for receive&lt;/P&gt;&lt;P&gt;CAN_0.MB[1].CS.B.CODE = 0x0; //MB inactive&lt;BR /&gt; CAN_0.MB[1].CS.B.IDE = 1;&lt;BR /&gt; CAN_0.MB[1].ID.R = 100; //set standard ID&lt;BR /&gt; CAN_0.MB[1].DATA.W[1] = 0x00000000; //data1 set (optional)&lt;BR /&gt; CAN_0.MB[1].DATA.W[0] = 0x00000000; //data0 set (optional)&lt;BR /&gt; CAN_0.MB[1].CS.B.CODE = 0x4; //MB empty - ready for receive&lt;/P&gt;&lt;P&gt;CAN_0.MB[2].CS.B.CODE = 0x0; //MB inactive&lt;BR /&gt; CAN_0.MB[2].CS.B.IDE = 1;&lt;BR /&gt; CAN_0.MB[2].ID.R = 1000; //set standard ID&lt;BR /&gt; CAN_0.MB[2].DATA.W[1] = 0x00000000; //data1 set (optional)&lt;BR /&gt; CAN_0.MB[2].DATA.W[0] = 0x00000000; //data0 set (optional)&lt;BR /&gt; CAN_0.MB[2].CS.B.CODE = 0x4; //MB empty - ready for receive&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also I had add ISR function into the&lt;STRONG&gt; IntcIsrVectorTable&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Who can give me a sample for CAN0 Loop-back mode?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;SPAN class="" lang="en" style="border: 0px; font-weight: inherit;"&gt;&lt;SPAN class="" style="border: 0px; font-weight: inherit;"&gt;Thank you for your support&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;Frank.wei&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;SPAN class="" lang="en" style="border: 0px; font-weight: inherit;"&gt;&lt;SPAN class="" style="border: 0px; font-weight: inherit;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 13 Nov 2017 18:30:38 GMT</pubDate>
    <dc:creator>fuqinwei</dc:creator>
    <dc:date>2017-11-13T18:30:38Z</dc:date>
    <item>
      <title>How to configure CAN Loop-back for S32R274</title>
      <link>https://community.nxp.com/t5/S32-Design-Studio/How-to-configure-CAN-Loop-back-for-S32R274/m-p/769082#M2875</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;I'm developing on S32R274,when I try to configure CAN0' Loop-back mode ,I set a breakpoint in the interupt handle function but it dosn't hit.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Here is &amp;nbsp;my init code:&lt;/P&gt;&lt;P&gt;void FlexCAN_0_Init(void)&lt;BR /&gt;{&lt;BR /&gt; int i = 0;&lt;/P&gt;&lt;P&gt;//configure I/O&lt;/P&gt;&lt;P&gt;SIUL2.MSCR[16].B.SSS = 1; /* CAN0_TXD L15: Source signal is CAN0_TX */&lt;BR /&gt; SIUL2.MSCR[16].B.OBE = 1; /* &lt;SPAN&gt;CAN0_TXD L15&lt;/SPAN&gt;: Output Buffer Enable */&lt;BR /&gt; SIUL2.MSCR[16].B.SRC = 3; /* &lt;SPAN&gt;CAN0_TXD L15&lt;/SPAN&gt;: Maximum slew rate */&lt;/P&gt;&lt;P&gt;SIUL2.MSCR[17].B.IBE = 1; /*CAN0_RXD M17: Enable pad for input - CAN0_RXD */&lt;BR /&gt; SIUL2.IMCR[0].B.SSS = 0; /* CAN_0_RXD: connected to pad &lt;SPAN&gt;M17&lt;/SPAN&gt; */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*Module enable*/&lt;BR /&gt; CAN_0.MCR.B.MDIS = 0;//frank: 0 is enable&lt;/P&gt;&lt;P&gt;/*Source clk is oscillator clock (40MHz)*/&lt;BR /&gt; CAN_0.CTRL1.B.CLKSRC = 0;&lt;/P&gt;&lt;P&gt;/*Error correction configuration register enable*/&lt;BR /&gt; CAN_0.CTRL2.B.ECRWRE = 1;&lt;/P&gt;&lt;P&gt;/*Enable unrestricted write access to FlexCAN memory*/&lt;BR /&gt; CAN_0.CTRL2.B.WRMFRZ = 1;&lt;/P&gt;&lt;P&gt;/*Error configuration register write enable*/&lt;BR /&gt; CAN_0.MECR.B.ECRWRDIS = 0;&lt;/P&gt;&lt;P&gt;/*Disable memory error correction*/&lt;BR /&gt; CAN_0.MECR.B.ECCDIS = 1;&lt;/P&gt;&lt;P&gt;/*Keep normal operation*/&lt;BR /&gt; CAN_0.MECR.B.NCEFAFRZ = 0;&lt;/P&gt;&lt;P&gt;/*Error configuration register write disable*/&lt;BR /&gt; CAN_0.MECR.B.ECRWRDIS = 1;&lt;/P&gt;&lt;P&gt;/*Disable unrestricted write access to FlexCAN memory*/&lt;BR /&gt; CAN_0.CTRL2.B.WRMFRZ = 0;&lt;/P&gt;&lt;P&gt;/*Error correction configuration register disable*/&lt;BR /&gt; CAN_0.CTRL2.B.ECRWRE = 0;&lt;/P&gt;&lt;P&gt;/*CAN bit timing - 40MHz oscillator, 100kbps bitrate,*/&lt;BR /&gt; CAN_0.CTRL1.B.PRESDIV = 39;//frank: this field can be written only in Freeze mode&lt;BR /&gt; CAN_0.CTRL1.B.RJW = 3;//frank: this value is 0-3&lt;BR /&gt; CAN_0.CTRL1.B.PSEG1 = 3;//frank: this field can be written only in Freeze mode&lt;BR /&gt; CAN_0.CTRL1.B.PSEG2 = 3;//frank: this field can be written only in Freeze mode&lt;BR /&gt; CAN_0.CTRL1.B.PROPSEG = 0;&lt;BR /&gt; CAN_0.CTRL1.B.LPB=1;//frank:enable loop-back mode&lt;/P&gt;&lt;P&gt;/*Clear all RX individual Mask Registers The corresponding bit in the&lt;BR /&gt; * filter is "don't care."*/&lt;BR /&gt; for(i = 0; i &amp;lt; 64; i++)//frank:change 64 to 96 CAN0 support CAN-FD(96)&lt;BR /&gt; {&lt;BR /&gt; CAN_0.RXIMR[i].R = 0x00000000;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;/*Set all message buffers RX inactive*/&lt;BR /&gt; for(i = 0; i &amp;lt;64; i++)&lt;BR /&gt; {&lt;BR /&gt; CAN_0.MB[i].CS.R = 0x0000;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;/*No freeze mode request*/&lt;BR /&gt; CAN_0.MCR.B.HALT = 0;&lt;BR /&gt; CAN_0.IMASK1.R=0x0F;//frank: add&lt;BR /&gt; INTC.PSR[522].B.PRC_SELN0=1;//frank: sent interupt to core0&lt;BR /&gt; INTC.PSR[522].B.PRIN=2;//frank: set the interupt priority&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//configure RX buffer,&lt;/P&gt;&lt;P&gt;CAN_0.MB[0].CS.B.CODE = 0x0; //MB inactive&lt;BR /&gt; CAN_0.MB[0].CS.B.IDE = 1;&lt;BR /&gt; CAN_0.MB[0].ID.R = 0; //set standard ID&lt;BR /&gt; CAN_0.MB[0].DATA.W[1] = 0x00000000; //data1 set (optional)&lt;BR /&gt; CAN_0.MB[0].DATA.W[0] = 0x00000000; //data0 set (optional)&lt;BR /&gt; CAN_0.MB[0].CS.B.CODE = 0x4; //MB empty - ready for receive&lt;/P&gt;&lt;P&gt;CAN_0.MB[1].CS.B.CODE = 0x0; //MB inactive&lt;BR /&gt; CAN_0.MB[1].CS.B.IDE = 1;&lt;BR /&gt; CAN_0.MB[1].ID.R = 100; //set standard ID&lt;BR /&gt; CAN_0.MB[1].DATA.W[1] = 0x00000000; //data1 set (optional)&lt;BR /&gt; CAN_0.MB[1].DATA.W[0] = 0x00000000; //data0 set (optional)&lt;BR /&gt; CAN_0.MB[1].CS.B.CODE = 0x4; //MB empty - ready for receive&lt;/P&gt;&lt;P&gt;CAN_0.MB[2].CS.B.CODE = 0x0; //MB inactive&lt;BR /&gt; CAN_0.MB[2].CS.B.IDE = 1;&lt;BR /&gt; CAN_0.MB[2].ID.R = 1000; //set standard ID&lt;BR /&gt; CAN_0.MB[2].DATA.W[1] = 0x00000000; //data1 set (optional)&lt;BR /&gt; CAN_0.MB[2].DATA.W[0] = 0x00000000; //data0 set (optional)&lt;BR /&gt; CAN_0.MB[2].CS.B.CODE = 0x4; //MB empty - ready for receive&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also I had add ISR function into the&lt;STRONG&gt; IntcIsrVectorTable&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Who can give me a sample for CAN0 Loop-back mode?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;SPAN class="" lang="en" style="border: 0px; font-weight: inherit;"&gt;&lt;SPAN class="" style="border: 0px; font-weight: inherit;"&gt;Thank you for your support&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;Frank.wei&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;SPAN class="" lang="en" style="border: 0px; font-weight: inherit;"&gt;&lt;SPAN class="" style="border: 0px; font-weight: inherit;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Nov 2017 18:30:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32-Design-Studio/How-to-configure-CAN-Loop-back-for-S32R274/m-p/769082#M2875</guid>
      <dc:creator>fuqinwei</dc:creator>
      <dc:date>2017-11-13T18:30:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to configure CAN Loop-back for S32R274</title>
      <link>https://community.nxp.com/t5/S32-Design-Studio/How-to-configure-CAN-Loop-back-for-S32R274/m-p/769083#M2876</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The register of &lt;STRONG&gt;CAN0.MCR.B.NOTRDY&lt;/STRONG&gt; and&amp;nbsp;&lt;SPAN&gt;&lt;STRONG&gt;CAN0.MCR.B.FRZ&lt;/STRONG&gt; is always &lt;STRONG&gt;keep 1&lt;/STRONG&gt; ,even thougth the&amp;nbsp;&lt;STRONG&gt;CAN0.MCR.B.&lt;/STRONG&gt;&lt;SPAN&gt;&lt;STRONG&gt;HAL&lt;/STRONG&gt; was set to &lt;STRONG&gt;0&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="NOTRDY.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/33368i98A3F21A1816428C/image-size/large?v=v2&amp;amp;px=999" role="button" title="NOTRDY.png" alt="NOTRDY.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Nov 2017 08:52:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32-Design-Studio/How-to-configure-CAN-Loop-back-for-S32R274/m-p/769083#M2876</guid>
      <dc:creator>fuqinwei</dc:creator>
      <dc:date>2017-11-14T08:52:37Z</dc:date>
    </item>
  </channel>
</rss>

