S32K116 cannot recevied CAN-FD data

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

S32K116 cannot recevied CAN-FD data

4,207 次查看
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.

 

 

 

标记 (1)
0 项奖励
回复
9 回复数

4,189 次查看
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 项奖励
回复

4,111 次查看
mumumilmil
Contributor II
Hi @PetrS, Do you have s32k116 48MHz CANFD Project from Example?
0 项奖励
回复

4,097 次查看
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 项奖励
回复

4,058 次查看
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 项奖励
回复

4,049 次查看
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 项奖励
回复

3,957 次查看
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 项奖励
回复

3,953 次查看
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 项奖励
回复

3,979 次查看
mumumilmil
Contributor II

can0->ctrl2 |= Can_ctrl2_isocanfden_mask

can->mcr = 0x000008FF

 

same to cookbook

0 项奖励
回复

4,142 次查看
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 项奖励
回复