<?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>MPC5xxx中的主题 Re: CAN-FD support MPC5748G</title>
    <link>https://community.nxp.com/t5/MPC5xxx/CAN-FD-support-MPC5748G/m-p/1823492#M25005</link>
    <description>&lt;P&gt;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/52961"&gt;@PetrS&lt;/a&gt;&amp;nbsp;Thanks a lot for your answer.&lt;/P&gt;&lt;P&gt;here is the register setup after initialisation :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Kazarian_0-1709824761467.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/267069i7075929F31FD969B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Kazarian_0-1709824761467.png" alt="Kazarian_0-1709824761467.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Kazarian_0-1709824761467.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Complete register view :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Kazarian_1-1709824797843.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/267070i7B803867B8452863/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Kazarian_1-1709824797843.png" alt="Kazarian_1-1709824797843.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Kazarian_1-1709824797843.png&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Kazarian_2-1709824831503.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/267072i11A36AB841126BD8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Kazarian_2-1709824831503.png" alt="Kazarian_2-1709824831503.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Kazarian_2-1709824831503.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The message buffer :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Kazarian_3-1709824857193.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/267073i7FF7403D000DBACE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Kazarian_3-1709824857193.png" alt="Kazarian_3-1709824857193.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Kazarian_3-1709824857193.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;we use Vector cancase to send CAN-FD fram, based on the input from the excel sheet, i choose to set the following&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;            // arbitration bitrate
            canFdConf.arbitrationBitRate = 500000;
            canFdConf.tseg1Abr = 34;
            canFdConf.tseg2Abr = 5;
            canFdConf.sjwAbr = 4;

            // data bitrate
            canFdConf.dataBitRate = canFdConf.arbitrationBitRate * 4;
            canFdConf.tseg1Dbr = 31;
            canFdConf.tseg2Dbr = 8;
            canFdConf.sjwDbr = 1;&lt;/LI-CODE&gt;&lt;P&gt;ESR1 suggest that an ovverus is occured, and the FlexCAN is not synchronised with the bus, where did the problem comes from ?&lt;/P&gt;&lt;P&gt;ECR has a value of 0x40005E00&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
    <pubDate>Thu, 07 Mar 2024 15:29:53 GMT</pubDate>
    <dc:creator>Kazarian</dc:creator>
    <dc:date>2024-03-07T15:29:53Z</dc:date>
    <item>
      <title>CAN-FD support MPC5748G</title>
      <link>https://community.nxp.com/t5/MPC5xxx/CAN-FD-support-MPC5748G/m-p/1822436#M24994</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I want to add CAN-FD support to an existing project, the application is a simple Echo, when it receive a CAN message on a Node it will echo it back. the Standard CAN works fine, i modified the init function to support CAN-FD based on project shared by PeterS and updated the register CBT and FDCBT based on this &lt;A href="https://community.nxp.com/t5/MPC5xxx-Knowledge-Base/MPC5xxx-S32Kxx-LPCxxxx-CAN-CAN-FD-bit-timing-calculation/ta-p/1119319" target="_blank"&gt;excel sheet.&lt;/A&gt;&lt;/P&gt;&lt;P&gt;this is the init function&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;AbstractCANTransceiver::ErrorCode FlexCANDevice::init()
{
	Io::setDefaultConfiguration(fConfig.txPort);
	Io::setDefaultConfiguration(fConfig.rxPort);
	fPhy.init(fConfig.BusId);

	/* CAN FD init config */
	if(fConfig.fd_enable) 
	{
		/* enable the FlexCAN module, reset and freeze */
		fpDevice-&amp;gt;MCR.R = (0
                    | CAN_MCR_FRZ  /* enabled to enter Freeze mode */ 
                    | CAN_MCR_HALT /* enter freeze mode if FRZ bit is set */
                    | CAN_MCR_BCC  /* individual Rx masking and queue */
                    | 0x0000003F); 

		/* double check that we are actually in freeze mode */
		while(0 == fpDevice-&amp;gt;MCR.B.FRZACK) {};
		while(0 == fpDevice-&amp;gt;MCR.B.NOTRDY) {};    


		fpDevice-&amp;gt;MCR.R = (0
                    | CAN_MCR_FRZ  /* enabled to enter Freeze mode */ 
                    | CAN_MCR_HALT /* enter freeze mode if FRZ bit is set */  
                    | CAN_MCR_BCC  /* individual Rx masking and queue */
                    | CAN_MCR_AEN  /* Safe Tx abort enable */
		            | CAN_MCR_FDEN /* CAN FD enabled */
                    | 0x0000003F); /* enable 64 MBs */        
    
		// Set CAN Bit Timing Register (CAN_CBT. P-1747)
		fpDevice-&amp;gt;CBT.B.BTF 	 = 1; 	// Enable extended bit time definitions
		fpDevice-&amp;gt;CBT.B.EPRESDIV =	fConfig.bitrate_cbt.presDiv;
		fpDevice-&amp;gt;CBT.B.ERJW 	 =  fConfig.bitrate_cbt.rjw;  
		fpDevice-&amp;gt;CBT.B.EPROPSEG =  fConfig.bitrate_cbt.propSeg;	 
		fpDevice-&amp;gt;CBT.B.EPSEG1   =  fConfig.bitrate_cbt.pSeg1;  
		fpDevice-&amp;gt;CBT.B.EPSEG2   =  fConfig.bitrate_cbt.pSeg2; 

		// Set CAN FD Bit Timing register (CAN_FDCBT. P-1768)
		fpDevice-&amp;gt;FDCBT.B.FPRESDIV = fConfig.bitrate.presDiv;
		fpDevice-&amp;gt;FDCBT.B.FRJW     = fConfig.bitrate.rjw;
		fpDevice-&amp;gt;FDCBT.B.FPROPSEG = fConfig.bitrate.propSeg;
		fpDevice-&amp;gt;FDCBT.B.FPSEG1   = fConfig.bitrate.pSeg1;
		fpDevice-&amp;gt;FDCBT.B.FPSEG2   = fConfig.bitrate.pSeg2;
		
		// Set CAN FD Control register (CAN_FDCTRL .P-1766)
		fpDevice-&amp;gt;FDCTRL.R = 0;
		fpDevice-&amp;gt;FDCTRL.B.FDRATE = 1;   // bit rate switching enable
		fpDevice-&amp;gt;FDCTRL.B.MBDSR0 = fConfig.payload;

	}
	/* Standard CAN init config */
	else 
	{
		fpDevice-&amp;gt;MCR.B.MDIS = 0; // Enable module

		fpDevice-&amp;gt;MCR.R |= MCR_SOFT_RESET_MASK; // Soft reset
		if (isEqualAfterTimeout&amp;lt;vuint32_t&amp;gt;(
					&amp;amp;fpDevice-&amp;gt;MCR.R,
					MCR_SOFT_RESET_MASK,
					MCR_SOFT_RESET_MASK,
					INIT_DELAY_TIMEOUT_US))
		{
			return AbstractCANTransceiver::CAN_ERR_INIT_FAILED;
		}

		fpDevice-&amp;gt;MCR.B.FRZ = 1; // Enter freeze mode
		fpDevice-&amp;gt;MCR.B.HALT = 1;
		if (isEqualAfterTimeout&amp;lt;vuint32_t&amp;gt;(
					&amp;amp;fpDevice-&amp;gt;MCR.R,
					MCR_FREEZE_ACK_MASK,
					0UL, INIT_DELAY_TIMEOUT_US))
		{
			return AbstractCANTransceiver::CAN_ERR_INIT_FAILED;
		}

		// Setup MCR
		fpDevice-&amp;gt;MCR.B.SRXDIS = 1;   // Disable self reception
		fpDevice-&amp;gt;MCR.B.MAXMB = 0x3f; // Use all 64 message buffers
		fpDevice-&amp;gt;MCR.B.IRMQ = 1;	  //have to be switch On

		fpDevice-&amp;gt;CTRL1.R |= CTRL_TIMING_HIGHSPEED; // 500KB
		
		fpDevice-&amp;gt;CTRL2.B.MRP = 1;

	}
	
	// Setup message buffers (Both for Standard CAN and CAN-FD instances)
	fRxInterruptMask = 0;
	uint32_t mask = 1;
	for (uint8_t i = 0; i &amp;lt; fConfig.numRxBufsStd; ++i)
	{
		setupMessageBuffer(i, CANRxBuffer::CODE_EMPTY, false);
		fRxInterruptMask |= mask;
		mask &amp;lt;&amp;lt;= 1;
	}
	mask = (1 &amp;lt;&amp;lt; fConfig.numRxBufsStd);
	for (uint8_t i = fConfig.numRxBufsStd;
			i &amp;lt; fConfig.numRxBufsStd + fConfig.numRxBufsExt; ++i)
	{
		setupMessageBuffer(i, CANRxBuffer::CODE_EMPTY, true);
		fRxInterruptMask |= mask;
		mask &amp;lt;&amp;lt;= 1;
	}
	for (uint8_t i = FIRST_TRANSMIT_BUFFER;
			i &amp;lt; FIRST_TRANSMIT_BUFFER + fConfig.numTxBufsApp; ++i)
	{
		setupMessageBuffer(i, CANTxBuffer::CODE_INACTIVE, false);
	}
	setupMessageBuffer(CALLBACK_TRANSMIT_BUFFER, CANTxBuffer::CODE_INACTIVE, false);

	// Clear and disable interrupts
	fpDevice-&amp;gt;RXMGMASK.R = 0;
	fpDevice-&amp;gt;RX14MASK.R = 0;
	fpDevice-&amp;gt;RX15MASK.R = 0;

	fpDevice-&amp;gt;IMASK1.R = 0;
	fpDevice-&amp;gt;IMASK2.R = 0;

	fpDevice-&amp;gt;IFLAG1.R = 0xffffffff;
	fpDevice-&amp;gt;IFLAG2.R = 0xffffffff;
	fpDevice-&amp;gt;ESR1.R = 0xffffffff;
	fFirstRxId = 0;
	fFramesReceived = 0;

	return AbstractCANTransceiver::CAN_ERR_OK;
}

