<?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>ColdFire/68K Microcontrollers and ProcessorsのトピックRe: FlexCan strange behaviour</title>
    <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/FlexCan-strange-behaviour/m-p/137821#M1990</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;hello,&lt;BR /&gt;&lt;BR /&gt;You should have a look to RXECTR and ERRSTAT registers, maybe the FLEXCAN is in bus off state, because if the cpu core is halted, messages buffers aren't serviced anymore.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Emmanuel,&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 24 Nov 2006 00:17:14 GMT</pubDate>
    <dc:creator>Nouchi</dc:creator>
    <dc:date>2006-11-24T00:17:14Z</dc:date>
    <item>
      <title>FlexCan strange behaviour</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/FlexCan-strange-behaviour/m-p/137820#M1989</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello!&lt;/DIV&gt;&lt;DIV&gt;I'm working on a FlexCan application on the MCF52235. Everything works well, until I have at least two devices connected on the bus. Today I discovered that there is a problem when I left the board with the micro unconnected. The program stucks at this instruction:&lt;/DIV&gt;&lt;SPAN class="msg_source_code"&gt;&lt;SPAN class="text_smallest"&gt;Code:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;PRE&gt;while( (MCF_CAN_ERRSTAT &amp;amp; MCF_CAN_ERRSTAT_IDLE)==0 );&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;The complete code for sending routine is the following:&lt;/DIV&gt;&lt;SPAN class="msg_source_code"&gt;&lt;SPAN class="text_smallest"&gt;Code:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;PRE&gt;void CANSendData(int i, int ID, int length, int *data, int ide ){ //Attendi che il bus sia idlewhile( (MCF_CAN_ERRSTAT &amp;amp; MCF_CAN_ERRSTAT_IDLE)==0 );MCF_CAN_MBUF_CODE(i) = MCF_CAN_TX_INACTIVE; //MBi is inactive while( (MCF_CAN_ERRSTAT &amp;amp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (MCF_CAN_ERRSTAT_TXRX + MCF_CAN_ERRSTAT_IDLE))&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; == MCF_CAN_ERRSTAT_TXRX);&amp;nbsp;&amp;nbsp;&amp;nbsp; // Configure IDMCF_CAN_MBUF_ID(i) = ID;&amp;nbsp; // Copy Tx data bytes to the message bufferCANLoadBufferData(i, length, data);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(ide){ MCF_CAN_MBUF_CTRL(i) = 0x40 + 0x20 + length; }else { MCF_CAN_MBUF_CTRL(i) = length; }MCF_CAN_MBUF_CODE(i) = MCF_CAN_TX_TRONCE;}&lt;/PRE&gt;&lt;DIV&gt;&lt;BR /&gt;&amp;nbsp;I thought that the bus&amp;nbsp;never goes "idle" if the&amp;nbsp;micro is&amp;nbsp;not connected; so I removed the two&amp;nbsp;while loop, and the program&amp;nbsp;started to work correctly even when unconnected (or at least, doesn't stuck in the loop).&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I'm still quite uncertain about the&amp;nbsp;usefulness of these&amp;nbsp;while loops...but I was adviced to put them in the code to be sure that the&amp;nbsp;buffer was deactivated.&lt;/DIV&gt;&lt;DIV&gt;Does anybody&amp;nbsp; find a similar problem?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Simone&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Nov 2006 23:08:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/FlexCan-strange-behaviour/m-p/137820#M1989</guid>
      <dc:creator>Simone</dc:creator>
      <dc:date>2006-11-23T23:08:02Z</dc:date>
    </item>
    <item>
      <title>Re: FlexCan strange behaviour</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/FlexCan-strange-behaviour/m-p/137821#M1990</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;hello,&lt;BR /&gt;&lt;BR /&gt;You should have a look to RXECTR and ERRSTAT registers, maybe the FLEXCAN is in bus off state, because if the cpu core is halted, messages buffers aren't serviced anymore.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Emmanuel,&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Nov 2006 00:17:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/FlexCan-strange-behaviour/m-p/137821#M1990</guid>
      <dc:creator>Nouchi</dc:creator>
      <dc:date>2006-11-24T00:17:14Z</dc:date>
    </item>
    <item>
      <title>Re: FlexCan strange behaviour</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/FlexCan-strange-behaviour/m-p/137822#M1991</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello Emmanuel!&lt;/DIV&gt;&lt;DIV&gt;I think that FlexCan is in bus-off state when disconnected; infact when I reconnect it again it exits the loops and works.&lt;/DIV&gt;&lt;DIV&gt;The problem is that the cpu remains stuck in the while loop (waiting for the bus to go idle), preventing the rest of the program to run when the board is disconnected from the can bus. I tried removing the loops, and it still seems to work, but I'm afraid that there will be strange behaviours in future (maybe with more device connected on the bus, trying to send two or more message at the same time).&lt;/DIV&gt;&lt;DIV&gt;If I remove the loops, the only problem is that I can lost messages, or there is something else?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Simone&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Nov 2006 17:28:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/FlexCan-strange-behaviour/m-p/137822#M1991</guid>
      <dc:creator>Simone</dc:creator>
      <dc:date>2006-11-24T17:28:45Z</dc:date>
    </item>
  </channel>
</rss>

