S32K144 FlexCAN0 FD Mode

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S32K144 FlexCAN0 FD Mode

Jump to solution
4,176 Views
Prashanth1
Contributor II

Hi NXP Community,

I'm currently working on enabling CAN FD (no BRS) reception using FlexCAN0 on S32K144. I have successfully configured Classic CAN for both standard and extended IDs, and it works as expected.

However, when switching to CAN FD with BRS = 0, I am unable to receive messages for extended IDs 0x7E0 and 0x7DF. Here's a summary of what I’ve done:


Configuration Details:

  • FD Mode Enabled (CTRL2.ISOCANFDEN = 1)

  • BRS Disabled via frame format, but FDCTRL.FDRATE = 1 (still OK per spec)

  • Message Buffers 4 and 5 configured to receive extended IDs 0x7E0 and 0x7DF

  • Bit Timing (Nominal = 500 kbps, Data = 2 Mbps)

  • CBT & FDCBT used for CAN FD mode (via FD features)


What Works:

  • Classic CAN Rx/Tx works for both IDs.


Issue:

When trying to receive CAN FD frames with BRS = 0, no interrupt or flag is triggered, and nothing is received in MB4/MB5.


Code :

void FLEXCAN0_init(void)
{
#define MSG_BUF_SIZE 18 /* Msg Buffer Size: 2 header + 2 data = 4 words */
uint32_t i = 0;

/* Enable clock to FlexCAN0 */
PCC->PCCn[PCC_FlexCAN0_INDEX] |= PCC_PCCn_CGC_MASK;

/* Enable FD support and allow configuration via CBT */
CAN0->MCR |= CAN_MCR_MDIS_MASK; // Disable module
CAN0->CTRL1 &= ~CAN_CTRL1_CLKSRC_MASK; // CLKsrc=0: Clock Source = SOSCDIV2 (8 MHz)
CAN0->MCR &= ~CAN_MCR_MDIS_MASK; // Enable module (enter Freeze mode)

while (!((CAN0->MCR & CAN_MCR_FRZACK_MASK) >> CAN_MCR_FRZACK_SHIFT)) {}

/* Configure nominal phase: 500 kbps */
CAN0->CBT = CAN_CBT_EPSEG2(12) // EPSEG2 = 12
| CAN_CBT_EPSEG1(18) // EPSEG1 = 18
| CAN_CBT_EPROPSEG(46) // EPROPSEG = 46
| CAN_CBT_ERJW(12); // ERJW = 12

/* Configure data phase: 2 Mbps */
CAN0->FDCBT = CAN_CBT_EPSEG2(3) // FPSEG2 = 3
| CAN_CBT_EPSEG1(7) // FPSEG1 = 7
| CAN_CBT_EPROPSEG(7) // FPROPSEG = 7
| CAN_CBT_ERJW(3); // FRJW = 3

/* Enable FD mode with TDC, 64-byte payload, BRS = 1 */
CAN0->FDCTRL = CAN_FDCTRL_FDRATE_MASK // BRS enabled
| CAN_FDCTRL_MBDSR0(3) // MB payload = 64 bytes
| CAN_FDCTRL_TDCEN_MASK // Transceiver delay compensation
| CAN_FDCTRL_TDCOFF(5); // TDC offset = 5

/* Clear all message buffers */
for (i = 0; i < 128; i++) {
CAN0->RAMn[i] = 0;
}

/* Enable all RXIMR filters */
for (i = 0; i < 16; i++) {
CAN0->RXIMR[i] = 0xFFFFFFFF;
}

CAN0->RXMGMASK = 0x1FFFFFFF;

/* MB4 -> Receive Extended ID 0x7E0 as CAN FD, no BRS */
CAN0->RAMn[4 * MSG_BUF_SIZE + 0] =
(4 << 24) // CODE = 0b0100 (Rx Empty)
| (1 << 21) // IDE = 1 (Extended ID)
| (1 << 20); // EDL = 1 (CAN FD Frame, BRS = 0)

CAN0->RAMn[4 * MSG_BUF_SIZE + 1] = 0x1F800000; // ID = 0x7E0

/* MB5 -> Receive Extended ID 0x7DF as CAN FD, no BRS */
CAN0->RAMn[5 * MSG_BUF_SIZE + 0] =
(4 << 24) // CODE = 0b0100 (Rx Empty)
| (1 << 21) // IDE = 1 (Extended ID)
| (1 << 20); // EDL = 1 (CAN FD Frame, BRS = 0)

CAN0->RAMn[5 * MSG_BUF_SIZE + 1] = 0x1FA00000; // ID = 0x7DF

/* Enable ISO CAN FD CRC support */
CAN0->CTRL2 |= CAN_CTRL2_ISOCANFDEN_MASK;

/* Exit freeze mode */
CAN0->MCR = 0x0000081F;

while ((CAN0->MCR & CAN_MCR_FRZACK_MASK) >> CAN_MCR_FRZACK_SHIFT) {}
while ((CAN0->MCR & CAN_MCR_NOTRDY_MASK) >> CAN_MCR_NOTRDY_SHIFT) {}
}


