<?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: status is set to kStatus_FLEXCAN_UnHandled in flexcan_callback in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/status-is-set-to-kStatus-FLEXCAN-UnHandled-in-flexcan-callback/m-p/1184771#M58862</link>
    <description>&lt;P&gt;Okay, I figured out, that 0x14BE stands for "kStatus_FLEXCAN_ErrorStatus" which gets set due to the value Err Status value that comes from FLEXCAN_GetStatusFlags() has the kFLEXCAN_ErrorIntFlag bit set. In the comment it just reads "Error Interrupt Flag" - I need to get this fixed.&lt;/P&gt;</description>
    <pubDate>Wed, 18 Nov 2020 00:42:45 GMT</pubDate>
    <dc:creator>stdcerr</dc:creator>
    <dc:date>2020-11-18T00:42:45Z</dc:date>
    <item>
      <title>status is set to kStatus_FLEXCAN_UnHandled in flexcan_callback</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/status-is-set-to-kStatus-FLEXCAN-UnHandled-in-flexcan-callback/m-p/1181636#M58798</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm working on a receive only CAN application that reads data from a sensor but am not able to receive anything so far.&lt;/P&gt;&lt;H3&gt;The setup&lt;/H3&gt;&lt;P&gt;I have a tilt sensor attached to my uC CAN module (PTB18 &amp;amp; PTB19) that continuously sends out frames at 250kbit/s. I have a CAN analyzer connected with which I can see the frames on the bus.&lt;/P&gt;&lt;P&gt;The plan is to use Kinetis to read these frames for further processing.&lt;/P&gt;&lt;P&gt;I planned to retrieve data with &lt;EM&gt;FLEXCAN_TransferReceiveNonBlocking&lt;/EM&gt; but realized that statusis constantly set to&lt;EM&gt; kStatus_FLEXCAN_RxBusy&lt;/EM&gt; even with the sensor disconnected.&lt;BR /&gt;A call to &lt;EM&gt;FLEXCAN_TransferHandleIRQ(EXAMPLE_CAN, &amp;amp;flexcanHandle);&lt;/EM&gt; will invoke the callback with status set to &lt;EM&gt;kStatus_FLEXCAN_UnHandled. &lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;mbState&lt;/EM&gt; of the mailbox is set to 1 (&lt;EM&gt;kFLEXCAN_StateRxData&lt;/EM&gt;).&lt;BR /&gt;The callback never is invoked with &lt;EM&gt;status&lt;/EM&gt; = &lt;EM&gt;kStatus_FLEXCAN_RxIdle&lt;/EM&gt;&lt;/P&gt;&lt;H3&gt;Code:&lt;/H3&gt;&lt;P&gt;globals:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;#define EXAMPLE_CAN                CAN0
#define EXAMPLE_CAN_CLK_SOURCE     (kFLEXCAN_ClkSrc1)
#define EXAMPLE_CAN_CLK_FREQ       CLOCK_GetFreq(kCLOCK_BusClk)
#define RX_MESSAGE_BUFFER_NUM      (9)
#define DLC                        (8)
#define SET_CAN_QUANTUM            (0)
#define PSEG1                      (3)
#define PSEG2                      (2)
#define PROPSEG                    (1)
#define LOG_INFO                   (void)PRINTF

volatile bool rxComplete = false;
flexcan_frame_t rxFrame;
flexcan_mb_transfer_t rxXfer;
flexcan_handle_t flexcanHandle;&lt;/LI-CODE&gt;&lt;P&gt;CAN setup:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;    FLEXCAN_GetDefaultConfig(&amp;amp;flexcanConfig);

#if defined(EXAMPLE_CAN_CLK_SOURCE)
    flexcanConfig.clksrc=EXAMPLE_CAN_CLK_SOURCE;
