Change system clock frequency to 150MHZ

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Change system clock frequency to 150MHZ

557件の閲覧回数
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 返信

545件の閲覧回数
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 件の賞賛