[S32K3_MCAL_API] Mcu_SetMode() take up a lot of time

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

[S32K3_MCAL_API] Mcu_SetMode() take up a lot of time

Jump to solution
1,735 Views
wuxianlong
Senior Contributor I

Hi,all
    
      We need to set up CAN Bus  quickly, but Mcu_SetMode() is taking up a lot of time( 85 ~ 120 ms).
      Can I optimize the configuration of Mcu_SetMode? Or some other solution?


time.png
BRs,

xianlong

0 Kudos
Reply
1 Solution
560 Views
wuxianlong
Senior Contributor I

Hi, 

The following two do not need to be checked. There are also some other questions, which can be referred to this.

S32K3 functional reset causes increased start-up time 
image.png
Best Regaeds,
xianlong

View solution in original post

0 Kudos
Reply
4 Replies
1,719 Views
DanNguyenDuy
NXP Employee
NXP Employee

Hi @wuxianlong,

Before call Mcu_SetMode, you should call Mcu_InitClock() to change clocks to the correct values with the mode that needs to change as described details in the Reference manual.

At the moment, I have only this proposal.

Best regards,

Dan 

0 Kudos
Reply
583 Views
thorben_kamp
Contributor II

We are facing a similar issue. The function Mcu_SetMode requires up to 40 ms to complete, and we call Mcu_InitClock beforehand.

 
Mcu_Init(&Mcu_Config); 
Mcu_InitClock(McuClockSettingConfig_0); 
while(MCU_PLL_LOCKED != Mcu_GetPllStatus()) 
{ 
/* Busy wait until the System PLL is locked */ 
} 
Mcu_DistributePllClock(); 
Mcu_SetMode(McuModeSettingConf_0); /* Initialize Platform Driver */ Platform_Init(NULL_PTR);
 
Tags (3)
0 Kudos
Reply
561 Views
wuxianlong
Senior Contributor I

Hi, 

The following two do not need to be checked. There are also some other questions, which can be referred to this.

S32K3 functional reset causes increased start-up time 
image.png
Best Regaeds,
xianlong

0 Kudos
Reply
356 Views
thorben_kamp
Contributor II
Thanks for your response.

I noticed that the duration is reduced to about 20 ms when I change this setting. If I also uncheck CM7_1 and CM7_2 under MCU control, the duration drops further to less than 1 ms.

What impact does this configuration have on the rest of the software? Are there any side effects or dependencies I should be aware of when removing these cores from MCU control?
0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-1599539%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%5BS32K3_MCAL_API%5D%20%20Mcu_SetMode()%20take%20up%20a%20lot%20of%20time%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1599539%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2Call%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%26nbsp%3BWe%20need%20to%20set%20up%20CAN%20Bus%26nbsp%3B%20quickly%2C%20but%20Mcu_SetMode()%20is%20taking%20up%20a%20lot%20of%20time(%2085%20~%20120%20ms).%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%26nbsp%3BCan%20I%20optimize%20the%20configuration%20of%20Mcu_SetMode%3F%20Or%20some%20other%20solution%3F%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22time.png%22%20style%3D%22width%3A%20610px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22time.png%22%20style%3D%22width%3A%20610px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22time.png%22%20style%3D%22width%3A%20610px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F210998iFC6D9D840B4A0C64%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22time.png%22%20alt%3D%22time.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3CBR%20%2F%3EBRs%2C%3C%2FP%3E%3CP%3Exianlong%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2336234%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20%5BS32K3_MCAL_API%5D%20%20Mcu_SetMode()%20take%20up%20a%20lot%20of%20time%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2336234%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%EF%BC%8C%26nbsp%3B%3CBR%20%2F%3E%3CBR%20%2F%3EThe%20following%20two%20do%20not%20need%20to%20be%20checked.%20There%20are%20also%20some%20other%20questions%2C%20which%20can%20be%20referred%20to%20this.%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2FS32K%2FS32K3-functional-reset-causes-increased-start-up-time%2Fm-p%2F2007817%23U2007817%22%20class%3D%22lia-mention-container-editor-message%20lia-img-icon-forum-thread%20lia-fa-icon%20lia-fa-forum%20lia-fa-thread%20lia-fa%22%20target%3D%22_blank%22%3ES32K3%20functional%20reset%20causes%20increased%20start-up%20time%3C%2FA%3E%26nbsp%3B%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F379880i5CD4B1957D2DDB88%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22image.png%22%20alt%3D%22image.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3CBR%20%2F%3EBest%20Regaeds%2C%3CBR%20%2F%3Exianlong%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2335980%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20%5BS32K3_MCAL_API%5D%20%20Mcu_SetMode()%20take%20up%20a%20lot%20of%20time%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2335980%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EWe%20are%20facing%20a%20similar%20issue.%20The%20function%20Mcu_SetMode%20requires%20up%20to%2040%E2%80%AFms%20to%20complete%2C%20and%20we%20call%20Mcu_InitClock%20beforehand.%3C%2FP%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CPRE%20class%3D%22lia-code-sample%20language-c%22%3E%3CCODE%3EMcu_Init(%26amp%3BMcu_Config)%3B%20%0AMcu_InitClock(McuClockSettingConfig_0)%3B%20%0Awhile(MCU_PLL_LOCKED%20!%3D%20Mcu_GetPllStatus())%20%0A%7B%20%0A%2F*%20Busy%20wait%20until%20the%20System%20PLL%20is%20locked%20*%2F%20%0A%7D%20%0AMcu_DistributePllClock()%3B%20%0AMcu_SetMode(McuModeSettingConf_0)%3B%20%2F*%20Initialize%20Platform%20Driver%20*%2F%20Platform_Init(NULL_PTR)%3B%3C%2FCODE%3E%3C%2FPRE%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1600125%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20%5BS32K3_MCAL_API%5D%20%20Mcu_SetMode()%20take%20up%20a%20lot%20of%20time%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1600125%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F191389%22%20target%3D%22_blank%22%3E%40wuxianlong%3C%2FA%3E%2C%3C%2FP%3E%0A%3CP%3EBefore%20call%20Mcu_SetMode%2C%20you%20should%20call%20Mcu_InitClock()%20to%20change%20clocks%20to%20the%20correct%20values%20with%20the%20mode%20that%20needs%20to%20change%20as%20described%20details%20in%20the%20Reference%20manual.%3C%2FP%3E%0A%3CP%3EAt%20the%20moment%2C%20I%20have%20only%20this%20proposal.%3C%2FP%3E%0A%3CP%3EBest%20regards%2C%3C%2FP%3E%0A%3CP%3EDan%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2346217%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20%5BS32K3_MCAL_API%5D%20%20Mcu_SetMode()%20take%20up%20a%20lot%20of%20time%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2346217%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EThanks%20for%20your%20response.%3CBR%20%2F%3E%3CBR%20%2F%3EI%20noticed%20that%20the%20duration%20is%20reduced%20to%20about%2020%20ms%20when%20I%20change%20this%20setting.%20If%20I%20also%20uncheck%20CM7_1%20and%20CM7_2%20under%20MCU%20control%2C%20the%20duration%20drops%20further%20to%20less%20than%201%20ms.%3CBR%20%2F%3E%3CBR%20%2F%3EWhat%20impact%20does%20this%20configuration%20have%20on%20the%20rest%20of%20the%20software%3F%20Are%20there%20any%20side%20effects%20or%20dependencies%20I%20should%20be%20aware%20of%20when%20removing%20these%20cores%20from%20MCU%20control%3F%3C%2FLINGO-BODY%3E