<?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 S32K144 CAN Rx FiFo Interrupts in S32K</title>
    <link>https://community.nxp.com/t5/S32K/S32K144-CAN-Rx-FiFo-Interrupts/m-p/1888268#M36633</link>
    <description>&lt;P&gt;Hi their,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using CAN0 in S32K144 and using Rx FiFo mechanism in that via Interrupts.&lt;/P&gt;&lt;P&gt;My configurations are:&lt;/P&gt;&lt;P&gt;1) Format A Filter table and 8 Rx Filter elements&lt;/P&gt;&lt;P&gt;2) CAN0 at 500kbps, Rx Fifo enabled and via interrupts&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And in the main() i have written this code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;// RX FIFO Filter table structure
const Flexcan_Ip_IdTableType GB_FlexCAN_IdFilterTable[8] = {
    		{
    		.isRemoteFrame = FALSE,
			.isExtendedFrame = FALSE,
			.id = 0x320
    		},
			{
			.isRemoteFrame = FALSE,
			.isExtendedFrame = FALSE,
			.id = 0x330
			 },
			 {
			.isRemoteFrame = FALSE,
			.isExtendedFrame = FALSE,
			.id = 0x340
			 },
			 {
			.isRemoteFrame = FALSE,
			.isExtendedFrame = FALSE,
			.id = 0x350
			 },
			 {
			.isRemoteFrame = FALSE,
			.isExtendedFrame = FALSE,
			.id = 0x360
			 },
			 {
			.isRemoteFrame = FALSE,
			.isExtendedFrame = FALSE,
			.id = 0x370
			 },

			 {
			.isRemoteFrame = FALSE,
			.isExtendedFrame = FALSE,
			.id = 0x380
			 },

			 {
			.isRemoteFrame = FALSE,
			.isExtendedFrame = FALSE,
			.id = 0x390
			 }

    };

int main(void)
{
	Flexcan_Ip_StatusType FlexCAN_Api_Status;
    /* Write your code here */
    Clock_Ip_Init(&amp;amp;Mcu_aClockConfigPB[0]);

#if defined (FEATURE_CLOCK_IP_HAS_SPLL_CLK)
    while ( CLOCK_IP_PLL_LOCKED != Clock_Ip_GetPllStatus() )
    {
        /* Busy wait until the System PLL is locked */
    }
    Clock_Ip_DistributePll();
#endif

    IntCtrl_Ip_EnableIrq(CAN0_ORed_0_15_MB_IRQn);
    IntCtrl_Ip_InstallHandler(CAN0_ORed_0_15_MB_IRQn, CAN0_ORED_0_15_MB_IRQHandler, NULL_PTR);

    /* Initialize all pins using the Port driver */
    Port_Init(NULL_PTR);
    /* Initilisize FlexCAN Module according to FlexCAN_Config0 data structure */
    FlexCAN_Ip_Init(INST_FLEXCAN_0, &amp;amp;FlexCAN_State0, &amp;amp;FlexCAN_Config0);

    /* Configure the RxFIFO with corresponding ID filter table acceptance format and acceptance message ID's*/
    FlexCAN_Api_Status = FlexCAN_Ip_ConfigRxFifo_Privileged(INST_FLEXCAN_0, FLEXCAN_RX_FIFO_ID_FORMAT_A, &amp;amp;GB_FlexCAN_IdFilterTable);

    /* Start the FlexCAN Module */
    FlexCAN_Api_Status = FlexCAN_Ip_SetStartMode(INST_FLEXCAN_0);

	/* RxFiFo in non-blocking method*/
FlexCAN_Api_Status = FlexCAN_Ip_RxFifo(INST_FLEXCAN_0, &amp;amp;GB_FlexCAN_Receive_Data);

    for(;;)
   {
    	/* RxFiFo in non-blocking method*/
    	FlexCAN_Api_Status = FlexCAN_Ip_RxFifo(INST_FLEXCAN_0, &amp;amp;GB_FlexCAN_Receive_Data);
    	TestDelay(20000000);
   }

    return 0;
}

