<?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>S32K中的主题 Re: S32K146 CAN Interrupt support</title>
    <link>https://community.nxp.com/t5/S32K/S32K146-CAN-Interrupt-support/m-p/1522961#M17728</link>
    <description>&lt;P&gt;Hi Senlent,&lt;/P&gt;&lt;P&gt;Sorry for the delayed response, we having some delay in the HW modification.&lt;/P&gt;&lt;P&gt;I will test it and let you know if any details required.&lt;/P&gt;&lt;P&gt;Thanks for your reply.&lt;/P&gt;</description>
    <pubDate>Thu, 15 Sep 2022 13:52:28 GMT</pubDate>
    <dc:creator>ArunkumarV</dc:creator>
    <dc:date>2022-09-15T13:52:28Z</dc:date>
    <item>
      <title>S32K146 CAN Interrupt support</title>
      <link>https://community.nxp.com/t5/S32K/S32K146-CAN-Interrupt-support/m-p/1517571#M17556</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I tried with the FlexCAN for the CAN 0 and 1, its working fine in S32K146 EVB.&amp;nbsp;&lt;/P&gt;&lt;P&gt;But parallelly using the 2 uart's in FreeRTOS, facing some issue.&lt;/P&gt;&lt;P&gt;so, trying to configure the CAN with interrupt and call back (same as LPUART example), didn't find any example for CAN interrupt.&lt;/P&gt;&lt;P&gt;configured interrupt and callback not working. seems missing some API calls.&lt;/P&gt;&lt;P&gt;Kindly provide some example for the interrupt configurations and API's.&lt;/P&gt;&lt;P&gt;Thanks in Advance.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2022 09:02:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K146-CAN-Interrupt-support/m-p/1517571#M17556</guid>
      <dc:creator>ArunkumarV</dc:creator>
      <dc:date>2022-09-06T09:02:38Z</dc:date>
    </item>
    <item>
      <title>Re: S32K146 CAN Interrupt support</title>
      <link>https://community.nxp.com/t5/S32K/S32K146-CAN-Interrupt-support/m-p/1518050#M17568</link>
      <description>&lt;P&gt;&lt;A href="mailto:Hi@ArunkumarV" target="_blank"&gt;Hi@ArunkumarV&lt;/A&gt;&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;#include &amp;lt;stdint.h&amp;gt;
#include &amp;lt;stdbool.h&amp;gt;
#include "Cpu.h"

/*Set information about the data to be TX or RX*/
flexcan_data_info_t dataInfo =
{
	.msg_id_type = FLEXCAN_MSG_ID_STD,
	.data_length = 8,
	.fd_enable   = false,
	.fd_padding  = 0U,
	.enable_brs  = false,
	.is_remote = false
};

//Message Box Index
#define mb_idx_0		0
#define mb_idx_1		1
#define mb_idx_2		2
#define mb_idx_3		3

//Message ID
#define msg_id_0		1
#define msg_id_1		2
#define msg_id_2		3
#define msg_id_3		4


flexcan_msgbuff_t recvMsg;

void Can_Callback(uint8_t instance,flexcan_event_type_t eventType,uint32_t buffIdx,flexcan_state_t *flexcanState)
{
	switch(eventType)
	{
		case FLEXCAN_EVENT_RX_COMPLETE:
			if(mb_idx_1 == buffIdx)
			{
				FLEXCAN_DRV_Receive(INST_CANCOM1,mb_idx_1,&amp;amp;recvMsg);
			}
			break;
			
		case FLEXCAN_EVENT_TX_COMPLETE:
		  break;
		
		default:
			break;
	}
}


void flexcan0_ErrorCallback(uint8_t instance, flexcan_event_type_t eventType,flexcan_state_t *flexcanState)
{
	volatile uint32_t error;

	(void)flexcanState;
  (void)instance;

  	switch(eventType)
  	{
  	case FLEXCAN_EVENT_ERROR:

  		error = FLEXCAN_DRV_GetErrorStatus(INST_CANCOM1);

  		if(error&amp;amp;0x4) // if BOFFINT was set
  		{
  			// abort TX MB, after bus off recovery message is not send
  			FLEXCAN_DRV_AbortTransfer(INST_CANCOM1,mb_idx_0);
  		}

  		break;

  	default:
  		break;
  	}
 }

int main(void)
{
	uint8_t SendBuffer[8] = {0};
	bool i = 0;
	CLOCK_SYS_Init(g_clockManConfigsArr,CLOCK_MANAGER_CONFIG_CNT,
								g_clockManCallbacksArr,CLOCK_MANAGER_CALLBACK_CNT);
	CLOCK_SYS_UpdateConfiguration(0U, CLOCK_MANAGER_POLICY_AGREEMENT);
	
	PINS_DRV_Init(NUM_OF_CONFIGURED_PINS, g_pin_mux_InitConfigArr);
	
	/*Initialize FlexCAN driver.*/
	FLEXCAN_DRV_Init(INST_CANCOM1,&amp;amp;canCom1_State,&amp;amp;canCom1_InitConfig0);
	
	/*Configure a Tx Message Buffer.*/
	FLEXCAN_DRV_ConfigTxMb(INST_CANCOM1, mb_idx_0, &amp;amp;dataInfo, msg_id_0);

	/*Configure a Rx Message Buffer.*/
	FLEXCAN_DRV_ConfigRxMb(INST_CANCOM1, mb_idx_1, &amp;amp;dataInfo, msg_id_1);
	
	/*Receives a CAN frame into a configured message buffer.*/
	FLEXCAN_DRV_Receive(INST_CANCOM1,mb_idx_1,&amp;amp;recvMsg);	

	
	/*Install a callback function for the IRQ handler.*/
	FLEXCAN_DRV_InstallEventCallback(INST_CANCOM1,(flexcan_callback_t)Can_Callback,NULL);
	
	FLEXCAN_DRV_InstallErrorCallback(INST_CANCOM1, (flexcan_error_callback_t)flexcan0_ErrorCallback, (void*)NULL);
	
	INT_SYS_EnableIRQ(CAN0_ORed_0_15_MB_IRQn);
	
	INT_SYS_SetPriority(CAN0_ORed_0_15_MB_IRQn,1);	
	
	
	while(1)
	{
	OSIF_TimeDelay(1000);
SendBuffer[3] = 0xff;
FLEXCAN_DRV_Send(INST_CANCOM1,mb_idx_0,&amp;amp;dataInfo,msg_id_0,SendBuffer);
	}
}&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 07 Sep 2022 01:44:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K146-CAN-Interrupt-support/m-p/1518050#M17568</guid>
      <dc:creator>Senlent</dc:creator>
      <dc:date>2022-09-07T01:44:13Z</dc:date>
    </item>
    <item>
      <title>Re: S32K146 CAN Interrupt support</title>
      <link>https://community.nxp.com/t5/S32K/S32K146-CAN-Interrupt-support/m-p/1522961#M17728</link>
      <description>&lt;P&gt;Hi Senlent,&lt;/P&gt;&lt;P&gt;Sorry for the delayed response, we having some delay in the HW modification.&lt;/P&gt;&lt;P&gt;I will test it and let you know if any details required.&lt;/P&gt;&lt;P&gt;Thanks for your reply.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Sep 2022 13:52:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K146-CAN-Interrupt-support/m-p/1522961#M17728</guid>
      <dc:creator>ArunkumarV</dc:creator>
      <dc:date>2022-09-15T13:52:28Z</dc:date>
    </item>
  </channel>
</rss>