My Questions:

  1. Is additional configuration required to receive CAN FD frames with BRS = 0?

  2. Are there restrictions in FlexCAN that affect reception of FD frames without bit rate switching?

  3. Does FDCTRL.FDRATE need to be set to 0 when BRS is not used?

  4. How can I debug whether the message is being filtered or discarded?


Tools Used:

  • S32 Design Studio

  • S32K144EVB

  • External CAN tool sending FD frames with BRS = 0


Thanks in advance for your help!

Best regards,
Prashanth Kumar M G

 

Tags (1)
0 Kudos
Reply
1 Solution
4,069 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

thanks for a code, unfortunately I do not have SDK401 installed, so cannot compile a code.
But from code checking I also see the CAN bit timing is wrong. You need to set module to use sys_clk as clock source as with 8MHz crystal you cannot get desired 1M/2M bitrate.
See attached demo, tested on S32K144EVB.
I got right communication with PCAN tool, receiving ext ID0x7e0 FD message with BRS=0 into MB4.

PetrS_0-1753099550983.png

Hope it helps.

BR, Petr

View solution in original post

7 Replies
4,149 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

1) no, it behaves the same way as receiving Normal CAN, Also you need not to set BRS/EDL bits in RX MB. Those are updated upon reception based on message
2) no restriction for receiving
3) FDCTRL.FDRATE affects only message transmission, does not influence reception. 
4) you can only see if message is properly received without error, in that case MB flag is set and MB updated. There is no indication of discard etc. You can inspect error detected (ECR/ESR1 registers)

In your case, most probably the MB ID setting is the cause. if have IDE bit set and 
CAN0->RAMn[4 * MSG_BUF_SIZE + 1] = 0x1F800000; // ID = 0x7E0
Then did you send message with ID=0x1F800000 by CAN tool? Or you sent ext ID = 0x7E0
In that case you need to have
CAN0->RAMn[4 * MSG_BUF_SIZE + 1] = 0x7E0; // ID = 0x7E0

BR, Petr

0 Kudos
Reply
4,113 Views
Prashanth1
Contributor II

Hi @PetrS,

Thank you for your response!