/* END main */
/*!
** @}
*/&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now my question and issue is that under the infinite for loop, i have written&amp;nbsp;&lt;STRONG&gt; FlexCAN_Api_Status = FlexCAN_Ip_RxFifo(INST_FLEXCAN_0, &amp;amp;GB_FlexCAN_Receive_Data);.&amp;nbsp;&lt;/STRONG&gt;It works fine and my Interrupt is working fine.&amp;nbsp;&lt;/P&gt;&lt;P&gt;But if i remove this API from for loop and put it above for loop and in for loop its just delay like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;/* RxFiFo in non-blocking method*/
FlexCAN_Api_Status = FlexCAN_Ip_RxFifo(INST_FLEXCAN_0, &amp;amp;GB_FlexCAN_Receive_Data);
    for(;;)
   {

    	TestDelay(20000000);
   }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then my interrupt is not generated regularly. It only generates for first time and once it enters in for loop then if i send CAN data my Rx FiFo interrupt is not generated for the message ID that are configured in filter table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So why is this happening? As if &lt;STRONG&gt;I am using interrupt it should trigger interrupt in infinite loop if any CAN received data comes in.&lt;/STRONG&gt; Do we have to call&amp;nbsp;&lt;STRONG&gt;FlexCAN_Ip_RxFifo() API&amp;nbsp;&lt;/STRONG&gt;everytime to receive data? If that is the case, isnt that wrong because if i have to call API to receive data everytime then its fundamental usecase would not happen.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Let me know if i am missing something and what should be workaround. My ask is simple that i want to receice CAN data via Rx FiFo in interrupt data if any new can data of configured message id comes, even if code is in infinite loop&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 16 Jun 2024 19:10:47 GMT</pubDate>
    <dc:creator>Kunal_Gettobyte</dc:creator>
    <dc:date>2024-06-16T19:10:47Z</dc:date>
    <item>
      <title>S32K144 CAN Rx FiFo Interrupts</title>
      <link>https://community.nxp.com/t5/S32K/S32K144-CAN-Rx-FiFo-Interrupts/m-p/1888268#M36633</link>
      <description>&lt;P&gt;Hi their,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using CAN0 in S32K144 and using Rx FiFo mechanism in that via Interrupts.&lt;/P&gt;&lt;P&gt;My configurations are:&lt;/P&gt;&lt;P&gt;1) Format A Filter table and 8 Rx Filter elements&lt;/P&gt;&lt;P&gt;2) CAN0 at 500kbps, Rx Fifo enabled and via interrupts&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And in the main() i have written this code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;// RX FIFO Filter table structure
const Flexcan_Ip_IdTableType GB_FlexCAN_IdFilterTable[8] = {
    		{
    		.isRemoteFrame = FALSE,
			.isExtendedFrame = FALSE,
			.id = 0x320
    		},
			{
			.isRemoteFrame = FALSE,
			.isExtendedFrame = FALSE,
			.id = 0x330
			 },
			 {
			.isRemoteFrame = FALSE,
			.isExtendedFrame = FALSE,
			.id = 0x340
			 },
			 {
			.isRemoteFrame = FALSE,
			.isExtendedFrame = FALSE,
			.id = 0x350
			 },
			 {
			.isRemoteFrame = FALSE,
			.isExtendedFrame = FALSE,
			.id = 0x360
			 },
			 {
			.isRemoteFrame = FALSE,
			.isExtendedFrame = FALSE,
			.id = 0x370
			 },

			 {
			.isRemoteFrame = FALSE,
			.isExtendedFrame = FALSE,
			.id = 0x380
			 },

			 {
			.isRemoteFrame = FALSE,
			.isExtendedFrame = FALSE,
			.id = 0x390
			 }

    };

int main(void)
{
	Flexcan_Ip_StatusType FlexCAN_Api_Status;
    /* Write your code here */
    Clock_Ip_Init(&amp;amp;Mcu_aClockConfigPB[0]);

#if defined (FEATURE_CLOCK_IP_HAS_SPLL_CLK)
    while ( CLOCK_IP_PLL_LOCKED != Clock_Ip_GetPllStatus() )
    {
        /* Busy wait until the System PLL is locked */
    }
    Clock_Ip_DistributePll();
#endif

    IntCtrl_Ip_EnableIrq(CAN0_ORed_0_15_MB_IRQn);
    IntCtrl_Ip_InstallHandler(CAN0_ORed_0_15_MB_IRQn, CAN0_ORED_0_15_MB_IRQHandler, NULL_PTR);

    /* Initialize all pins using the Port driver */
    Port_Init(NULL_PTR);
    /* Initilisize FlexCAN Module according to FlexCAN_Config0 data structure */
    FlexCAN_Ip_Init(INST_FLEXCAN_0, &amp;amp;FlexCAN_State0, &amp;amp;FlexCAN_Config0);

    /* Configure the RxFIFO with corresponding ID filter table acceptance format and acceptance message ID's*/
    FlexCAN_Api_Status = FlexCAN_Ip_ConfigRxFifo_Privileged(INST_FLEXCAN_0, FLEXCAN_RX_FIFO_ID_FORMAT_A, &amp;amp;GB_FlexCAN_IdFilterTable);

    /* Start the FlexCAN Module */
    FlexCAN_Api_Status = FlexCAN_Ip_SetStartMode(INST_FLEXCAN_0);

	/* RxFiFo in non-blocking method*/
FlexCAN_Api_Status = FlexCAN_Ip_RxFifo(INST_FLEXCAN_0, &amp;amp;GB_FlexCAN_Receive_Data);

    for(;;)
   {
    	/* RxFiFo in non-blocking method*/
    	FlexCAN_Api_Status = FlexCAN_Ip_RxFifo(INST_FLEXCAN_0, &amp;amp;GB_FlexCAN_Receive_Data);
    	TestDelay(20000000);
   }

    return 0;
}