void setupMessageBuffer(uint8_t bufIdx, uint8_t code, bool extended)
{
	fpDevice-&amp;gt;MB[bufIdx].CS.R = 0;
	fpDevice-&amp;gt;MB[bufIdx].CS.B.IDE = extended ? 1 : 0;
	fpDevice-&amp;gt;MB[bufIdx].CS.B.CODE = code;
	fpDevice-&amp;gt;MB[bufIdx].ID.R = 0;
	fpDevice-&amp;gt;MB[bufIdx].DATA.W[0] = 0;
	fpDevice-&amp;gt;MB[bufIdx].DATA.W[1] = 0;
	fpDevice-&amp;gt;RXIMR[bufIdx].R = 0;
}

namespace CANRxBuffer
{
	enum Code
	{
		CODE_INACTIVE 	= 0,
		CODE_FULL 		= 2,
		CODE_EMPTY 		= 4,
		CODE_OVERRUN 	= 5
	};
	static const uint32_t FLAG_BUSY = (1UL &amp;lt;&amp;lt; 24);
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The receive interrupt handler&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;uint8_t FlexCANDevice::receiveISR(const uint8_t* filterMap)
{
	if(fConfig.fd_enable) 
	{
		TransmitMsgFD(0,0x155,8);
	}
	else
	{
		TransmitMsgSTD(0,0x155,8);
	}
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and the CAN node configuration&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;const ::bios::FlexCANDevice::Config Can1Config =
{
	(0xFBEC0000UL),
	::can::AbstractCANTransceiver::BAUDRATE_HIGHSPEED,
	::bios::Io::canGS1Tx,
	::bios::Io::canGS1Rx,
	NUM_RX_STD_MAILBOXES,
	NUM_RX_EXT_MAILBOXES,
	NUM_TX_MAILBOXES,
	::cgw3::busid::BusId::KCAN(),	//busid
	::bios::EdgeWakeUp::KWUP_5,		//wakeUp
	true,							// CAN-FD enabled
	::can::AbstractCANTransceiver::FLEXCAN_PAYLOAD_SIZE_8, 
	// for exact configuration refer to xls file ..\tools\CAN Bit Timing calculation v2.1
	// Arbitration phase, CANx_CBT = 0x80242AC4;  bitrate=500kbps, CPI clk=40 MHz; Prescaler= 2, PROPSEG=11, PSEG1=23, PSEG2=5, RJW=5, smp=87,5%
	{
		1, 			/*!&amp;lt; Prescaler Division Factor*/
		4, 			/*!&amp;lt; Resync Jump Width*/
		10, 			/*!&amp;lt; Propagation Segment*/
		22, 			/*!&amp;lt; Phase Segment 1*/
		4			/*!&amp;lt; Phase Segment 2*/
	},
	// Data Phase, CANx_FDCBT = 0x00111421;  // bitrateFD=2000kbps, CPI clk=40 MHz; fPrescaler= 2, fPROPSEG=5, fPSEG1=2, fPSEG2=2, fRJW=2, smp=80%
	{
		1, 			/*!&amp;lt; Prescaler Division Factor*/
		1, 			/*!&amp;lt; Resync Jump Width*/
		5, 			/*!&amp;lt; Propagation Segment*/
		1, 			/*!&amp;lt; Phase Segment 1*/
		1			/*!&amp;lt; Phase Segment 2*/
	},
};&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp; when i switch to CAN-FD&amp;nbsp; the receive interrupt never happen. probably something wrong with the init or buffer config ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2024 11:18:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/CAN-FD-support-MPC5748G/m-p/1822436#M24994</guid>
      <dc:creator>Kazarian</dc:creator>
      <dc:date>2024-03-06T11:18:08Z</dc:date>
    </item>
    <item>
      <title>Re: CAN-FD support MPC5748G</title>
      <link>https://community.nxp.com/t5/MPC5xxx/CAN-FD-support-MPC5748G/m-p/1823087#M24999</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;from a code it is hard to imagine actual configuration, so it would be better to see register and MB content after init and after message was received.&lt;BR /&gt;I can just point to check MB offset if payload other than 8bytes is used. Then of course check if any error is detected (ECR/ESR1) register. Only error free transmission/reception set MB flag, thus interrupt can be generated if enabled on FlexCAN and core.&lt;/P&gt;
&lt;P&gt;BR, Petr&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2024 07:48:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/CAN-FD-support-MPC5748G/m-p/1823087#M24999</guid>
      <dc:creator>PetrS</dc:creator>
      <dc:date>2024-03-07T07:48:01Z</dc:date>
    </item>
    <item>
      <title>Re: CAN-FD support MPC5748G</title>
      <link>https://community.nxp.com/t5/MPC5xxx/CAN-FD-support-MPC5748G/m-p/1823492#M25005</link>
      <description>&lt;P&gt;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/52961"&gt;@PetrS&lt;/a&gt;&amp;nbsp;Thanks a lot for your answer.&lt;/P&gt;&lt;P&gt;here is the register setup after initialisation :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Kazarian_0-1709824761467.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/267069i7075929F31FD969B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Kazarian_0-1709824761467.png" alt="Kazarian_0-1709824761467.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Kazarian_0-1709824761467.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Complete register view :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Kazarian_1-1709824797843.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/267070i7B803867B8452863/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Kazarian_1-1709824797843.png" alt="Kazarian_1-1709824797843.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Kazarian_1-1709824797843.png&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Kazarian_2-1709824831503.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/267072i11A36AB841126BD8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Kazarian_2-1709824831503.png" alt="Kazarian_2-1709824831503.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Kazarian_2-1709824831503.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The message buffer :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Kazarian_3-1709824857193.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/267073i7FF7403D000DBACE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Kazarian_3-1709824857193.png" alt="Kazarian_3-1709824857193.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Kazarian_3-1709824857193.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;we use Vector cancase to send CAN-FD fram, based on the input from the excel sheet, i choose to set the following&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;            // arbitration bitrate
            canFdConf.arbitrationBitRate = 500000;
            canFdConf.tseg1Abr = 34;
            canFdConf.tseg2Abr = 5;
            canFdConf.sjwAbr = 4;

            // data bitrate
            canFdConf.dataBitRate = canFdConf.arbitrationBitRate * 4;
            canFdConf.tseg1Dbr = 31;
            canFdConf.tseg2Dbr = 8;
            canFdConf.sjwDbr = 1;&lt;/LI-CODE&gt;&lt;P&gt;ESR1 suggest that an ovverus is occured, and the FlexCAN is not synchronised with the bus, where did the problem comes from ?&lt;/P&gt;&lt;P&gt;ECR has a value of 0x40005E00&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2024 15:29:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/CAN-FD-support-MPC5748G/m-p/1823492#M25005</guid>
      <dc:creator>Kazarian</dc:creator>
      <dc:date>2024-03-07T15:29:53Z</dc:date>
    </item>
    <item>
      <title>Re: CAN-FD support MPC5748G</title>
      <link>https://community.nxp.com/t5/MPC5xxx/CAN-FD-support-MPC5748G/m-p/1824148#M25010</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I see you have CTRL2[ISOCANFDEN] cleared, so FlexCAN&amp;nbsp;operates using the non-ISO CAN FD protocol. Be sure your Vector tool is using same one.&lt;BR /&gt;I think setting&amp;nbsp;ISOCANFDEN would help.&lt;/P&gt;
&lt;P&gt;BR, Petr&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2024 12:27:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/CAN-FD-support-MPC5748G/m-p/1824148#M25010</guid>
      <dc:creator>PetrS</dc:creator>
      <dc:date>2024-03-08T12:27:04Z</dc:date>
    </item>
    <item>
      <title>Re: CAN-FD support MPC5748G</title>
      <link>https://community.nxp.com/t5/MPC5xxx/CAN-FD-support-MPC5748G/m-p/1826111#M25038</link>
      <description>&lt;P&gt;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/52961"&gt;@PetrS&lt;/a&gt;&amp;nbsp; Thank you, this was the problem.&lt;/P&gt;&lt;P&gt;Interrupt is activated for the receive function, and disable for the transmission.&amp;nbsp;&lt;/P&gt;&lt;P&gt;i can receive CAN-FD frames via ISR. but when i want to send them the program get stucked in function&amp;nbsp;&lt;SPAN&gt;TransmitMsgFD ,&amp;nbsp; in line : while (fpDevice-&amp;gt;IFLAG1.B.BUF0I != 1) {};:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;void FlexCANDevice::TransmitMsgFD(uint8_t ext, uint32_t ID, uint8_t length, uint8_t* data)
{
	uint8_t	i,dlc,z=0;               
	uint32_t *pTxMB = (uint32_t *)&amp;amp;(fpDevice-&amp;gt;MB[0].CS.R);
	uint32_t txID;

	if (ext==0) txID = ID&amp;lt;&amp;lt;18;
	else txID = ID;

	/*calculate dlc value from no. bytes*/
	dlc = length &amp;lt; 0x09 ? length : 
		  length &amp;lt; 0x0D ? 0x9 : 
		  length &amp;lt; 0x11 ? 0xA : 
		  length &amp;lt; 0x15 ? 0xB : 
		  length &amp;lt; 0x19 ? 0xC : 
		  length &amp;lt; 0x21 ? 0xD : 
		  length &amp;lt; 0x31 ? 0xE : 0xF;

	

	*(pTxMB + 1) = txID;	// write ID

	for (i=0; i&amp;lt;length/4; i++,z+=4) {
		*(pTxMB + 2 + i) =  z&amp;lt;&amp;lt;24 | (z+1)&amp;lt;&amp;lt;16 | (z+2)&amp;lt;&amp;lt; 8 | z+3;      /* Data to be transmitted */
	}

	*pTxMB = ( 0	// Tx Buffer 0 T0 word
			| 1&amp;lt;&amp;lt;31	// extended Data Length
			| 1&amp;lt;&amp;lt;30	// bit rate switch
			| 0xC&amp;lt;&amp;lt;24	// code = 0xC, TX once
			| 1&amp;lt;&amp;lt;22	// SRR = 1
			| ext&amp;lt;&amp;lt;21	// IDE 
			| 0&amp;lt;&amp;lt;20	// RTR = 0
			| dlc&amp;lt;&amp;lt;16);  // DLC 

	while (fpDevice-&amp;gt;IFLAG1.B.BUF0I != 1) {};  /***** Program get stuck here *******/
	fpDevice-&amp;gt;IFLAG1.R = 1;	// clear MB0 flag

}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CAN1 is set to send and receive data, the MB0 for sending, and MB1 for receiving. from the debuger view i can see that data are available in MB0 but i dont understand why they were not processed&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Kazarian_0-1710240789903.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/267810i6E678091E09DB879/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Kazarian_0-1710240789903.png" alt="Kazarian_0-1710240789903.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Kazarian_0-1710240789903.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;any though why this could happen ?&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2024 10:56:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/CAN-FD-support-MPC5748G/m-p/1826111#M25038</guid>
      <dc:creator>Kazarian</dc:creator>
      <dc:date>2024-03-12T10:56:10Z</dc:date>
    </item>
    <item>
      <title>Re: CAN-FD support MPC5748G</title>
      <link>https://community.nxp.com/t5/MPC5xxx/CAN-FD-support-MPC5748G/m-p/1826117#M25040</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;seems message is not transmitted successfully without error, so flag is no set. Check bus lines and ECR/ESR1 registers.&lt;/P&gt;
&lt;P&gt;BR, Petr&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2024 10:58:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/CAN-FD-support-MPC5748G/m-p/1826117#M25040</guid>
      <dc:creator>PetrS</dc:creator>
      <dc:date>2024-03-12T10:58:57Z</dc:date>
    </item>
    <item>
      <title>Re: CAN-FD support MPC5748G</title>
      <link>https://community.nxp.com/t5/MPC5xxx/CAN-FD-support-MPC5748G/m-p/1826135#M25041</link>
      <description>&lt;P&gt;Content of ECR and ESR1 registers are :&lt;/P&gt;&lt;P&gt;Please note that transmission is done via a task and not an interrupt (queued and later processed).&lt;/P&gt;&lt;P&gt;reception in the other hand is handled via an ISR.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Kazarian_0-1710242771729.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/267818iA783240E70168CDC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Kazarian_0-1710242771729.png" alt="Kazarian_0-1710242771729.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Kazarian_0-1710242771729.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thank you !&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2024 11:27:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/CAN-FD-support-MPC5748G/m-p/1826135#M25041</guid>
      <dc:creator>Kazarian</dc:creator>
      <dc:date>2024-03-12T11:27:48Z</dc:date>
    </item>
    <item>
      <title>Re: CAN-FD support MPC5748G</title>
      <link>https://community.nxp.com/t5/MPC5xxx/CAN-FD-support-MPC5748G/m-p/1826159#M25042</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;mode of flag handling does not matter here. You got bit error and it is going to bus off, recover and again the same. Could be due to transceiver issue, wrong bit timing used, TDC setting if used. Check that.&lt;BR /&gt;You can try sending without BRS set.&lt;/P&gt;
&lt;P&gt;BR, Petr&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2024 11:59:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/CAN-FD-support-MPC5748G/m-p/1826159#M25042</guid>
      <dc:creator>PetrS</dc:creator>
      <dc:date>2024-03-12T11:59:13Z</dc:date>
    </item>
    <item>
      <title>Re: CAN-FD support MPC5748G</title>
      <link>https://community.nxp.com/t5/MPC5xxx/CAN-FD-support-MPC5748G/m-p/1827074#M25053</link>
      <description>&lt;P&gt;Thanks a lot&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/52961"&gt;@PetrS&lt;/a&gt;&amp;nbsp;for your support.&lt;/P&gt;&lt;P&gt;By disabling the BSR i could receive data.&lt;/P&gt;&lt;P&gt;There is a problem though. the application should only Echo "once" the same received frame, but it keep transmiting frames without stop , event though i make sure to clear the receive interrupt once the transmission is completed (fpDevice-&amp;gt;IFLAG1.R = 0xffffffff;) .&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Kazarian_0-1710323880654.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/268077iB735C54E2F4E776E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Kazarian_0-1710323880654.png" alt="Kazarian_0-1710323880654.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Kazarian_0-1710323880654.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;uint8_t start()
{
	// Clear interrupt flags
	fpDevice-&amp;gt;IFLAG1.R = 0xffffffff;
	fpDevice-&amp;gt;IFLAG2.R = 0xffffffff;

	// Disable transmit interrupt on MB0
	fpDevice-&amp;gt;IMASK2.B.BUFHM = 0;  // Disable transmit interrupt on MB0

	// Enable receive interrupt on MB1
	fpDevice-&amp;gt;IMASK1.B.BUFLM |= 0x00000002;  // Enable receive interrupt on MB1
	
	// Leave freeze mode
	fpDevice-&amp;gt;MCR.B.HALT = 0;
	fpDevice-&amp;gt;MCR.B.FRZ = 0;

	return CAN_ERR_OK;
}

uint8_t receiveISR(const uint8_t* filterMap)
{
		
	uint32_t  dummy,dlc,id;
	uint8_t   *pRxMB;
	uint32_t  RxCODE;              /* Received message buffer code */
	uint32_t  RxID;                /* Received message ID */
	uint32_t  RxLENGTH;            /* Recieved message number of data bytes */
	uint8_t   RxDATA[64];          /* Received message data string*/
	uint32_t  RxTIMESTAMP;         /* Received message time */

	bufIdx = 1;  				   /* MB1 for receiving frames */
	
	/* Read CODE, ID, LENGTH, DATA, TIMESTAMP*/	
	id 		 = fpDevice-&amp;gt;MB[bufIdx].CS.B.IDE;
	RxCODE   = fpDevice-&amp;gt;MB[bufIdx].CS.B.CODE; 
	RxID     = fpDevice-&amp;gt;MB[bufIdx].ID.B.ID_STD;
	dlc 	 = fpDevice-&amp;gt;MB[bufIdx].CS.B.DLC;
	pRxMB    = (uint8_t *)&amp;amp;fpDevice-&amp;gt;MB[bufIdx].DATA.B[0];
	RxTIMESTAMP = fpDevice-&amp;gt;MB[bufIdx].CS.B.TIMESTAMP; 
	
	/*calculate no. bytes from dlc value*/
	RxLENGTH = (dlc &amp;lt;= &lt;LI-EMOJI id="lia_smiling-face-with-sunglasses" title=":smiling_face_with_sunglasses:"&gt;&lt;/LI-EMOJI&gt; ? dlc : (dlc == 0x9 ? 12 : (dlc == 0xA ? 16 : (dlc == 0xB ? 20 : (dlc == 0xC ? 24 : (dlc == 0xD ? 32 : (dlc == 0xE ? 48 : 64))))));
	
	for (uint8_t j=0; j&amp;lt;RxLENGTH; j++) { 
		RxDATA[j] = *pRxMB++ ;
	}
	
	// Echo back the Received message
	TransmitMsgFD(id, RxID, RxLENGTH,  RxDATA);  
	
	// Unlock and clear buffer
	dummy = fpDevice-&amp;gt;TIMER.R;             /* Read TIMER to unlock message buffers */   
	fpDevice-&amp;gt;IFLAG1.R = 0xffffffff;       /* Clear MB 1 flag */ 			
	return 0;
		
}

void TransmitMsgFD(uint8_t ext, uint32_t ID, uint8_t length, uint8_t* data)
{
	uint8_t	i,dlc,tx_BuffIdx = 0;   /* MB0 for sending frames */             
	uint32_t *pTxMB = (uint32_t *)&amp;amp;(fpDevice-&amp;gt;MB[tx_BuffIdx].CS.R);
	uint32_t txID;

	if (ext==0) txID = ID&amp;lt;&amp;lt;18;
	else txID = ID;

	/*calculate dlc value from no. bytes*/
	dlc = length &amp;lt; 0x09 ? length :  length &amp;lt; 0x0D ? 0x9 :  length &amp;lt; 0x11 ? 0xA :  length &amp;lt; 0x15 ? 0xB :  length &amp;lt; 0x19 ? 0xC : length &amp;lt; 0x21 ? 0xD :   length &amp;lt; 0x31 ? 0xE : 0xF;

	
	// write ID
	*(pTxMB + 1) = txID;	

	/* Data to be transmitted */
	for (i = 0; i &amp;lt; length / 4; i++) {
		*(pTxMB + 2 + i) = data[i*4] &amp;lt;&amp;lt; 24 | data[i*4 + 1] &amp;lt;&amp;lt; 16 | data[i*4 + 2] &amp;lt;&amp;lt; 8 | data[i*4 + 3];
	}


	*pTxMB = ( tx_BuffIdx	// Tx Buffer 0 T0 word
			| 1&amp;lt;&amp;lt;31	// extended Data Length
			//| 1&amp;lt;&amp;lt;30	// bit rate switch
			| 0xC&amp;lt;&amp;lt;24	// code = 0xC, TX once
			| 1&amp;lt;&amp;lt;22	// SRR = 1
			| ext&amp;lt;&amp;lt;21	// IDE 
			| 0&amp;lt;&amp;lt;20	// RTR = 0
			| dlc&amp;lt;&amp;lt;16);  // DLC 

	while (fpDevice-&amp;gt;IFLAG1.B.BUF0I != 1) {};  
	fpDevice-&amp;gt;IFLAG1.R = 1;	// clear MB0 flag
}&lt;/LI-CODE&gt;&lt;P&gt;Any though why this is happening ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2024 10:19:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/CAN-FD-support-MPC5748G/m-p/1827074#M25053</guid>
      <dc:creator>Kazarian</dc:creator>
      <dc:date>2024-03-13T10:19:13Z</dc:date>
    </item>
    <item>
      <title>Re: CAN-FD support MPC5748G</title>
      <link>https://community.nxp.com/t5/MPC5xxx/CAN-FD-support-MPC5748G/m-p/1827179#M25055</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;disable self reception MCR[SRXDIS]=1. If you have enabled it still and sending ID matches received one, it will go to RX ISR again and again.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And do not use&amp;nbsp;&lt;SPAN&gt;fpDevice-&amp;gt;IFLAG1.R = 0xffffffff for clearing single MB flag. Write just the one you want to clear.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;BR, Petr&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2024 12:34:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/CAN-FD-support-MPC5748G/m-p/1827179#M25055</guid>
      <dc:creator>PetrS</dc:creator>
      <dc:date>2024-03-13T12:34:28Z</dc:date>
    </item>
    <item>
      <title>Re: CAN-FD support MPC5748G</title>
      <link>https://community.nxp.com/t5/MPC5xxx/CAN-FD-support-MPC5748G/m-p/1827225#M25059</link>
      <description>&lt;P&gt;Thanks a lot&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/52961"&gt;@PetrS&lt;/a&gt;&amp;nbsp;this works for me now &lt;LI-EMOJI id="lia_slightly-smiling-face" title=":slightly_smiling_face:"&gt;&lt;/LI-EMOJI&gt;&lt;/P&gt;&lt;P&gt;i will try to setup the register to support data up to 64 bytes.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2024 14:05:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/CAN-FD-support-MPC5748G/m-p/1827225#M25059</guid>
      <dc:creator>Kazarian</dc:creator>
      <dc:date>2024-03-13T14:05:31Z</dc:date>
    </item>
    <item>
      <title>Re: CAN-FD support MPC5748G</title>
      <link>https://community.nxp.com/t5/MPC5xxx/CAN-FD-support-MPC5748G/m-p/1840119#M25203</link>
      <description>&lt;P&gt;I want to use 14 MBs of payload=64, if i use 7-&amp;gt;13 MBs , i can't send&amp;nbsp; successfully.My key configuration is as follows:&lt;/P&gt;&lt;P&gt;CAN_0.MCR ---&amp;gt; &amp;nbsp; MAXMB= 0x0000000D; //14 MBS,&amp;nbsp; 0xD+1&lt;/P&gt;&lt;P&gt;CAN_0.FDCTRL ----&amp;gt; MBDSR1 = 11,&amp;nbsp; MBDSR0 = 11&lt;/P&gt;&lt;P&gt;Are there any additional places that need to be configured???&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2024 09:30:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/CAN-FD-support-MPC5748G/m-p/1840119#M25203</guid>
      <dc:creator>xiha</dc:creator>
      <dc:date>2024-04-03T09:30:42Z</dc:date>
    </item>
    <item>
      <title>Re: CAN-FD support MPC5748G</title>
      <link>https://community.nxp.com/t5/MPC5xxx/CAN-FD-support-MPC5748G/m-p/1840509#M25211</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;as I wrote, be sure right&amp;nbsp;MB offset&amp;nbsp;is used.&lt;/P&gt;
&lt;P&gt;BR, Petr&lt;/P&gt;</description>
      <pubDate>Thu, 04 Apr 2024 08:45:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/CAN-FD-support-MPC5748G/m-p/1840509#M25211</guid>
      <dc:creator>PetrS</dc:creator>
      <dc:date>2024-04-04T08:45:50Z</dc:date>
    </item>
    <item>
      <title>Re: CAN-FD support MPC5748G</title>
      <link>https://community.nxp.com/t5/MPC5xxx/CAN-FD-support-MPC5748G/m-p/1841043#M25222</link>
      <description>&lt;P&gt;Ok,I will check it.Thanks for you,Best PetrS&lt;/P&gt;</description>
      <pubDate>Fri, 05 Apr 2024 02:39:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/CAN-FD-support-MPC5748G/m-p/1841043#M25222</guid>
      <dc:creator>xiha</dc:creator>
      <dc:date>2024-04-05T02:39:58Z</dc:date>
    </item>
    <item>
      <title>Re: CAN-FD support MPC5748G</title>
      <link>https://community.nxp.com/t5/MPC5xxx/CAN-FD-support-MPC5748G/m-p/1841045#M25223</link>
      <description>&lt;P class=""&gt;It's off by 8 bytes.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;MB7-MB6 = 80&lt;/LI&gt;&lt;LI&gt;MB6-MB5 = 72,&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;That's why i failed.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Apr 2024 02:44:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/CAN-FD-support-MPC5748G/m-p/1841045#M25223</guid>
      <dc:creator>xiha</dc:creator>
      <dc:date>2024-04-05T02:44:53Z</dc:date>
    </item>
  </channel>
</rss>