As you suggested, I tried configuring the CAN to receive only 0x7E0 Extended ID frames, but I’m getting a Bus Error when trying to receive FD frames with those settings. (I'm using PEAK CAN for sending CAN FD frames with EXT ID - 0x7E0 with BRS = 0)

I would like to request your help with a more specific configuration. I'm trying to configure FlexCAN0 on the S32K144 to receive CAN FD frames with the following settings:

  • Nominal Bitrate: 1 Mbps

  • Data Bitrate: (Same as nominal, since BRS = 0)

  • FD Mode: Enabled

  • Bit Rate Switching (BRS): Disabled (i.e., BRS = 0)

  • Frame ID to receive: Extended ID 0x7E0

So far, I’ve been successful with Classical CAN using various IDs and baud rates, but I'm having trouble with enabling and validating the FD mode specifically on S32K144.

Could you please provide a step-by-step guide or checklist to:

  1. Enable and configure CAN FD mode on S32K144 (FlexCAN0).

  2. Properly configure the timing and control registers for 1 Mbps nominal bitrate with FD enabled and BRS disabled(FlexCAN0_clk -> 40MHz).

  3. Set up the receive message buffers to accept Extended ID 0x7E0 in FD format.

  4. Verify that the received FD frame is being correctly handled (with or without payload checking).

Thanks in advance for your support!

Best regards,
Prashanth Kumar M G

Tags (1)
0 Kudos
Reply
4,095 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

can you share your simplified project so I can check/test?

BR, Petr

0 Kudos
Reply
4,087 Views
Prashanth1
Contributor II
Hi Sir,
I attached my project .zip file privately
Can you please Check Once
0 Kudos
Reply
4,070 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

thanks for a code, unfortunately I do not have SDK401 installed, so cannot compile a code.
But from code checking I also see the CAN bit timing is wrong. You need to set module to use sys_clk as clock source as with 8MHz crystal you cannot get desired 1M/2M bitrate.
See attached demo, tested on S32K144EVB.
I got right communication with PCAN tool, receiving ext ID0x7e0 FD message with BRS=0 into MB4.

PetrS_0-1753099550983.png

Hope it helps.

BR, Petr

4,065 Views
Prashanth1
Contributor II
Hi Sir,
Thank you very much! Your latest suggestion worked perfectly, and now I'm able to receive CAN FD frames with the desired configuration on the S32K144.

I have a quick follow-up:

Is there any **easiest or recommended way to calculate the CAN/CAN FD bitrates**, especially while choosing the timing segments and prescaler values?
So far, I'm using this formula:

```
Bitrate = CAN_CLK / ((1 + PROPSEG + PSEG1 + PSEG2) * (1 + PREDIV))
```

Is this only formula we should rely on? Also, in the S32K SDK, I noticed that the available FlexCAN configuration APIs (like `FLEXCAN_SetBitrate()`, etc.) **don’t seem to produce valid timing settings**, especially for FD mode. Is there any specific reason behind this or a better way to use those APIs correctly?

Thanks again for your support and guidance!

Best regards,
Prashanth Kumar M G
0 Kudos
Reply
4,040 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

the generic formula is 
Bitrate = CAN_CLK / ((1 + PROPSEG + PSEG1 + PSEG2) * (PREDIV))
where parameters are calculated one, note the value written to register is minus 1, except of propseg for data phase. To ease calculation you can use below tool I did
https://community.nxp.com/t5/MPC5xxx-Knowledge-Base/MPC5xxx-S32Kxx-LPCxxxx-CAN-CAN-FD-bit-timing-cal...

For FlexCAN SDK API; FLEXCAN_DRV_SetBitrate and FLEXCAN_DRV_SetBitrateCbt can be used to set nominal and data bitrates. Functions writes given values to respective registers directly.

BR, Petr

 

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2136396%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ES32K144%20FlexCAN0%20FD%20Mode%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2136396%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20NXP%20Community%2C%3C%2FP%3E%3CP%3EI'm%20currently%20working%20on%20enabling%20%3CSTRONG%3ECAN%20FD%20(no%20BRS)%3C%2FSTRONG%3E%20reception%20using%20%3CSTRONG%3EFlexCAN0%20on%20S32K144%3C%2FSTRONG%3E.%20I%20have%20successfully%20configured%20Classic%20CAN%20for%20both%20standard%20and%20extended%20IDs%2C%20and%20it%20works%20as%20expected.%3C%2FP%3E%3CP%3EHowever%2C%20when%20switching%20to%20%3CSTRONG%3ECAN%20FD%20with%20BRS%20%3D%200%3C%2FSTRONG%3E%2C%20I%20am%20%3CSTRONG%3Eunable%20to%20receive%20messages%3C%2FSTRONG%3E%20for%20extended%20IDs%20%3CSTRONG%3E0x7E0%20and%200x7DF%3C%2FSTRONG%3E.%20Here's%20a%20summary%20of%20what%20I%E2%80%99ve%20done%3A%3C%2FP%3E%3CHR%20%2F%3E%3CH3%20id%3D%22toc-hId-1972005711%22%20id%3D%22toc-hId-2000491614%22%3EConfiguration%20Details%3A%3C%2FH3%3E%3CUL%3E%3CLI%3E%3CP%3E%3CSTRONG%3EFD%20Mode%20Enabled%3C%2FSTRONG%3E%20(CTRL2.ISOCANFDEN%20%3D%201)%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3E%3CSTRONG%3EBRS%20Disabled%3C%2FSTRONG%3E%20via%20frame%20format%2C%20but%20FDCTRL.FDRATE%20%3D%201%20(still%20OK%20per%20spec)%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3E%3CSTRONG%3EMessage%20Buffers%204%20and%205%3C%2FSTRONG%3E%20configured%20to%20receive%20%3CSTRONG%3Eextended%20IDs%3C%2FSTRONG%3E%200x7E0%20and%200x7DF%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3E%3CSTRONG%3EBit%20Timing%3C%2FSTRONG%3E%20(Nominal%20%3D%20500%20kbps%2C%20Data%20%3D%202%20Mbps)%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3E%3CSTRONG%3ECBT%20%26amp%3B%20FDCBT%3C%2FSTRONG%3E%20used%20for%20CAN%20FD%20mode%20(via%20FD%20features)%3C%2FP%3E%3C%2FLI%3E%3C%2FUL%3E%3CHR%20%2F%3E%3CH3%20id%3D%22toc-hId-164551248%22%20id%3D%22toc-hId-193037151%22%3EWhat%20Works%3A%3C%2FH3%3E%3CUL%3E%3CLI%3E%3CP%3EClassic%20CAN%20Rx%2FTx%20works%20for%20both%20IDs.%3C%2FP%3E%3C%2FLI%3E%3C%2FUL%3E%3CHR%20%2F%3E%3CH3%20id%3D%22toc-hId--1642903215%22%20id%3D%22toc-hId--1614417312%22%3EIssue%3A%3C%2FH3%3E%3CP%3EWhen%20trying%20to%20receive%20%3CSTRONG%3ECAN%20FD%20frames%20with%20BRS%20%3D%200%3C%2FSTRONG%3E%2C%20no%20interrupt%20or%20flag%20is%20triggered%2C%20and%20nothing%20is%20received%20in%20MB4%2FMB5.%3C%2FP%3E%3CHR%20%2F%3E%3CH3%20id%3D%22toc-hId-844609618%22%20id%3D%22toc-hId-873095521%22%3ECode%20%3A%3C%2FH3%3E%3CP%3Evoid%20FLEXCAN0_init(void)%3CBR%20%2F%3E%7B%3CBR%20%2F%3E%23define%20MSG_BUF_SIZE%2018%20%2F*%20Msg%20Buffer%20Size%3A%202%20header%20%2B%202%20data%20%3D%204%20words%20*%2F%3CBR%20%2F%3Euint32_t%20i%20%3D%200%3B%3C%2FP%3E%3CP%3E%2F*%20Enable%20clock%20to%20FlexCAN0%20*%2F%3CBR%20%2F%3EPCC-%26gt%3BPCCn%5BPCC_FlexCAN0_INDEX%5D%20%7C%3D%20PCC_PCCn_CGC_MASK%3B%3C%2FP%3E%3CP%3E%2F*%20Enable%20FD%20support%20and%20allow%20configuration%20via%20CBT%20*%2F%3CBR%20%2F%3ECAN0-%26gt%3BMCR%20%7C%3D%20CAN_MCR_MDIS_MASK%3B%20%2F%2F%20Disable%20module%3CBR%20%2F%3ECAN0-%26gt%3BCTRL1%20%26amp%3B%3D%20~CAN_CTRL1_CLKSRC_MASK%3B%20%2F%2F%20CLKsrc%3D0%3A%20Clock%20Source%20%3D%20SOSCDIV2%20(8%20MHz)%3CBR%20%2F%3ECAN0-%26gt%3BMCR%20%26amp%3B%3D%20~CAN_MCR_MDIS_MASK%3B%20%2F%2F%20Enable%20module%20(enter%20Freeze%20mode)%3C%2FP%3E%3CP%3Ewhile%20(!((CAN0-%26gt%3BMCR%20%26amp%3B%20CAN_MCR_FRZACK_MASK)%20%26gt%3B%26gt%3B%20CAN_MCR_FRZACK_SHIFT))%20%7B%7D%3C%2FP%3E%3CP%3E%2F*%20Configure%20nominal%20phase%3A%20500%20kbps%20*%2F%3CBR%20%2F%3ECAN0-%26gt%3BCBT%20%3D%20CAN_CBT_EPSEG2(12)%20%2F%2F%20EPSEG2%20%3D%2012%3CBR%20%2F%3E%7C%20CAN_CBT_EPSEG1(18)%20%2F%2F%20EPSEG1%20%3D%2018%3CBR%20%2F%3E%7C%20CAN_CBT_EPROPSEG(46)%20%2F%2F%20EPROPSEG%20%3D%2046%3CBR%20%2F%3E%7C%20CAN_CBT_ERJW(12)%3B%20%2F%2F%20ERJW%20%3D%2012%3C%2FP%3E%3CP%3E%2F*%20Configure%20data%20phase%3A%202%20Mbps%20*%2F%3CBR%20%2F%3ECAN0-%26gt%3BFDCBT%20%3D%20CAN_CBT_EPSEG2(3)%20%2F%2F%20FPSEG2%20%3D%203%3CBR%20%2F%3E%7C%20CAN_CBT_EPSEG1(7)%20%2F%2F%20FPSEG1%20%3D%207%3CBR%20%2F%3E%7C%20CAN_CBT_EPROPSEG(7)%20%2F%2F%20FPROPSEG%20%3D%207%3CBR%20%2F%3E%7C%20CAN_CBT_ERJW(3)%3B%20%2F%2F%20FRJW%20%3D%203%3C%2FP%3E%3CP%3E%2F*%20Enable%20FD%20mode%20with%20TDC%2C%2064-byte%20payload%2C%20BRS%20%3D%201%20*%2F%3CBR%20%2F%3ECAN0-%26gt%3BFDCTRL%20%3D%20CAN_FDCTRL_FDRATE_MASK%20%2F%2F%20BRS%20enabled%3CBR%20%2F%3E%7C%20CAN_FDCTRL_MBDSR0(3)%20%2F%2F%20MB%20payload%20%3D%2064%20bytes%3CBR%20%2F%3E%7C%20CAN_FDCTRL_TDCEN_MASK%20%2F%2F%20Transceiver%20delay%20compensation%3CBR%20%2F%3E%7C%20CAN_FDCTRL_TDCOFF(5)%3B%20%2F%2F%20TDC%20offset%20%3D%205%3C%2FP%3E%3CP%3E%2F*%20Clear%20all%20message%20buffers%20*%2F%3CBR%20%2F%3Efor%20(i%20%3D%200%3B%20i%20%26lt%3B%20128%3B%20i%2B%2B)%20%7B%3CBR%20%2F%3ECAN0-%26gt%3BRAMn%5Bi%5D%20%3D%200%3B%3CBR%20%2F%3E%7D%3C%2FP%3E%3CP%3E%2F*%20Enable%20all%20RXIMR%20filters%20*%2F%3CBR%20%2F%3Efor%20(i%20%3D%200%3B%20i%20%26lt%3B%2016%3B%20i%2B%2B)%20%7B%3CBR%20%2F%3ECAN0-%26gt%3BRXIMR%5Bi%5D%20%3D%200xFFFFFFFF%3B%3CBR%20%2F%3E%7D%3C%2FP%3E%3CP%3ECAN0-%26gt%3BRXMGMASK%20%3D%200x1FFFFFFF%3B%3C%2FP%3E%3CP%3E%2F*%20MB4%20-%26gt%3B%20Receive%20Extended%20ID%200x7E0%20as%20CAN%20FD%2C%20no%20BRS%20*%2F%3CBR%20%2F%3ECAN0-%26gt%3BRAMn%5B4%20*%20MSG_BUF_SIZE%20%2B%200%5D%20%3D%3CBR%20%2F%3E(4%20%26lt%3B%26lt%3B%2024)%20%2F%2F%20CODE%20%3D%200b0100%20(Rx%20Empty)%3CBR%20%2F%3E%7C%20(1%20%26lt%3B%26lt%3B%2021)%20%2F%2F%20IDE%20%3D%201%20(Extended%20ID)%3CBR%20%2F%3E%7C%20(1%20%26lt%3B%26lt%3B%2020)%3B%20%2F%2F%20EDL%20%3D%201%20(CAN%20FD%20Frame%2C%20BRS%20%3D%200)%3C%2FP%3E%3CP%3ECAN0-%26gt%3BRAMn%5B4%20*%20MSG_BUF_SIZE%20%2B%201%5D%20%3D%200x1F800000%3B%20%2F%2F%20ID%20%3D%200x7E0%3C%2FP%3E%3CP%3E%2F*%20MB5%20-%26gt%3B%20Receive%20Extended%20ID%200x7DF%20as%20CAN%20FD%2C%20no%20BRS%20*%2F%3CBR%20%2F%3ECAN0-%26gt%3BRAMn%5B5%20*%20MSG_BUF_SIZE%20%2B%200%5D%20%3D%3CBR%20%2F%3E(4%20%26lt%3B%26lt%3B%2024)%20%2F%2F%20CODE%20%3D%200b0100%20(Rx%20Empty)%3CBR%20%2F%3E%7C%20(1%20%26lt%3B%26lt%3B%2021)%20%2F%2F%20IDE%20%3D%201%20(Extended%20ID)%3CBR%20%2F%3E%7C%20(1%20%26lt%3B%26lt%3B%2020)%3B%20%2F%2F%20EDL%20%3D%201%20(CAN%20FD%20Frame%2C%20BRS%20%3D%200)%3C%2FP%3E%3CP%3ECAN0-%26gt%3BRAMn%5B5%20*%20MSG_BUF_SIZE%20%2B%201%5D%20%3D%200x1FA00000%3B%20%2F%2F%20ID%20%3D%200x7DF%3C%2FP%3E%3CP%3E%2F*%20Enable%20ISO%20CAN%20FD%20CRC%20support%20*%2F%3CBR%20%2F%3ECAN0-%26gt%3BCTRL2%20%7C%3D%20CAN_CTRL2_ISOCANFDEN_MASK%3B%3C%2FP%3E%3CP%3E%2F*%20Exit%20freeze%20mode%20*%2F%3CBR%20%2F%3ECAN0-%26gt%3BMCR%20%3D%200x0000081F%3B%3C%2FP%3E%3CP%3Ewhile%20((CAN0-%26gt%3BMCR%20%26amp%3B%20CAN_MCR_FRZACK_MASK)%20%26gt%3B%26gt%3B%20CAN_MCR_FRZACK_SHIFT)%20%7B%7D%3CBR%20%2F%3Ewhile%20((CAN0-%26gt%3BMCR%20%26amp%3B%20CAN_MCR_NOTRDY_MASK)%20%26gt%3B%26gt%3B%20CAN_MCR_NOTRDY_SHIFT)%20%7B%7D%3CBR%20%2F%3E%7D%3C%2FP%3E%3CHR%20%2F%3E%3CH3%20id%3D%22toc-hId--962844845%22%20id%3D%22toc-hId--934358942%22%3EMy%20Questions%3A%3C%2FH3%3E%3COL%3E%3CLI%3E%3CP%3EIs%20%3CSTRONG%3Eadditional%20configuration%20required%3C%2FSTRONG%3E%20to%20receive%20%3CSTRONG%3ECAN%20FD%20frames%20with%20BRS%20%3D%200%3C%2FSTRONG%3E%3F%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3EAre%20there%20%3CSTRONG%3Erestrictions%20in%20FlexCAN%3C%2FSTRONG%3E%20that%20affect%20reception%20of%20FD%20frames%20without%20bit%20rate%20switching%3F%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3EDoes%20FDCTRL.FDRATE%20need%20to%20be%20set%20to%200%20when%20BRS%20is%20not%20used%3F%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3EHow%20can%20I%20debug%20whether%20the%20message%20is%20being%20filtered%20or%20discarded%3F%3C%2FP%3E%3C%2FLI%3E%3C%2FOL%3E%3CHR%20%2F%3E%3CH3%20id%3D%22toc-hId-1524667988%22%20id%3D%22toc-hId-1553153891%22%3ETools%20Used%3A%3C%2FH3%3E%3CUL%3E%3CLI%3E%3CP%3ES32%20Design%20Studio%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3ES32K144EVB%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3EExternal%20CAN%20tool%20sending%20FD%20frames%20with%20BRS%20%3D%200%3C%2FP%3E%3C%2FLI%3E%3C%2FUL%3E%3CHR%20%2F%3E%3CP%3EThanks%20in%20advance%20for%20your%20help!%3C%2FP%3E%3CP%3EBest%20regards%2C%3CBR%20%2F%3EPrashanth%20Kumar%20M%20G%3C%2FP%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2137953%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20S32K144%20FlexCAN0%20FD%20Mode%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2137953%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3C%2FP%3E%0A%3CP%3Ethe%20generic%20formula%20is%26nbsp%3B%3CBR%20%2F%3E%3CSPAN%3EBitrate%20%3D%20CAN_CLK%20%2F%20((1%20%2B%20PROPSEG%20%2B%20PSEG1%20%2B%20PSEG2)%20*%20(PREDIV))%3CBR%20%2F%3Ewhere%20parameters%20are%20calculated%20one%2C%20note%20the%20value%20written%20to%20register%20is%20minus%201%2C%20except%20of%20propseg%20for%20data%20phase.%20To%20ease%20calculation%20you%20can%20use%20below%20tool%20I%20did%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2FMPC5xxx-Knowledge-Base%2FMPC5xxx-S32Kxx-LPCxxxx-CAN-CAN-FD-bit-timing-calculation%2Fta-p%2F1119319%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Fcommunity.nxp.com%2Ft5%2FMPC5xxx-Knowledge-Base%2FMPC5xxx-S32Kxx-LPCxxxx-CAN-CAN-FD-bit-timing-calculation%2Fta-p%2F1119319%3C%2FA%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EFor%20FlexCAN%20SDK%20API%3B%26nbsp%3BFLEXCAN_DRV_SetBitrate%20and%26nbsp%3BFLEXCAN_DRV_SetBitrateCbt%20can%20be%20used%20to%20set%20nominal%20and%20data%20bitrates.%20Functions%20writes%20given%20values%20to%20respective%20registers%20directly.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EBR%2C%20Petr%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2137448%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20S32K144%20FlexCAN0%20FD%20Mode%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2137448%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EHi%20Sir%2C%3CBR%20%2F%3EThank%20you%20very%20much!%20Your%20latest%20suggestion%20worked%20perfectly%2C%20and%20now%20I'm%20able%20to%20receive%20CAN%20FD%20frames%20with%20the%20desired%20configuration%20on%20the%20S32K144.%3CBR%20%2F%3E%3CBR%20%2F%3EI%20have%20a%20quick%20follow-up%3A%3CBR%20%2F%3E%3CBR%20%2F%3EIs%20there%20any%20**easiest%20or%20recommended%20way%20to%20calculate%20the%20CAN%2FCAN%20FD%20bitrates**%2C%20especially%20while%20choosing%20the%20timing%20segments%20and%20prescaler%20values%3F%3CBR%20%2F%3ESo%20far%2C%20I'm%20using%20this%20formula%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%60%60%60%3CBR%20%2F%3EBitrate%20%3D%20CAN_CLK%20%2F%20((1%20%2B%20PROPSEG%20%2B%20PSEG1%20%2B%20PSEG2)%20*%20(1%20%2B%20PREDIV))%3CBR%20%2F%3E%60%60%60%3CBR%20%2F%3E%3CBR%20%2F%3EIs%20this%20only%20formula%20we%20should%20rely%20on%3F%20Also%2C%20in%20the%20S32K%20SDK%2C%20I%20noticed%20that%20the%20available%20FlexCAN%20configuration%20APIs%20(like%20%60FLEXCAN_SetBitrate()%60%2C%20etc.)%20**don%E2%80%99t%20seem%20to%20produce%20valid%20timing%20settings**%2C%20especially%20for%20FD%20mode.%20Is%20there%20any%20specific%20reason%20behind%20this%20or%20a%20better%20way%20to%20use%20those%20APIs%20correctly%3F%3CBR%20%2F%3E%3CBR%20%2F%3EThanks%20again%20for%20your%20support%20and%20guidance!%3CBR%20%2F%3E%3CBR%20%2F%3EBest%20regards%2C%3CBR%20%2F%3EPrashanth%20Kumar%20M%20G%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2137429%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20S32K144%20FlexCAN0%20FD%20Mode%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2137429%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3C%2FP%3E%0A%3CP%3Ethanks%20for%20a%20code%2C%20unfortunately%20I%20do%20not%20have%20SDK401%20installed%2C%20so%20cannot%20compile%20a%20code.%3CBR%20%2F%3EBut%20from%20code%20checking%20I%20also%20see%20the%20CAN%20bit%20timing%20is%20wrong.%20You%20need%20to%20set%20module%20to%20use%20sys_clk%20as%20clock%20source%20as%20with%208MHz%20crystal%20you%20cannot%20get%20desired%201M%2F2M%20bitrate.%3CBR%20%2F%3ESee%20attached%20demo%2C%20tested%20on%20S32K144EVB.%3CBR%20%2F%3EI%20got%20right%20communication%20with%20PCAN%20tool%2C%20receiving%20ext%20ID0x7e0%20FD%20message%20with%20BRS%3D0%20into%20MB4.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22PetrS_0-1753099550983.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22PetrS_0-1753099550983.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F348544iDEB95DD526F27B0A%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22PetrS_0-1753099550983.png%22%20alt%3D%22PetrS_0-1753099550983.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EHope%20it%20helps.%3C%2FP%3E%0A%3CP%3EBR%2C%20Petr%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2137367%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20S32K144%20FlexCAN0%20FD%20Mode%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2137367%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EHi%20Sir%2C%3CBR%20%2F%3EI%20attached%20my%20project%20.zip%20file%20privately%3CBR%20%2F%3ECan%20you%20please%20Check%20Once%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2137300%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20S32K144%20FlexCAN0%20FD%20Mode%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2137300%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3C%2FP%3E%0A%3CP%3Ecan%20you%20share%20your%20simplified%20project%20so%20I%20can%20check%2Ftest%3F%3C%2FP%3E%0A%3CP%3EBR%2C%20Petr%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2137229%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20S32K144%20FlexCAN0%20FD%20Mode%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2137229%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F52961%22%20target%3D%22_blank%22%3E%40PetrS%3C%2FA%3E%2C%3C%2FP%3E%3CP%3EThank%20you%20for%20your%20response!%3C%2FP%3E%3CP%3EAs%20you%20suggested%2C%20I%20tried%20configuring%20the%20CAN%20to%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Ereceive%20only%200x7E0%20Extended%20ID%20frames%3C%2FSTRONG%3E%2C%20but%20I%E2%80%99m%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Egetting%20a%20Bus%20Error%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ewhen%20trying%20to%20receive%20FD%20frames%20with%20those%20settings.%20(I'm%20using%20PEAK%20CAN%20for%20sending%20CAN%20FD%20frames%20with%20EXT%20ID%20-%200x7E0%20with%20BRS%20%3D%200)%3C%2FP%3E%3CP%3EI%20would%20like%20to%20request%20your%20help%20with%20a%20more%20specific%20configuration.%20I'm%20trying%20to%20configure%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EFlexCAN0%20on%20the%20S32K144%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eto%20receive%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ECAN%20FD%20frames%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ewith%20the%20following%20settings%3A%3C%2FP%3E%3CUL%3E%3CLI%3E%3CP%3E%3CSTRONG%3ENominal%20Bitrate%3C%2FSTRONG%3E%3A%201%20Mbps%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3E%3CSTRONG%3EData%20Bitrate%3C%2FSTRONG%3E%3A%20(Same%20as%20nominal%2C%20since%20BRS%20%3D%200)%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3E%3CSTRONG%3EFD%20Mode%3C%2FSTRONG%3E%3A%20Enabled%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3E%3CSTRONG%3EBit%20Rate%20Switching%20(BRS)%3C%2FSTRONG%3E%3A%20Disabled%20(i.e.%2C%20BRS%20%3D%200)%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3E%3CSTRONG%3EFrame%20ID%20to%20receive%3C%2FSTRONG%3E%3A%20Extended%20ID%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3E0x7E0%3C%2FSTRONG%3E%3C%2FP%3E%3C%2FLI%3E%3C%2FUL%3E%3CP%3ESo%20far%2C%20I%E2%80%99ve%20been%20successful%20with%20Classical%20CAN%20using%20various%20IDs%20and%20baud%20rates%2C%20but%20I'm%20having%20trouble%20with%20enabling%20and%20validating%20the%20FD%20mode%20specifically%20on%20S32K144.%3C%2FP%3E%3CP%3ECould%20you%20please%20provide%20a%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Estep-by-step%20guide%20or%20checklist%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eto%3A%3C%2FP%3E%3COL%3E%3CLI%3E%3CP%3EEnable%20and%20configure%20CAN%20FD%20mode%20on%20S32K144%20(FlexCAN0).%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3EProperly%20configure%20the%20timing%20and%20control%20registers%20for%201%20Mbps%20nominal%20bitrate%20with%20FD%20enabled%20and%20BRS%20disabled(FlexCAN0_clk%20-%26gt%3B%2040MHz).%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3ESet%20up%20the%20receive%20message%20buffers%20to%20accept%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EExtended%20ID%200x7E0%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ein%20FD%20format.%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3EVerify%20that%20the%20received%20FD%20frame%20is%20being%20correctly%20handled%20(with%20or%20without%20payload%20checking).%3C%2FP%3E%3C%2FLI%3E%3C%2FOL%3E%3CP%3EThanks%20in%20advance%20for%20your%20support!%3C%2FP%3E%3CP%3EBest%20regards%2C%3CBR%20%2F%3EPrashanth%20Kumar%20M%20G%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2136553%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20S32K144%20FlexCAN0%20FD%20Mode%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2136553%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3C%2FP%3E%0A%3CP%3E1)%20no%2C%20it%20behaves%20the%20same%20way%20as%20receiving%20Normal%20CAN%2C%20Also%20you%20need%20not%20to%20set%20BRS%2FEDL%20bits%20in%20RX%20MB.%20Those%20are%20updated%20upon%20reception%20based%20on%20message%3CBR%20%2F%3E2)%20no%20restriction%20for%20receiving%3CBR%20%2F%3E3)%26nbsp%3B%3CSPAN%3EFDCTRL.FDRATE%20affects%20only%20message%20transmission%2C%20does%20not%20influence%20reception.%26nbsp%3B%3CBR%20%2F%3E4)%20you%20can%20only%20see%20if%20message%20is%20properly%20received%20without%20error%2C%20in%20that%20case%20MB%20flag%20is%20set%20and%20MB%20updated.%20There%20is%20no%20indication%20of%20discard%20etc.%20You%20can%20inspect%20error%20detected%20(ECR%2FESR1%20registers)%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EIn%20your%20case%2C%20most%20probably%20the%20MB%20ID%20setting%20is%20the%20cause.%20if%20have%20IDE%20bit%20set%20and%26nbsp%3B%3CBR%20%2F%3ECAN0-%26gt%3BRAMn%5B4%20*%20MSG_BUF_SIZE%20%2B%201%5D%20%3D%200x1F800000%3B%20%2F%2F%20ID%20%3D%200x7E0%3CBR%20%2F%3EThen%20did%20you%20send%20message%20with%20ID%3D0x1F800000%20by%20CAN%20tool%3F%20Or%20you%20sent%20ext%20ID%20%3D%200x7E0%3CBR%20%2F%3EIn%20that%20case%20you%20need%20to%20have%3CBR%20%2F%3ECAN0-%26gt%3BRAMn%5B4%20*%20MSG_BUF_SIZE%20%2B%201%5D%20%3D%200x7E0%3B%20%2F%2F%20ID%20%3D%200x7E0%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EBR%2C%20Petr%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E