Change system clock frequency to 150MHZ

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

Change system clock frequency to 150MHZ

1,231 次查看
timmermans
Contributor I

I need my system clock to run on 150 MHz. But I also need to read&write to Flash. 
To achieve this I wanted to change the clock from 150 MHz to 75 MHz and after the Flash operation bump the speed back up to 150 MHz. 

But I am not sure how to do this. 
I wanted to do is in the following way:


void System::decreaseMainClockSpeed()
{
CLOCK_SetClkDiv(kCLOCK_DivAhbClk, 2U, false);
POWER_SetVoltageForFreq(75000000);
SystemCoreClock = 75000000;
}

void System::resetMainClockToOriginalSpeed()
{
POWER_SetVoltageForFreq(150000000);
CLOCK_SetClkDiv(kCLOCK_DivAhbClk, 1U, false);
CLOCK_GetFreq(kCLOCK_BusClk);
SystemCoreClock = 150000000;
}

 

The decreaseMainClockSpeed function works like it should. But when I call the resetMainClockToOriginalSpeed everything breaks after the CLOCK_SetClkDiv(kCLOCK_DivAhbClk, 1U, false); function.

Can someone help me?

标签 (1)
0 项奖励
回复
1 回复

1,219 次查看
Pavel_Hernandez
NXP TechSupport
NXP TechSupport

Hello, 

I recommend the use of the MCU config tool, try to change the frequency and evaluate what changes were made in the code then implement them in your application.

0 项奖励
回复