S32K116 cannot recevied CAN-FD data

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

S32K116 cannot recevied CAN-FD data

4,241 Views
mumumilmil
Contributor II

I'm trying to use CAN-FD protocol.

 

Main, CAN  Clock : FIRC 48MHz , Buad rates are CBT 500kbit/ FDCBT 2000kbit 

 

HS_CAN has been send  right data and MCU reads that.

HSCAN_TX.png < send HS data from Vector to PCB > 

tek00028.png

tek00026.png < PCB's HS CAN_Rx by 10ms>

 

But, When Vector send FD_CAN, PCB cannot read any data

If I use Vector to send data, first error occured and then send data.

(It seems to send the data normally, but mcu can't read it)

FDCAN_TX.png< send FD data from Vector to PCB >

tek00028.png< PCB's FD CAN_Rx by 10ms>

 

I attached that setting baud rate.  Thank you.

 

 

 

Tags (1)
0 Kudos
Reply
9 Replies

4,223 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

few hints to consider...
- be sure MCU is using same ISO/non-ISO CANFD protocol as CAN tool, check CTRL2[ISOCANFDEN] bit setting 
- it is advisable to not using FIRC as CAN PE clock
- use same prescaler value to arbitration and data phase. For example
CANx_CBT = 0x802932E9; // bitrate=500kbps, CPI clk=48 MHz; Prescaler= 2, PROPSEG=13, PSEG1=24, PSEG2=10, RJW=10, smp=79.16%
CANx_FDCBT = 0x00111841; // bitrateFD=2000kbps, CPI clk=48 MHz; fPrescaler= 2, fPROPSEG=6, fPSEG1=3, fPSEG2=2, fRJW=2, smp=83.33%
- disable TDC, not needed for 2Mbps.
- check error detected on MCU, read module ECR/ESR1 registers

BR, Petr

0 Kudos
Reply

4,145 Views
mumumilmil
Contributor II
Hi @PetrS, Do you have s32k116 48MHz CANFD Project from Example?
0 Kudos
Reply

4,131 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

not sure of nonSDK/RTD example directly for S32K116, but you can refer to Cookbook's one; https://www.nxp.com/docs/en/application-note/AN5413.pdf
There is CANFD demo for other derivatives, just clocking have to be properly set.

In equations if parameters are value written then below have to be used

CBT = 48MHz/ [( 1+ (Epseg1+1) + (Epseg2+1) + (Epropseg+1)) * (Epresdiv+1)] 

FDCBT = 48MHz / [( 1+ (fpseg1+1) + (fpseg2+1) + (fpropseg)) * (fpresdiv+1)] 

BR, Petr 

0 Kudos
Reply

4,092 Views
mumumilmil
Contributor II

1. I put in CAN_Tx(void) in total source. 

[file 1]

But, I wonder that whether CAN_FD or CAN_HS. (set 1 to EDL and BRS)

 

2. I send data to ID:411.

Still occured CAN FD Error. 

[file 2]

Vector Tx (data 00-07 : 11 11 11 11 11 11 11 11) for 10ms

-> trace shows (data 00-07 : 11 11 00 44 55 66 77) 

 

I attached ECR, ESR1 - realtime comments.

[file 3]

 500k : 87.5%, 2M : 75%

 

3. Is it diffrent MBDSR0(payload), Buffer size of S32K144 / S32K116 ?

 

0 Kudos
Reply

4,083 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

what is CTRL2[ISOCANFDEN] bit setting? Is Vector set for the same?
Buffer size is a same for S32K144 / S32K116.

BR, Petr

0 Kudos
Reply

3,991 Views
mumumilmil
Contributor II

@PetrS , I have using FS32K116LIT0VLFT MCU. 

I found out that F32K116LIT0VLFT doesn't offer CAN-FD.

I will change my MCU to FS32K116LAT0MLFT.

 

Thanks for your support. 

0 Kudos
Reply

3,987 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

OK, good point.
Anyway, attached is modified cookbook's code for CAN FD using FIRC as CAN PE clock. Tested on S32K116EVB with PCAN tool.

PetrS_0-1747812380613.pngPetrS_1-1747812394872.png

It is running well.

BR, Petr

0 Kudos
Reply

4,013 Views
mumumilmil
Contributor II

can0->ctrl2 |= Can_ctrl2_isocanfden_mask

can->mcr = 0x000008FF

 

same to cookbook

0 Kudos
Reply

4,176 Views
mumumilmil
Contributor II

I know as, 

CBT = 48MHz/ (( 1+ (Epseg1+1) + (Epseg2+1) + (Epropseg+1)) * Epresdiv)  = 500kbit 


FDCBT = 48MHz / (( 1+ (fpseg1+1) + (fpseg2+1) + (fpropseg)) * Epresdiv)  = 500kbit 

Is it wrong formula? 

If I use your baud rate, it’s diffrent to 500kbit, 2Mbit.

0 Kudos
Reply