CAN Sample point (for Arbitration phase)

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

CAN Sample point (for Arbitration phase)

2,081 Views
jaewoosong
Contributor III

I develope ECU related CAN FD.

CAN sample point is not set as below in processor expert.

<Setting parameter of processor expert>

1) Enable FD : Yes

2) PE clock source : Sys clock

3) Operation Mode : Normal mode

4) Payload Size : 16

5) Module clodk : 80Mhz

6) PE clock : 80Mhz

* Arbitraion phase *

- Propagation segment : 47

- Phase segment 1 : 14

- Phase segment 2 : 15

- Prescaler Division Factor : 1

- Resync jump width : 16

Qes) By S32K144 Reference Manual(page 1659), Arbitration phase condition of CAN FD 

         (using CAN_CBT) is as below. Why my setting(Phase segment 1, Phase segment 2, Resync jump width) 

         can not be generated code in processor expert ? 

       1) Condition of Time Segment 1 : 2 <= x <= 96

-> My setting : Propagation segment(47) + Phase segment 1(14) + 2,  all sum is 63, condition(2<= x <=96) is meet   

2) Condition of Time Segment 1 : 2 <= x <= 32

-> My setting : Phase segment 2(15) + 1, all sum is 16, condition(2<= x <= 32) is meet

 

Remark) My target Arbitration of CAN FD setting is as below

1) Target CAN speed : 500k bps

2) PE Clock : 80MHz

3) Baud rate prescaler : 2

4) TQ : 80 TQ

5) TSEG1 : 63 TQ

6) TSEG2 : 16 TQ

7) Sample point : 80%

8) SJW : 16

Thank you.

Labels (1)
4 Replies

1,515 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

Seems the PE’s FlexCAN component checks the given values against CTRL1 register even if the FD is enabled and CBT should be used.

You can use below functions in your code to set desired bitrate for both the arbitration and data phase:

FLEXCAN_HAL_SetTimeSegments(base, &bitrate);  // set arbitration bitrate

FLEXCAN_HAL_SetTimeSegmentsCbt(base, &bitrate);  // set data bitrate

BR, Petr

1,516 Views
jaewoosong
Contributor III

Hi Petr

Thank you for your response.

Still CAN bit rate values can not be modified in processor expert.

So I change generated code(canCom1.c file) as below. And then working well without Error frame.

But I hope that can modify this point in processor expert. Because below code is return to generated code

when generating code in processor expert.

flexcan_user_config_t canCom1_InitConfig0 = {  

   ...
    .bitrate = {
#if 0
        .propSeg = 7,
        .phaseSeg1 = 6,
        .phaseSeg2 = 3,
        .preDivider = 7,
        .rJumpwidth = 1
#endif


/* for Extended bit rate for CAN FD */
#if 1
  .propSeg = 47,
  .phaseSeg1 = 14,
  .phaseSeg2 = 15,
  .preDivider = 1,
  .rJumpwidth = 16
#endif
    }

   ...
};

0 Kudos

1,516 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi Jaewoo,

You should not modify modules generated by PE. Your changes can be rewritten back by PE once code is generated again.

That’s why it is advisable to use above mentioned functions.

Or if “canCom1_InitConfig0” structure is not defined as const (read only options deselected in the component setting) then you can modify “bitrate” parameters before FLEXCAN_DRV_Init() is called. 

BR, Petr

0 Kudos

1,516 Views
jaewoosong
Contributor III

Thank you for your response

0 Kudos