s32k144 flexcan init cannot enter interrupt MB

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

s32k144 flexcan init cannot enter interrupt MB

Jump to solution
327 Views
yyyyym
Contributor I

Hi,

I have encountered a problem when using platform: used:S32SDK_S32K1xx_RTM_3.0.0 for can init.

1、Testing procedure:

Use the CAN tool to send a single frame, and then power on the machine to perform CAN initialization. Under normal circumstances, the machine should first send an ACK message and then enter the receive processing interrupt function. But when the problem occurred, it was found that only ACK was returned, but the  IFLAG1  register  corresponding to MB was not triggered, so the receiving interrupt was not triggered.

2、Current code initialization timing:

1)  FLEXCAN_DRV_Init();
2) FLEXCAN_DRV_ConfigRxMb();
3) FLEXCAN_DRV_SetRxIndividualMask();
4) FLEXCAN_DRV_Receive();
5) FLEXCAN_DRV_SetRxMaskType();
 
     I found that when FlexCAN_DRV_init is called, it has the ability to respond with an ACK(while exit freeze mode), but at this time, RXMB may not have been initialized properly, so the data was missed ,cannot trigger interrupt.
    Found CAN initialization sequence in the chip manual, it should exit freeze mode only after all the required configurations have been fully configured, but In the current code,while executing  FlexCAN_DRV_init, it enter and then exit freeze mode even though MB and Rx Individual Mask Registers  has not been initialized at this time.
    I don't know why the initialization sequence code is not completely consistent with what is described in the chip manual,but I modified the exit time from freeze mode for verification and found that the issue has been improved(not exiting freeze mode in FLEXCAN_DRV_init until executing several functions as described above 1~5).
   I'm not sure if this is the root cause of the problem,Perhaps you have encountered similar problems before, or do you have any suggestions or solutions.
 

Please guide me with this.

 

Thank you.

Regards,

 
 
FLEXCAN_DRV_Init()
      .
      .
      .
    /* Select mode */
    FLEXCAN_SetOperationMode(base, data->flexcanMode);

    if (data->flexcanMode != FLEXCAN_FREEZE_MODE)
    {
        FLEXCAN_ExitFreezeMode(base);
    }

    /* Enable FlexCAN interrupts.*/
    FLEXCAN_EnableIRQs(instance);

...

}

yyyyym_0-1755762097387.png

 

0 Kudos
Reply
1 Solution
302 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

yes, this behavior is possible if Normal mode is selected in configuration. Then after Init is called, module enters Normal mode and will ACK incoming messages.
But you can select Freeze mode as operation mode in configuration. This way module stays in Freeze mode upon Init calling. Finally call FLEXCAN_ExitFreezeMode after all MBs, masks, etc init is done.

BR, Petr

View solution in original post

0 Kudos
Reply
1 Reply
303 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

yes, this behavior is possible if Normal mode is selected in configuration. Then after Init is called, module enters Normal mode and will ACK incoming messages.
But you can select Freeze mode as operation mode in configuration. This way module stays in Freeze mode upon Init calling. Finally call FLEXCAN_ExitFreezeMode after all MBs, masks, etc init is done.

BR, Petr

0 Kudos
Reply