MCU Setting issue on S32K14X_MCAL4_2_RTM_1_0_4 about "Clock under MCU control"

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

MCU Setting issue on S32K14X_MCAL4_2_RTM_1_0_4 about "Clock under MCU control"

Jump to solution
1,798 Views
ou_gangxun
Contributor II

The following conflicts occurred when I configured the clock of MCU:
"System clock under MCU control" and "SIRC under MCU control "& "firc under MCU control" cannot coexist.
This will cause MCAL to ignore the initialization of SIRC and firc after using "System clock under MCU control" to initialize SPLL
Or vice versaF
Using "SIRC under MCU control" or "Firc under MCU control" does not initialize SPLL
Other peripherals will use SIRC and Firc as clock

 

The generated code ignores the configuration of firc and SIRCThe generated code ignores the configuration of firc and SIRCThe generated code ignores the configuration of firc and SIRC2a57a50238b6bfafc0e27f9b763440b7.png4307209f5404d0cc11dd29551688ba01.pngb195824ca04242acbbad51392e40ca35.png sources.

0 Kudos
1 Solution
1,780 Views
hungnguyenphi
NXP Employee
NXP Employee

Hello @ou_gangxun ,

1.In the MCAL driver:
-  If the "System clock under MCU control" ENABLE. Before the code configure the other clock (SIRC, FIRC, .....) it will drop system clock of 
    + RUN mode to SIRC
    + VLP mode to SIRC
    + HSR mode to FIRC
-  If the "SIRC under MCU control " ENABLE, the MCU driver will disable the SIRC before configure it. 
So if "System clock under MCU control" ENABLE and "SIRC under MCU control " ENABLE it may make an error(SIRC is disable when RUN mode use SIRC source clock). Please see MCAL-22920 in the release note for more information

2. From my point of view, if user want to configure these three parameters("System clock under MCU control" and "SIRC under MCU control "& "firc under MCU control") on RTM 1.0.4, they can:

- Create 3 McuClockSettingConfig: ClockSetting1, ClockSetting2 and ClockSetting3
    + ClockSetting1 :
McuSysClockUnderMcuControl = true, SYS clock use SOSC. 
McuSIRCUnderMcuControl = false
McuFIRCUnderMcuControl = false
McuSOSCUnderMcuControl = true , enable SOSC.
    + ClockSetting2 :
McuSysClockUnderMcuControl = false
McuSIRCUnderMcuControl = true , Enable and setup SIRC as user configuration
McuFIRCUnderMcuControl = true , Enable and setup FIRC as user configuration    
    + ClockSetting3 :
McuSysClockUnderMcuControl = true, setup system source clock for RUN VLP HSR mode as user configuration.
McuSIRCUnderMcuControl = false 
McuFIRCUnderMcuControl = false                      
- Then call:
Mcu_InitClock(ClockSetting1);
Mcu_InitClock(ClockSetting2);
Mcu_InitClock(ClockSetting3);

 

Best regards,

Hung.

View solution in original post

0 Kudos
2 Replies
1,708 Views
shashank7
Contributor I

I am still observing the same issue while configuring AUTOSAR MCAL 4.2 RTM 1.0.4

Description: System or Bus clock is initializing by MCU correctly. However, other configured clocks such as SOSC, SIRC, FIRC, SPLL, etc. are not initializing , as configured in EB Tresos. This leads to the other dependent peripherals on these clocks stopped working.

Analysis: If System clock is under MCU control then clocks such as SIRC and FIRC won’t be under MCU control. I tried several combinations and one of such scenario is to “Disable System Clock under MCU control” and then “Enable SIRC and FIRC for MCU control”

Observation: There may be other reasons but I am observing the below macros ‘ALWAYS’ set to “STD_OFF” during auto-code generation from EB Tresos.

/* This define Enable/Disable the SOSC clock under Mcu control */

#define MCU_SOSC_UNDER_MCU_CONTROL              (STD_OFF)

/* This define Enable/Disable the SIRC clock under Mcu control */

#define MCU_SIRC_UNDER_MCU_CONTROL              (STD_OFF)

/* This define Enable/Disable the FIRC clock under Mcu control */

#define MCU_FIRC_UNDER_MCU_CONTROL              (STD_OFF)

/* This define Enable/Disable the SPLL clock under Mcu control */

#define MCU_SPLL_UNDER_MCU_CONTROL              (STD_OFF)

Validation: If we manually initializing the clocks by making direct function calls, then it seems to work for certain peripherals such as CAN Driver. This confirms the implementation of the driver is correct. We initialize following clocks for CAN driver.

SOSC_init_8MHz();      /* Initialize system oscillator for 8 MHz xtal */

SPLL_init_160MHz();    /* Initialize SPLL to 160 MHz with 8 MHz SOSC */

NormalRUNmode_80MHz(); /* Init clocks: 80 MHz sysclk & core, 40 MHz bus, 20 MHz flash*/

 

Please find below the versions of tools we are using:

  • EB Tresos 23.0.0
  • AUTOSAR MCAL 4.2 RTM 1.0.4
0 Kudos
1,781 Views
hungnguyenphi
NXP Employee
NXP Employee

Hello @ou_gangxun ,

1.In the MCAL driver:
-  If the "System clock under MCU control" ENABLE. Before the code configure the other clock (SIRC, FIRC, .....) it will drop system clock of 
    + RUN mode to SIRC
    + VLP mode to SIRC
    + HSR mode to FIRC
-  If the "SIRC under MCU control " ENABLE, the MCU driver will disable the SIRC before configure it. 
So if "System clock under MCU control" ENABLE and "SIRC under MCU control " ENABLE it may make an error(SIRC is disable when RUN mode use SIRC source clock). Please see MCAL-22920 in the release note for more information

2. From my point of view, if user want to configure these three parameters("System clock under MCU control" and "SIRC under MCU control "& "firc under MCU control") on RTM 1.0.4, they can:

- Create 3 McuClockSettingConfig: ClockSetting1, ClockSetting2 and ClockSetting3
    + ClockSetting1 :
McuSysClockUnderMcuControl = true, SYS clock use SOSC. 
McuSIRCUnderMcuControl = false
McuFIRCUnderMcuControl = false
McuSOSCUnderMcuControl = true , enable SOSC.
    + ClockSetting2 :
McuSysClockUnderMcuControl = false
McuSIRCUnderMcuControl = true , Enable and setup SIRC as user configuration
McuFIRCUnderMcuControl = true , Enable and setup FIRC as user configuration    
    + ClockSetting3 :
McuSysClockUnderMcuControl = true, setup system source clock for RUN VLP HSR mode as user configuration.
McuSIRCUnderMcuControl = false 
McuFIRCUnderMcuControl = false                      
- Then call:
Mcu_InitClock(ClockSetting1);
Mcu_InitClock(ClockSetting2);
Mcu_InitClock(ClockSetting3);

 

Best regards,

Hung.

0 Kudos