About S32K312 clock switching requirements

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

About S32K312 clock switching requirements

跳至解决方案
2,032 次查看
liangyouchao
Contributor I

About S32K312 clock switching requirements
Currently our TBOX developed based on S32K312 needs low power consumption, we plan to use 120MHZ and 750KHZ clocks, where the 750KHZ clock will be used for low power scenarios:

liangyouchao_0-1692080275492.png

my clock configurations and Power mode configurations are as follows.

1. Very low speed run mode clock config

liangyouchao_1-1692081944435.png

2. RUN MODE POWER config

liangyouchao_2-1692081975593.png

3. Very Low speed run mode power config

liangyouchao_3-1692081989380.png

4. PIN Config

liangyouchao_4-1692082447304.png

My requirement is how to switch from 120MHZ to 750KHZ or 750KHZ to 120MHZ?

Currently for RUNMODE and VERY LOW SPEED RUN MODE, there are 2 different configurations for GPIO, POWER, and CLOCK, for the modes. Can I switch the clock this way:

(1) Power-on clock configuration

```

        statusInitClock = Clock_Ip_Init(&Clock_Ip_aClockConfig[0]);
        if (statusInitClock != CLOCK_IP_SUCCESS) {
            return E_POWER_MODE_TYPE_ERROR_CLOCK_INIT_FAIL;
        }

        statusInitPort = Siul2_Port_Ip_Init(NUM_OF_CONFIGURED_PINS0, g_pin_mux_InitConfigArr0);
        if (statusInitPort != SIUL2_PORT_SUCCESS) {
            return E_POWER_MODE_TYPE_ERROR_PORT_INIT_FAIL;
        }

        Power_Ip_SetMode(&Power_Ip_aModeConfigPB[0]);

```


(2) Switch from 120MHZ to 750KHZ

```

        statusInitClock = Clock_Ip_Init(&Clock_Ip_aClockConfig[1]);
        if (statusInitClock != CLOCK_IP_SUCCESS) {
            return E_POWER_MODE_TYPE_ERROR_CLOCK_INIT_FAIL;
        }

        statusInitPort = Siul2_Port_Ip_Init(NUM_OF_CONFIGURED_PINS1, g_pin_mux_InitConfigArr1);
        if (statusInitPort != SIUL2_PORT_SUCCESS) {
            return E_POWER_MODE_TYPE_ERROR_PORT_INIT_FAIL;
        }

        Power_Ip_SetMode(&Power_Ip_aModeConfigPB[1]);

```
(3) from 750KHZ back to 120MHZ

```

    statusInitClock = Clock_Ip_Init(&Clock_Ip_aClockConfig[0]);
        if (statusInitClock != CLOCK_IP_SUCCESS) {
            return E_POWER_MODE_TYPE_ERROR_CLOCK_INIT_FAIL;
        }

 

        statusInitPort = Siul2_Port_Ip_Init(NUM_OF_CONFIGURED_PINS0, g_pin_mux_InitConfigArr0);
        if (statusInitPort != SIUL2_PORT_SUCCESS) {
            return E_POWER_MODE_TYPE_ERROR_PORT_INIT_FAIL;
        }

 

        Power_Ip_SetMode(&Power_Ip_aModeConfigPB[0]);

```

Before switching, do I need to turn off the PIN, LPUART, ADC that are already turned on, and then turn them back on after the clock is switched?

Please help me to confirm the above information, currently my test keeps going to HardFault_Handler。

 

Best Wishes.

0 项奖励
回复
1 解答
1,971 次查看
DanNguyenDuy
NXP Employee
NXP Employee

Hello @liangyouchao,

FIRC_CLK is optional in the Standby domain. I suppose that you can configure FIRC for low-power mode.

If you want to find out the root cause, you should debug registers and check why the Hardfault occurred.

Best regards,

Dan

在原帖中查看解决方案

0 项奖励
回复
3 回复数
1,983 次查看
liangyouchao
Contributor I

My RTD Version is SW32K3_RTD_4_4_2_0_0_D2203.

Now I have solved the problem, I solved it by configuring the FIRC setting FIRC under MCU control to disabled, but didn't understand why FIRC was configured that way.

 

 

0 项奖励
回复
1,972 次查看
DanNguyenDuy
NXP Employee
NXP Employee

Hello @liangyouchao,

FIRC_CLK is optional in the Standby domain. I suppose that you can configure FIRC for low-power mode.

If you want to find out the root cause, you should debug registers and check why the Hardfault occurred.

Best regards,

Dan

0 项奖励
回复
1,997 次查看
DanNguyenDuy
NXP Employee
NXP Employee

Hello @liangyouchao,

What is the RTD package you are using?

Could you send me your .mex file (S32DS configuration file)?

Best regards,

Dan

0 项奖励
回复