/* END main */
/*!
** @}
*/&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now my question and issue is that under the infinite for loop, i have written&amp;nbsp;&lt;STRONG&gt; FlexCAN_Api_Status = FlexCAN_Ip_RxFifo(INST_FLEXCAN_0, &amp;amp;GB_FlexCAN_Receive_Data);.&amp;nbsp;&lt;/STRONG&gt;It works fine and my Interrupt is working fine.&amp;nbsp;&lt;/P&gt;&lt;P&gt;But if i remove this API from for loop and put it above for loop and in for loop its just delay like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;/* RxFiFo in non-blocking method*/
FlexCAN_Api_Status = FlexCAN_Ip_RxFifo(INST_FLEXCAN_0, &amp;amp;GB_FlexCAN_Receive_Data);
    for(;;)
   {

    	TestDelay(20000000);
   }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then my interrupt is not generated regularly. It only generates for first time and once it enters in for loop then if i send CAN data my Rx FiFo interrupt is not generated for the message ID that are configured in filter table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So why is this happening? As if &lt;STRONG&gt;I am using interrupt it should trigger interrupt in infinite loop if any CAN received data comes in.&lt;/STRONG&gt; Do we have to call&amp;nbsp;&lt;STRONG&gt;FlexCAN_Ip_RxFifo() API&amp;nbsp;&lt;/STRONG&gt;everytime to receive data? If that is the case, isnt that wrong because if i have to call API to receive data everytime then its fundamental usecase would not happen.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Let me know if i am missing something and what should be workaround. My ask is simple that i want to receice CAN data via Rx FiFo in interrupt data if any new can data of configured message id comes, even if code is in infinite loop&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 16 Jun 2024 19:10:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K144-CAN-Rx-FiFo-Interrupts/m-p/1888268#M36633</guid>
      <dc:creator>Kunal_Gettobyte</dc:creator>
      <dc:date>2024-06-16T19:10:47Z</dc:date>
    </item>
    <item>
      <title>Re: S32K144 CAN Rx FiFo Interrupts</title>
      <link>https://community.nxp.com/t5/S32K/S32K144-CAN-Rx-FiFo-Interrupts/m-p/1888302#M36636</link>
      <description>&lt;P&gt;Hi@&lt;SPAN&gt;Kunal_Gettobyte&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Please refer to this post and also you can find demo in this articles.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.nxp.com/t5/S32K-Knowledge-Base/S32K1xx-FlexCAN-Mask-Setting-Demo/ta-p/1519753" target="_blank"&gt;https://community.nxp.com/t5/S32K-Knowledge-Base/S32K1xx-FlexCAN-Mask-Setting-Demo/ta-p/1519753&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2024 02:18:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K144-CAN-Rx-FiFo-Interrupts/m-p/1888302#M36636</guid>
      <dc:creator>Senlent</dc:creator>
      <dc:date>2024-06-17T02:18:05Z</dc:date>
    </item>
    <item>
      <title>Re: S32K144 CAN Rx FiFo Interrupts</title>
      <link>https://community.nxp.com/t5/S32K/S32K144-CAN-Rx-FiFo-Interrupts/m-p/1888852#M36671</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thanks, problem solved.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2024 16:48:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K144-CAN-Rx-FiFo-Interrupts/m-p/1888852#M36671</guid>
      <dc:creator>Kunal_Gettobyte</dc:creator>
      <dc:date>2024-06-17T16:48:57Z</dc:date>
    </item>
  </channel>
</rss>

