<?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 Re: MSCAN CAN0TAAK register not being set in S12 / MagniV Microcontrollers</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/MSCAN-CAN0TAAK-register-not-being-set/m-p/390837#M10907</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe little bit late but...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do not use the CANTAAK to check the message was aborted, as there may be a case it was transmitted in fact so ABTAKn flag is not set. Instead use the CANTFLG; a TXEn is set when message is sent or aborted. Then the ABTAKn flag can be used to identify what was done. So try to use following code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if ((CAN0TFLG &amp;amp; 0x07) != 0x07)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P style="text-indent: .5in;"&gt;CAN0TARQ = 0x07;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //request to abort all transmit buffers&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while ((CAN0TFLG &amp;amp; 0x07) != 0x07);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //wait for the abort to be completed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // you can check CAN0TAAK to see which was aborted&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CAN0CTL0 |= SLPRQ; //request sleep mode&lt;/P&gt;&lt;P&gt;while (!(CAN0CTL1 &amp;amp; SLPAK));&amp;nbsp;&amp;nbsp;&amp;nbsp; //wait for acknowledge&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;…&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regarding entering the "if ((CAN0TFLG &amp;amp; 0x07) != 0x07)" statement; either you have some buffer ﬂagged as ready for transmission (by clearing the associated TXE ﬂag) or message was not transmitted successfully (without error).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Petr&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 23 Apr 2015 10:21:07 GMT</pubDate>
    <dc:creator>PetrS</dc:creator>
    <dc:date>2015-04-23T10:21:07Z</dc:date>
    <item>
      <title>MSCAN CAN0TAAK register not being set</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/MSCAN-CAN0TAAK-register-not-being-set/m-p/390836#M10906</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Calibri; font-size: 12pt;"&gt;I have the following code in my application and every so often, the code gets stuck in the while loop. There seems to be no discernible pattern - sometimes the code just gets stuck there.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Calibri; font-size: 12pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Calibri; font-size: 12pt;"&gt;if (CAN0TFLG != 0x07)&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Calibri; font-size: 12pt;"&gt;{&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Calibri;"&gt;&lt;SPAN style="color: #000000; font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 12pt;"&gt;CAN0TARQ = 0x07; // abort the transmission&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Calibri; font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 12pt; font-family: Calibri;"&gt;while (!CAN0TAAK)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Calibri;"&gt;&lt;SPAN style="color: #000000; font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 12pt;"&gt;{&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Calibri;"&gt;&lt;SPAN style="color: #000000; font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 12pt;"&gt;; // Wait for the message transmission to be aborted&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Calibri;"&gt;&lt;SPAN style="color: #000000; font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 12pt;"&gt;}&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; color: #000000; font-size: 11pt; mso-hansi-theme-font: minor-latin; mso-ansi-language: EN-US; font-family: 'Calibri',sans-serif; mso-ascii-theme-font: minor-latin; mso-fareast-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-bidi-theme-font: minor-bidi;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; color: #000000; font-size: 11pt; mso-hansi-theme-font: minor-latin; mso-ansi-language: EN-US; font-family: 'Calibri',sans-serif; mso-ascii-theme-font: minor-latin; mso-fareast-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-bidi-theme-font: minor-bidi;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; color: #000000; font-size: 11pt; mso-hansi-theme-font: minor-latin; mso-ansi-language: EN-US; font-family: 'Calibri',sans-serif; mso-ascii-theme-font: minor-latin; mso-fareast-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-bidi-theme-font: minor-bidi;"&gt;The above code is actually a smaller piece to a bigger picture. My device requests OBD II data from a vehicle via the CAN bus. It sends messages to the vehicle and then listens for the response(s) from the vehicle. Since there are several addresses that I need to query to get the information I'm looking for, I have to change the CAN filters in order to be able to receive the responses from the different addresses. Normally, the CAN filters are configured such that no CAN filter hits are generated. They are effectively closed. I only open them up when I need to request a certain parameter and at that point, they are configured based on the address of the parameter I'm requesting.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; color: #000000; font-size: 11pt; mso-hansi-theme-font: minor-latin; mso-ansi-language: EN-US; font-family: 'Calibri',sans-serif; mso-ascii-theme-font: minor-latin; mso-fareast-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-bidi-theme-font: minor-bidi;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; color: #000000; font-size: 11pt; mso-hansi-theme-font: minor-latin; mso-ansi-language: EN-US; font-family: 'Calibri',sans-serif; mso-ascii-theme-font: minor-latin; mso-fareast-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-bidi-theme-font: minor-bidi;"&gt;Changing the CAN filters on the fly requires entering initialization mode. According to the data sheet, the best practice is to enter sleep mode before entering initialization mode to avoid CAN bus violations. My code currently does that. Before attempting to enter sleep mode, I check for and abort any ongoing transmissions. This must be done in order to enter sleep mode. I first found the need for aborting an ongoing transmission when my device attempted to connect to the vehicle's CAN bus. My device attempts to connect to the vehicle at CAN speeds of 250k and 500k using 11 and 29 bit identifiers. When my device attempted to connect to a 11 bit CAN 500k vehicle via 11bit CAN at 250k, it determined the CAN speed was wrong, but when it attempted to enter sleep mode, it got stuck in the busy wait loop waiting for sleep mode to be entered. I believe this was caused by error frames being generated on the bus since my device was transmitting at the wrong baud rate.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; color: #000000; font-size: 11pt; mso-hansi-theme-font: minor-latin; mso-ansi-language: EN-US; font-family: 'Calibri',sans-serif; mso-ascii-theme-font: minor-latin; mso-fareast-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-bidi-theme-font: minor-bidi;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; color: #000000; font-size: 11pt; mso-hansi-theme-font: minor-latin; mso-ansi-language: EN-US; font-family: 'Calibri',sans-serif; mso-ascii-theme-font: minor-latin; mso-fareast-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-bidi-theme-font: minor-bidi;"&gt;Once I added code to abort any ongoing transmissions before entering sleep mode, things seemed to work great for a while. Then I ran into the issue where the code gets stuck in the while(!CAN0TAAK) loop sometimes. I think what is happening is that at the moment I enter the if(CAN0TFLG != 0x07) statement, there is a transmission in progress and by the time the code attempts to abort the transmission, the transmission has completed so there is nothing to abort. Since there is now nothing to abort, the code gets stuck in the loop waiting for CAN0TAAK to get set.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; color: #000000; font-size: 11pt; mso-hansi-theme-font: minor-latin; mso-ansi-language: EN-US; font-family: 'Calibri',sans-serif; mso-ascii-theme-font: minor-latin; mso-fareast-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-bidi-theme-font: minor-bidi;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; color: #000000; font-size: 11pt; mso-hansi-theme-font: minor-latin; mso-ansi-language: EN-US; font-family: 'Calibri',sans-serif; mso-ascii-theme-font: minor-latin; mso-fareast-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-bidi-theme-font: minor-bidi;"&gt;Now the question is why would there be a transmission in progress at this point that would cause the code to enter the if(CAN0TFLG != 0x07) statement. By the time the code execution gets to the if(CAN0TFLG != 0x07) check, my device has already sent it's request and received a response so nothing else should be being sent and I would expect all of the transmit buffers to be empty, but there is obviously a situation where this is not true since the code is entering the &lt;SPAN style="color: #000000; font-family: Calibri; font-size: 12pt;"&gt;if(CAN0TFLG != 0x07) statement.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; color: #000000; font-size: 12pt; mso-hansi-theme-font: minor-latin; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-fareast-theme-font: minor-latin; font-family: Calibri; mso-fareast-font-family: Calibri; mso-bidi-theme-font: minor-bidi;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; color: #000000; font-size: 12pt; mso-hansi-theme-font: minor-latin; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-fareast-theme-font: minor-latin; font-family: Calibri; mso-fareast-font-family: Calibri; mso-bidi-theme-font: minor-bidi;"&gt;Does anyone have any ideas as to what might be causing this behavior?&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; color: #000000; font-size: 11pt; mso-hansi-theme-font: minor-latin; mso-ansi-language: EN-US; font-family: 'Calibri',sans-serif; mso-ascii-theme-font: minor-latin; mso-fareast-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-bidi-theme-font: minor-bidi;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; color: #000000; font-size: 11pt; mso-hansi-theme-font: minor-latin; mso-ansi-language: EN-US; font-family: 'Calibri',sans-serif; mso-ascii-theme-font: minor-latin; mso-fareast-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-bidi-theme-font: minor-bidi;"&gt;My code has the following flow:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; color: #000000; font-size: 11pt; mso-hansi-theme-font: minor-latin; mso-ansi-language: EN-US; font-family: 'Calibri',sans-serif; mso-ascii-theme-font: minor-latin; mso-fareast-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-bidi-theme-font: minor-bidi;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; color: #000000; font-size: 11pt; mso-hansi-theme-font: minor-latin; mso-ansi-language: EN-US; font-family: 'Calibri',sans-serif; mso-ascii-theme-font: minor-latin; mso-fareast-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-bidi-theme-font: minor-bidi;"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; color: #000000; font-size: 11pt; mso-hansi-theme-font: minor-latin; mso-ansi-language: EN-US; font-family: 'Calibri',sans-serif; mso-ascii-theme-font: minor-latin; mso-fareast-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-bidi-theme-font: minor-bidi;"&gt;. code elided&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; color: #000000; font-size: 11pt; mso-hansi-theme-font: minor-latin; mso-ansi-language: EN-US; font-family: 'Calibri',sans-serif; mso-ascii-theme-font: minor-latin; mso-fareast-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-bidi-theme-font: minor-bidi;"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; color: #000000; font-size: 11pt; mso-hansi-theme-font: minor-latin; mso-ansi-language: EN-US; font-family: 'Calibri',sans-serif; mso-ascii-theme-font: minor-latin; mso-fareast-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-bidi-theme-font: minor-bidi;"&gt;CAN message sent to vehicle&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; color: #000000; font-size: 11pt; mso-hansi-theme-font: minor-latin; mso-ansi-language: EN-US; font-family: 'Calibri',sans-serif; mso-ascii-theme-font: minor-latin; mso-fareast-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-bidi-theme-font: minor-bidi;"&gt;Wait for response from vehicle&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; color: #000000; font-size: 11pt; mso-hansi-theme-font: minor-latin; mso-ansi-language: EN-US; font-family: 'Calibri',sans-serif; mso-ascii-theme-font: minor-latin; mso-fareast-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-bidi-theme-font: minor-bidi;"&gt;CAN message received from vehicle&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; color: #000000; font-size: 11pt; mso-hansi-theme-font: minor-latin; mso-ansi-language: EN-US; font-family: 'Calibri',sans-serif; mso-ascii-theme-font: minor-latin; mso-fareast-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-bidi-theme-font: minor-bidi;"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Calibri; font-size: 12pt;"&gt;. code elided&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; color: #000000; font-size: 11pt; mso-hansi-theme-font: minor-latin; mso-ansi-language: EN-US; font-family: 'Calibri',sans-serif; mso-ascii-theme-font: minor-latin; mso-fareast-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-bidi-theme-font: minor-bidi;"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; color: #000000; font-size: 11pt; mso-hansi-theme-font: minor-latin; mso-ansi-language: EN-US; font-family: 'Calibri',sans-serif; mso-ascii-theme-font: minor-latin; mso-fareast-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-bidi-theme-font: minor-bidi;"&gt;EnterCAN0InitMode() is called that contains the following code:&lt;/SPAN&gt;&lt;SPAN style="mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; color: #000000; font-size: 11pt; mso-hansi-theme-font: minor-latin; mso-ansi-language: EN-US; font-family: 'Calibri',sans-serif; mso-ascii-theme-font: minor-latin; mso-fareast-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-bidi-theme-font: minor-bidi;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style=": ; color: #008000; font-size: 8pt;"&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="color: #000000; font-size: 12pt; font-family: Calibri;"&gt;if (CAN0TFLG != 0x07)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style=": ; color: #000000; font-size: 12pt; font-family: Calibri;"&gt;{&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style=": ; color: #000000; font-size: 12pt; font-family: Calibri;"&gt;&amp;nbsp;&amp;nbsp; CAN0TARQ = 0x07;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style=": ; color: #000000; font-size: 12pt; font-family: Calibri;"&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style=": ; color: #000000; font-size: 12pt; font-family: Calibri;"&gt;&amp;nbsp;&amp;nbsp; while( !CAN0TAAK)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style=": ; color: #000000; font-size: 12pt; font-family: Calibri;"&gt;&amp;nbsp;&amp;nbsp; {&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style=": ; color: #000000; font-size: 12pt; font-family: Calibri;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; // wait for the message transmission to be aborted&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style=": ; color: #000000; font-size: 12pt; font-family: Calibri;"&gt;&amp;nbsp;&amp;nbsp; }&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style=": ; color: #000000; font-size: 12pt; font-family: Calibri;"&gt;}&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style=": ; color: #000000; font-size: 12pt; font-family: Calibri;"&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style=": ; color: #000000; font-size: 12pt; font-family: Calibri;"&gt;CAN0CTL0 |= SLPRQ; // Put the CAN controller to sleep before entering initialization mode to avoid CAN bus violations&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style=": ; color: #000000; font-size: 12pt; font-family: Calibri;"&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style=": ; color: #000000; font-size: 12pt; font-family: Calibri;"&gt;while (!(CAN0CTL1 &amp;amp; SLPAK))&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style=": ; color: #000000; font-size: 12pt; font-family: Calibri;"&gt;{&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style=": ; color: #000000; font-size: 12pt; font-family: Calibri;"&gt;&amp;nbsp;&amp;nbsp; ; // Wait for the CAN controller to go to sleep&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style=": ; color: #000000; font-size: 12pt; font-family: Calibri;"&gt;}&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style=": ; color: #000000; font-size: 12pt; font-family: Calibri;"&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style=": ; color: #000000; font-size: 12pt; font-family: Calibri;"&gt;CAN0CTL0 |= INITRQ // Set the INITRQ bit to request entrance into initialization mode&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style=": ; color: #000000; font-size: 12pt; font-family: Calibri;"&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style=": ; color: #000000; font-size: 12pt; font-family: Calibri;"&gt;while (!(CAN0CTL1 &amp;amp; INITAK))&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style=": ; color: #000000; font-size: 12pt; font-family: Calibri;"&gt;{&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style=": ; color: #000000; font-size: 12pt; font-family: Calibri;"&gt;&amp;nbsp;&amp;nbsp; ; // Wait for the CAN module to enter initialization mode&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style=": ; color: #000000; font-size: 12pt; font-family: Calibri;"&gt;}&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style=": ; color: #000000; font-size: 12pt; font-family: Calibri;"&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style=": ; color: #000000; font-size: 12pt; font-family: Calibri;"&gt;Here is my potential fix:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style=": ; color: #000000; font-size: 12pt; font-family: Calibri;"&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style=": ; color: #000000; font-size: 12pt; font-family: Calibri;"&gt;Replace this:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style=": ; color: #000000; font-size: 12pt; font-family: Calibri;"&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="color: #000000; font-size: 12pt; font-family: Calibri;"&gt;if (CAN0TFLG != 0x07)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style=": ; color: #000000; font-size: 12pt; font-family: Calibri;"&gt;{&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style=": ; color: #000000; font-size: 12pt; font-family: Calibri;"&gt;&amp;nbsp;&amp;nbsp; CAN0TARQ = 0x07;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style=": ; color: #000000; font-size: 12pt; font-family: Calibri;"&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style=": ; color: #000000; font-size: 12pt; font-family: Calibri;"&gt;&amp;nbsp;&amp;nbsp; while( !CAN0TAAK)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style=": ; color: #000000; font-size: 12pt; font-family: Calibri;"&gt;&amp;nbsp;&amp;nbsp; {&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style=": ; color: #000000; font-size: 12pt; font-family: Calibri;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; // wait for the message transmission to be aborted&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style=": ; color: #000000; font-size: 12pt; font-family: Calibri;"&gt;&amp;nbsp;&amp;nbsp; }&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style=": ; color: #000000; font-size: 12pt; font-family: Calibri;"&gt;}&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style=": ; color: #000000; font-size: 12pt; font-family: Calibri;"&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style=": ; color: #000000; font-size: 12pt; font-family: Calibri;"&gt;with this:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style=": ; color: #000000; font-size: 12pt; font-family: Calibri;"&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style=": ; color: #000000; font-size: 12pt; font-family: Calibri;"&gt;while( !CAN0TAAK &amp;amp;&amp;amp; (CAN0TFLG != 0x07)) // if we haven't aborted and CAN0TFLG is not 0x07, then that means a message is in the transmit buffer&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style=": ; color: #000000; font-size: 12pt; font-family: Calibri;"&gt;{&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style=": ; color: #000000; font-size: 12pt; font-family: Calibri;"&gt;&amp;nbsp;&amp;nbsp; CAN0TARQ = 0x07; // abort any ongoing transmission&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style=": ; color: #000000; font-size: 12pt; font-family: Calibri;"&gt;}&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style=": ; color: #008000; font-size: 8pt;"&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;EM style=": ; color: #008000; font-size: 8pt;"&gt;&lt;SPAN style="color: #008000;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #008000;"&gt; &lt;/SPAN&gt;&lt;/EM&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; color: #000000; font-size: 11pt; mso-hansi-theme-font: minor-latin; mso-ansi-language: EN-US; font-family: 'Calibri',sans-serif; mso-ascii-theme-font: minor-latin; mso-fareast-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-bidi-theme-font: minor-bidi;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; color: #000000; font-size: 11pt; mso-hansi-theme-font: minor-latin; mso-ansi-language: EN-US; font-family: 'Calibri',sans-serif; mso-ascii-theme-font: minor-latin; mso-fareast-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-bidi-theme-font: minor-bidi;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; color: #000000; font-size: 11pt; mso-hansi-theme-font: minor-latin; mso-ansi-language: EN-US; font-family: 'Calibri',sans-serif; mso-ascii-theme-font: minor-latin; mso-fareast-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-bidi-theme-font: minor-bidi;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Mar 2015 20:57:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/MSCAN-CAN0TAAK-register-not-being-set/m-p/390836#M10906</guid>
      <dc:creator>gator</dc:creator>
      <dc:date>2015-03-17T20:57:20Z</dc:date>
    </item>
    <item>
      <title>Re: MSCAN CAN0TAAK register not being set</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/MSCAN-CAN0TAAK-register-not-being-set/m-p/390837#M10907</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe little bit late but...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do not use the CANTAAK to check the message was aborted, as there may be a case it was transmitted in fact so ABTAKn flag is not set. Instead use the CANTFLG; a TXEn is set when message is sent or aborted. Then the ABTAKn flag can be used to identify what was done. So try to use following code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if ((CAN0TFLG &amp;amp; 0x07) != 0x07)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P style="text-indent: .5in;"&gt;CAN0TARQ = 0x07;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //request to abort all transmit buffers&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while ((CAN0TFLG &amp;amp; 0x07) != 0x07);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //wait for the abort to be completed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // you can check CAN0TAAK to see which was aborted&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CAN0CTL0 |= SLPRQ; //request sleep mode&lt;/P&gt;&lt;P&gt;while (!(CAN0CTL1 &amp;amp; SLPAK));&amp;nbsp;&amp;nbsp;&amp;nbsp; //wait for acknowledge&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;…&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regarding entering the "if ((CAN0TFLG &amp;amp; 0x07) != 0x07)" statement; either you have some buffer ﬂagged as ready for transmission (by clearing the associated TXE ﬂag) or message was not transmitted successfully (without error).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Petr&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Apr 2015 10:21:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/MSCAN-CAN0TAAK-register-not-being-set/m-p/390837#M10907</guid>
      <dc:creator>PetrS</dc:creator>
      <dc:date>2015-04-23T10:21:07Z</dc:date>
    </item>
    <item>
      <title>Re: MSCAN CAN0TAAK register not being set</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/MSCAN-CAN0TAAK-register-not-being-set/m-p/390838#M10908</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your response. I hope to be able to try your suggestion soon. I will post back here when I am able to determine if your code has fixed my issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Apr 2015 14:48:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/MSCAN-CAN0TAAK-register-not-being-set/m-p/390838#M10908</guid>
      <dc:creator>gator</dc:creator>
      <dc:date>2015-04-27T14:48:07Z</dc:date>
    </item>
  </channel>
</rss>

