LPC4357: how to setting M4 core frequency at most 204MHz?

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

LPC4357: how to setting M4 core frequency at most 204MHz?

ソリューションへジャンプ
1,568件の閲覧回数
astrogreco
Contributor II

I'm trying to implement PLL1 to set the main clock frequency for the M4 core at most 204MHz.
To set the PLL1 with the PLL1_CTRL register there are no problems. I perform the following instructions:
1) Set AUTOBLOCK
2) Set M and N
3) wait LOCK
4) Set DIRECT
5) wait LOCK
6) clear BYPASS
7) wait LOCK

Each setting is set and the LOCK in PLL1_STAT is always 0.
Unfortunately, when I finally select the CLK_SEL of BASE_M4_CLK at 0x9, the next instruction is no longer executed.
Even if I do this last setting before setting up the PLL1, it does the same problem.

What could be the reason?

ラベル(1)
1 解決策
1,427件の閲覧回数
bernhardfink
NXP Employee
NXP Employee

I must admit that I'm a little bit out of business for this LPC4300 platform, but after a short look into your code I have the follwing recommendations:

  • If you use a variable to poll for a status which changes with an event from the outside, then declare your variable with the keyword volatile. Otherwise the compiler could do some ugly optimization.
  • Don't poll on register flags (like the lock bit) in a while loop. At least add some NOP() in the while loop.
  • If it is recommended to wait after a specific setting, then do it with a simple wait() function. For safety reasons you can then read the lock bit to confirm that it is set.

Regards,

Bernhard.

元の投稿で解決策を見る

4 返答(返信)
1,427件の閲覧回数
bernhardfink
NXP Employee
NXP Employee

A few reasons for this:

  • You execute from internal flash and after switching to 204MHz the waitstate setting do no longer fit. So set the wait states to the maximum first and then switch to higher frequency.
  • Other components connected to this PLL output might cause a crash if they are not prepared for this step
  • You execute from external QSPI flash and the interface speed does no longer match the specifcation when switching to 204MHz
  • Power supply problems due to the higher power demand at 204MHz (in case it's your own board development)

Regards,

Bernhard.

1,427件の閲覧回数
astrogreco
Contributor II

Thanks for the reply. I set the PLL as the first operation.
I solved, the problem was that the PLL1 was not enabled, ie bit 0 (PD) was not clear.
However now it works but I have to skip the wait LOCK phases. In fact, the LOCK bit of PLL1_STAT is never set to 1.
I set the PLL1_CTRL register in several steps, but when I check the LOCK it is always 0.
If I skip the LOCK check the process goes on all the same and everything works.

Attached the function I use.

What could be the problem of LOCK bit?

0 件の賞賛
返信
1,428件の閲覧回数
bernhardfink
NXP Employee
NXP Employee

I must admit that I'm a little bit out of business for this LPC4300 platform, but after a short look into your code I have the follwing recommendations:

  • If you use a variable to poll for a status which changes with an event from the outside, then declare your variable with the keyword volatile. Otherwise the compiler could do some ugly optimization.
  • Don't poll on register flags (like the lock bit) in a while loop. At least add some NOP() in the while loop.
  • If it is recommended to wait after a specific setting, then do it with a simple wait() function. For safety reasons you can then read the lock bit to confirm that it is set.

Regards,

Bernhard.

1,427件の閲覧回数
astrogreco
Contributor II

Thank you very much. I solved the problem. NOP operations  are required. Now after every PLL1 setting the LOCK bit is set to 1 and the process goes on correctly.

Attached the function used

0 件の賞賛
返信