KW38 CAN-FD 64bytes

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

KW38 CAN-FD 64bytes

Jump to solution
1,277 Views
Adam_Ho
Contributor II

Hi, 

I am using sample project "frdmkw38_flexcan_interrupt_transfer" to try CAN-FD.

If I want to send 64 bytes data through, I set "DLC" as 15.

In loopback mode, I send 64 bytes data, but I only receive 16 bytes.

Is there any configuration I miss?

Thanks.

Labels (1)
Tags (1)
0 Kudos
Reply
1 Solution
1,071 Views
Christine_Li
NXP TechSupport
NXP TechSupport

Hi, @Adam_Ho 

#define RX_MESSAGE_BUFFER_NUM (6)
#define TX_MESSAGE_BUFFER_NUM (5)

If use kFLEXCAN_64BperMB, the Maximum MBs is 7.

So the "RX_MESSAGE_BUFFER_NUM" and "TX_MESSAGE_BUFFER_NUM"  should less than 7. Pleas set "RX_MESSAGE_BUFFER_NUM" to 6, and "TX_MESSAGE_BUFFER_NUM" to 5, then the system would work normally.

I tested it on my side, it is ok. Please try it on your side and let me know your results.

Best regards,

Christine.

View solution in original post

Tags (1)
0 Kudos
Reply
12 Replies
1,257 Views
Christine_Li
NXP TechSupport
NXP TechSupport

Hi, @Adam_Ho 

Thanks for creating case to us and hope you are doing well.

I checked our SDK code, and may I ask whether you only modified DLC from 10 to 15 or also changed DWORD_IN_MB and BYTES_IN_MB?

For your information:

Dword in each message buffer, Length of data in bytes, Payload size must align,

and the Message Buffers are limited corresponding to each payload configuration.

 

So please also modified DWORD_IN_MB and BYTES_IN_MB to the one related to DLC to have a try.

 

Best regards,

Christine.

Tags (1)
0 Kudos
Reply
1,246 Views
Adam_Ho
Contributor II

Hi @Christine_Li ,

I modify the parameters to fit "kFLEXCAN_64BperMB", but seems not work.

If I use "kFLEXCAN_32BperMB", it is work.

Please give me more hint. 

Thanks.

Adam_Ho_0-1715164197494.png

Adam_Ho_1-1715164218949.png

 

0 Kudos
Reply
1,217 Views
Christine_Li
NXP TechSupport
NXP TechSupport

Hi, @Adam_Ho 

Thanks for your feedback.

I checked your current settings, and also checked our Reference Manual.

In reception, this DLC field is written by the FlexCAN module, copied from the DLC (Data Length Code) field of the received frame.
In transmission, this DLC field is written by the CPU and corresponds to the DLC field value of the frame to be transmitted.

I think it should be matched with below:

 *    DWORD_IN_MB    DLC    BYTES_IN_MB             Maximum MBs
 *    2              8      kFLEXCAN_8BperMB        32
 *    4              10     kFLEXCAN_16BperMB       21
 *    8              13     kFLEXCAN_32BperMB       12
 *    16             15     kFLEXCAN_64BperMB       7

 

May I ask whether it can work well with below? It only has problem when you use in 64Byte, am I right?

Or you didn't tried 8Bytes and 32Bytes?

 

 *    DWORD_IN_MB    DLC    BYTES_IN_MB             Maximum MBs
 *    2              8      kFLEXCAN_8BperMB        32
 *    8              13     kFLEXCAN_32BperMB       12

 

How about disable loop back mode?

Best regards,

Christine.

 

Tags (1)
0 Kudos
Reply
1,208 Views
Adam_Ho
Contributor II

Hi @Christine_Li ,

I check all the parameter in Table. and the result is in below.

Yes, It's only have problem in 64Byte.

I think the problem is on Rx buffer size, maybe this is the clue to find out the result.

I attach the source code for loopback mode, and comment the place I configurate.

You can find the place by //TODO: adam_test 

 loopback enableloopback disable
kFLEXCAN_8BperMBPassPass
kFLEXCAN_16BperMBPassPass
kFLEXCAN_32BperMBPassPass
kFLEXCAN_64BperMBFailFail
0 Kudos
Reply
1,193 Views
Christine_Li
NXP TechSupport
NXP TechSupport

Hi, @Adam_Ho 

Did you connect 12V power supply on J32 of the two boards?

I checked the Readme, it mentioned this point.

And also I am trying on my local side to repro this issue.

 

Best regards,

Christine.

 

Tags (1)
0 Kudos
Reply
1,189 Views
Adam_Ho
Contributor II

Hi @Christine_Li ,

Yes, I am using 12V as power voltage.

Thanks.

 

Best Regards, 

Adam

0 Kudos
Reply
1,171 Views
Christine_Li
NXP TechSupport
NXP TechSupport

Hi, @Adam_Ho 

Thanks for your reply.

Just to confirm with you, after you change all parameters related to 64Bytes, then the board doesn't have any response, am I right?

I am trying to reproduce your issue, and above is what I saw on my two boards(one as TX, one as RX).

But when I changed back to 32Bytes related parameters, it can work properly.

Error phenomenon is like below:

Christine_Li_1-1715336105257.png

Is is same as your side?

 

Best regards,

Christine.

 

Tags (1)
0 Kudos
Reply
1,167 Views
Adam_Ho
Contributor II

Hi @Christine_Li ,

Yes, you reproduce  my issue.

I think Rx buffer size is wrong, so system in 64Bytes parameter when rx data  coming system go to wrong address.

Then system halt.

 

0 Kudos
Reply
1,161 Views
Christine_Li
NXP TechSupport
NXP TechSupport

Hi, @Adam_Ho 

Thanks for your quick reply.

I can't agree with you more.

I will create an internal case to track further.

Once receive any response from our internal team, I will share with you.

Thanks again for creating such an important issue to us, it give a great chance to make us better.

Have a nice weekend!

 

Best regards,

Christine.

Tags (1)
0 Kudos
Reply
1,156 Views
Adam_Ho
Contributor II

Hi @Christine_Li m 

Thank for you kindly support.

When this issue have further step, please let me know.

Best Regards, 

Adam

0 Kudos
Reply
1,072 Views
Christine_Li
NXP TechSupport
NXP TechSupport

Hi, @Adam_Ho 

#define RX_MESSAGE_BUFFER_NUM (6)
#define TX_MESSAGE_BUFFER_NUM (5)

If use kFLEXCAN_64BperMB, the Maximum MBs is 7.

So the "RX_MESSAGE_BUFFER_NUM" and "TX_MESSAGE_BUFFER_NUM"  should less than 7. Pleas set "RX_MESSAGE_BUFFER_NUM" to 6, and "TX_MESSAGE_BUFFER_NUM" to 5, then the system would work normally.

I tested it on my side, it is ok. Please try it on your side and let me know your results.

Best regards,

Christine.

Tags (1)
0 Kudos
Reply
1,063 Views
Adam_Ho
Contributor II

@Christine_Li 

Thanks, 

It's work.

 

Best  Regards, 

Adam

0 Kudos
Reply