#endif

    flexcanConfig.enableListenOnlyMode = true;
    flexcanConfig.baudRate = 250000U;
    //flexcanConfig.enableLoopBack = true;

    FLEXCAN_Init(EXAMPLE_CAN, &amp;amp;flexcanConfig, EXAMPLE_CAN_CLK_FREQ);
    /* Create FlexCAN handle structure and set call back function. */
    FLEXCAN_TransferCreateHandle(EXAMPLE_CAN, &amp;amp;flexcanHandle, flexcan_callback, NULL);

    /* Setup Rx Message Buffer. */
    mbConfig.format = kFLEXCAN_FrameFormatStandard;
    mbConfig.type   = kFLEXCAN_FrameTypeData;
    mbConfig.id     = FLEXCAN_ID_STD(0x10FF53C2);
    FLEXCAN_SetRxMbConfig(EXAMPLE_CAN, RX_MESSAGE_BUFFER_NUM, &amp;amp;mbConfig, true);

    /* Start receive data through Rx Message Buffer. */
    rxXfer.mbIdx = (uint8_t)RX_MESSAGE_BUFFER_NUM;
    rxXfer.frame = &amp;amp;rxFrame;&lt;/LI-CODE&gt;&lt;P&gt;the callback:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;static void flexcan_callback(CAN_Type *base, flexcan_handle_t *handle, status_t status, uint32_t result, void *userData)
{
    switch (status)
    {
        /* Process FlexCAN Rx event. */
        case kStatus_FLEXCAN_RxIdle:
            if (RX_MESSAGE_BUFFER_NUM == result) {
                rxComplete = true;
            }
            LOG_INFO("kStatus_FLEXCAN_RxIdle\r\n");
            break;
        case kStatus_FLEXCAN_UnHandled:
        	LOG_INFO("kStatus_FLEXCAN_UnHandled\r\n");
        	break;
        default:
        	LOG_INFO("in flexcan_cb, status 0x%x(%d)\r\n",status,status);
    }

}&lt;/LI-CODE&gt;&lt;P&gt;receiving loop:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;    while (!rxComplete) {
    	(void)FLEXCAN_TransferReceiveNonBlocking(EXAMPLE_CAN, &amp;amp;flexcanHandle, &amp;amp;rxXfer);
    	FLEXCAN_TransferHandleIRQ(EXAMPLE_CAN, &amp;amp;flexcanHandle);
    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also did attach flexcan_test.c that contains the above code.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Nov 2020 18:27:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/status-is-set-to-kStatus-FLEXCAN-UnHandled-in-flexcan-callback/m-p/1181636#M58798</guid>
      <dc:creator>stdcerr</dc:creator>
      <dc:date>2020-11-11T18:27:57Z</dc:date>
    </item>
    <item>
      <title>Re: status is set to kStatus_FLEXCAN_UnHandled in flexcan_callback</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/status-is-set-to-kStatus-FLEXCAN-UnHandled-in-flexcan-callback/m-p/1184692#M58856</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you provide the part number you are working with?&lt;/P&gt;
&lt;P&gt;I'm awaiting for your reply.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Nov 2020 19:45:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/status-is-set-to-kStatus-FLEXCAN-UnHandled-in-flexcan-callback/m-p/1184692#M58856</guid>
      <dc:creator>Omar_Anguiano</dc:creator>
      <dc:date>2020-11-17T19:45:08Z</dc:date>
    </item>
    <item>
      <title>Re: status is set to kStatus_FLEXCAN_UnHandled in flexcan_callback</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/status-is-set-to-kStatus-FLEXCAN-UnHandled-in-flexcan-callback/m-p/1184695#M58857</link>
      <description>&lt;P&gt;Definitely can, I'm working with a MK64FN1M0VLL12&lt;/P&gt;</description>
      <pubDate>Tue, 17 Nov 2020 19:55:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/status-is-set-to-kStatus-FLEXCAN-UnHandled-in-flexcan-callback/m-p/1184695#M58857</guid>
      <dc:creator>stdcerr</dc:creator>
      <dc:date>2020-11-17T19:55:17Z</dc:date>
    </item>
    <item>
      <title>Re: status is set to kStatus_FLEXCAN_UnHandled in flexcan_callback</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/status-is-set-to-kStatus-FLEXCAN-UnHandled-in-flexcan-callback/m-p/1184711#M58858</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for provide me the part number.&lt;/P&gt;
&lt;P&gt;I suggest you to refer to the example flexcan_loopback_transfer disabling the loopback. In the callback for the RX please disable the interruption flag. Also you can do test with a lower baudrate, 125000 was helpful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let me know if this is helpful, if you have more questions do not hesitate to ask me.&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;Omar&lt;/P&gt;</description>
      <pubDate>Tue, 17 Nov 2020 20:40:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/status-is-set-to-kStatus-FLEXCAN-UnHandled-in-flexcan-callback/m-p/1184711#M58858</guid>
      <dc:creator>Omar_Anguiano</dc:creator>
      <dc:date>2020-11-17T20:40:19Z</dc:date>
    </item>
    <item>
      <title>Re: status is set to kStatus_FLEXCAN_UnHandled in flexcan_callback</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/status-is-set-to-kStatus-FLEXCAN-UnHandled-in-flexcan-callback/m-p/1184765#M58861</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the reply.&lt;/P&gt;&lt;P&gt;The flexcan loopback example is where I started from, I experimented with multiple baudrates and all seemed fine until I initialized my pins, removed the loopback and set the baudrate to match the sensor's 250000U. I would be notified through the callback, but status would never be set to kStatus_FLEXCAN_RxIdle but instead status is set to 0x14be and I could not figure out what this is telling me.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2020 00:13:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/status-is-set-to-kStatus-FLEXCAN-UnHandled-in-flexcan-callback/m-p/1184765#M58861</guid>
      <dc:creator>stdcerr</dc:creator>
      <dc:date>2020-11-18T00:13:49Z</dc:date>
    </item>
    <item>
      <title>Re: status is set to kStatus_FLEXCAN_UnHandled in flexcan_callback</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/status-is-set-to-kStatus-FLEXCAN-UnHandled-in-flexcan-callback/m-p/1184771#M58862</link>
      <description>&lt;P&gt;Okay, I figured out, that 0x14BE stands for "kStatus_FLEXCAN_ErrorStatus" which gets set due to the value Err Status value that comes from FLEXCAN_GetStatusFlags() has the kFLEXCAN_ErrorIntFlag bit set. In the comment it just reads "Error Interrupt Flag" - I need to get this fixed.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2020 00:42:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/status-is-set-to-kStatus-FLEXCAN-UnHandled-in-flexcan-callback/m-p/1184771#M58862</guid>
      <dc:creator>stdcerr</dc:creator>
      <dc:date>2020-11-18T00:42:45Z</dc:date>
    </item>
  </channel>
</rss>

