<?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>S12 / MagniV MicrocontrollersのトピックRe: CAN module re-transmits frame infinitely when not connected to bus</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/CAN-module-re-transmits-frame-infinitely-when-not-connected-to/m-p/830794#M15958</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your answer&lt;/P&gt;&lt;P&gt;I do this in the CAN_ERR_ISR, but what happens is that it aborts the message, triggers a TX interrupt then goes to the CAN_TX_ISR which in turn resends the message again.&lt;/P&gt;&lt;P&gt;is there something I should do ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 20 Jul 2018 17:50:57 GMT</pubDate>
    <dc:creator>abdalmoniemalhi</dc:creator>
    <dc:date>2018-07-20T17:50:57Z</dc:date>
    <item>
      <title>CAN module re-transmits frame infinitely when not connected to bus</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/CAN-module-re-transmits-frame-infinitely-when-not-connected-to/m-p/830792#M15956</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, I'm writing a CAN driver for the S12ZVC using MSCAN, I modified the example code so that it transmits the frame inside the CAN_TX_ISR, it works fine if it is connected to a bus, but if it is not it receives a NACK. and re-transmits the frame again and again until it connects to the bus and receives an ACK.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NB. I've made a workaround using CAN_ERR_ISR to stop the TX ISR if an error occurs, but I'm unable to flush the tx buffer or restart the can module; however it works only if I call CAN_send() once, but when I call it inside the loop, it misbehaves as described.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here is my code:&lt;/P&gt;&lt;PRE&gt;int main(void) { 
 CAN_init();
 //construct frame
 txBuffer.id = 0x5A;
 txBuffer.data[0] = 0x23;
 txBuffer.data[1] = 0x08;
 txBuffer.data[2] = 0x93;txBuffer.length = 1;
 txBuffer.priority = 0;
 CAN_send(&amp;amp;txBuffer);
 for(;;){}
}

//sends a CAN message
void CAN_send(transmitBuffer *txBuffer) {
 bTxBuffer = txBuffer;
 
 //prepare frame
 CAN0TBSEL = CAN0TFLG; /* select lowest empty buffer */
 bTxBuffer-&amp;gt;bufferNumber = CAN0TBSEL;
 
 //enable tx interrupt
 CAN0TFLG_TXE = bTxBuffer-&amp;gt;bufferNumber;
 CAN0TIER_TXEIE = bTxBuffer-&amp;gt;bufferNumber;
 
 //enable can change status interrupt
 CAN0RIER_CSCIE = 0x01;
 
 //enable interrupts on TxErr or Bus-Off
 CAN0RIER_TSTATE = 0x02;
}

//CAN message transmission interrupt
void interrupt VectorNumber_Vcan0tx CAN_TX_ISR() {
 uint8 index;

 //prepare frame
 CAN0TBSEL = CAN0TFLG; /* select lowest empty buffer */
 bTxBuffer-&amp;gt;bufferNumber = CAN0TBSEL;

 //load ID
 CAN0TXIDR0 = (bTxBuffer-&amp;gt;id &amp;amp; 0b11111111000) &amp;gt;&amp;gt; 3;
 CAN0TXIDR1 = (bTxBuffer-&amp;gt;id &amp;amp; 0b00000000111) &amp;lt;&amp;lt; 5;

 //load data for(index = 0; index &amp;lt; bTxBuffer-&amp;gt;length; index++) {
 *(&amp;amp;CAN0TXDSR0 + index) = bTxBuffer-&amp;gt;data[index];
 }

 //send frame
 CAN0TXDLR = bTxBuffer-&amp;gt;length; /* set data length */
 CAN0TXTBPR = bTxBuffer-&amp;gt;priority; /* set priority */

 //clear tx interrupt flag
 CAN0TFLG_TXE = bTxBuffer-&amp;gt;bufferNumber; /* start transmission */
}

void interrupt VectorNumber_Vcan0err CAN_ERR_ISR() {
 CAN0TARQ = 0x07;
 while (!(CAN0TAAK &amp;amp; 0x07)){}
 
 //clear can change status flag
 CAN0RFLG_CSCIF = 1;
 
 //disable tx interrupt
 CAN0TIER_TXEIE = 0;
 
 //clear tx flag
 //CAN0TFLG = 0x07;
}&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jul 2018 10:15:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/CAN-module-re-transmits-frame-infinitely-when-not-connected-to/m-p/830792#M15956</guid>
      <dc:creator>abdalmoniemalhi</dc:creator>
      <dc:date>2018-07-19T10:15:35Z</dc:date>
    </item>
    <item>
      <title>Re: CAN module re-transmits frame infinitely when not connected to bus</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/CAN-module-re-transmits-frame-infinitely-when-not-connected-to/m-p/830793#M15957</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when Tx node does not receive ACK it goes to an error passive node and tries to send message in a loop.&lt;/P&gt;&lt;P&gt;The solution is&lt;SPAN style="font-family: arial; font-size: small;"&gt; ABORT (MSCAN Transmitter Message Abort Request Register (CANTARQ)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial; font-size: small;"&gt;Best regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial; font-size: small;"&gt;Ladislav&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jul 2018 10:36:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/CAN-module-re-transmits-frame-infinitely-when-not-connected-to/m-p/830793#M15957</guid>
      <dc:creator>lama</dc:creator>
      <dc:date>2018-07-20T10:36:32Z</dc:date>
    </item>
    <item>
      <title>Re: CAN module re-transmits frame infinitely when not connected to bus</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/CAN-module-re-transmits-frame-infinitely-when-not-connected-to/m-p/830794#M15958</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your answer&lt;/P&gt;&lt;P&gt;I do this in the CAN_ERR_ISR, but what happens is that it aborts the message, triggers a TX interrupt then goes to the CAN_TX_ISR which in turn resends the message again.&lt;/P&gt;&lt;P&gt;is there something I should do ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jul 2018 17:50:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/CAN-module-re-transmits-frame-infinitely-when-not-connected-to/m-p/830794#M15958</guid>
      <dc:creator>abdalmoniemalhi</dc:creator>
      <dc:date>2018-07-20T17:50:57Z</dc:date>
    </item>
    <item>
      <title>Re: CAN module re-transmits frame infinitely when not connected to bus</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/CAN-module-re-transmits-frame-infinitely-when-not-connected-to/m-p/1690706#M19311</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/37643"&gt;@lama&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I alse have this problem with my project.&lt;/P&gt;&lt;P&gt;How do I know the connecting status of CAN.&lt;/P&gt;&lt;P&gt;Here is the waveform without CAN connecting&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="gumu_0-1690018499516.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/233069i18773D1EC2C9BD77/image-size/medium?v=v2&amp;amp;px=400" role="button" title="gumu_0-1690018499516.png" alt="gumu_0-1690018499516.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 22 Jul 2023 09:35:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/CAN-module-re-transmits-frame-infinitely-when-not-connected-to/m-p/1690706#M19311</guid>
      <dc:creator>gumu</dc:creator>
      <dc:date>2023-07-22T09:35:12Z</dc:date>
    </item>
  </channel>
</rss>

