EmbDev.net

Forum: ARM programming with GCC/GNU tools problem about 711's clock


Author: Weimin Li (afsim)
Posted on:

Rate this post
0 useful
not useful
Hi,

It is OK like this:

  RCCU_Div2Config(ENABLE);
  RCCU_MCLKConfig(RCCU_DEFAULT);
  RCCU_FCLKConfig(RCCU_RCLK_8);
  RCCU_PCLKConfig(RCCU_RCLK_8);
  RCCU_PLL1Config(RCCU_PLL1_Mul_12 , RCCU_Div_4) ;
  while(RCCU_FlagStatus(RCCU_PLL1_LOCK) == RESET);
  RCCU_RCLKSourceConfig(RCCU_PLL1_Output) ;

when i change
  RCCU_PLL1Config(RCCU_PLL1_Mul_12 , RCCU_Div_4) ;
to
  RCCU_PLL1Config(RCCU_PLL1_Mul_12 , RCCU_Div_2) ;

code can't run.

so,MCLKval=24M is OK
MCLKval=48M is failure.

Is it a hardware problem?

MCLKval=RCCU_FrequencyValue (RCCU_MCLK);
APB1CLKval=RCCU_FrequencyValue (RCCU_FCLK);
APB2CLKval=RCCU_FrequencyValue (RCCU_PCLK);

thank you in advance.

Author: Spencer Oliver (ntfreak)
Posted on:

Rate this post
0 useful
not useful
What clock are you driving the str7 with ?

Here ia an example of using a 16MHz clock input

RCCU_Div2Config( ENABLE );
RCCU_MCLKConfig( RCCU_DEFAULT );
RCCU_FCLKConfig( RCCU_RCLK_2 );
RCCU_PCLKConfig( RCCU_RCLK_2 );
RCCU_PLL1Config( RCCU_PLL1_Mul_12, RCCU_Div_2 );
RCCU_RCLKSourceConfig( RCCU_PLL1_Output );

This will give us a MCLK of 48MHz and a peripheral clock of 24MHz

I have noticed that when debugging the clocks can sometimes get locked
up.
If you have get this behaviour then insert the follwing before the clock
config above. This will reset the clock to the default state before
changing to the new clcok source.
RCCU_RCLKSourceConfig( RCCU_CLOCK2 );

Hope this helps.
Spen

Author: afsim (Guest)
Posted on:

Rate this post
0 useful
not useful
Spen:

yes, i am using a 16MHz clock input.

so I think it is something wrong with hardware.

thank you very much indeed.

Author: afsim (Guest)
Posted on:

Rate this post
0 useful
not useful
Spencer Oliver wrote:
>
> I have noticed that when debugging the clocks can sometimes get locked
> up.
> If you have get this behaviour then insert the follwing before the clock
> config above. This will reset the clock to the default state before
> changing to the new clcok source.
> RCCU_RCLKSourceConfig( RCCU_CLOCK2 );
>

I try this today.
You are right.

add
  RCCU_RCLKSourceConfig( RCCU_CLOCK2 );
before the clock config,my board can run at 48M.


Thank you very much indeed.

Author: Spencer Oliver (ntfreak)
Posted on:

Rate this post
0 useful
not useful
Note this should only need doing for debugging, when the device is reset
from cold then the RCCU_CLOCK2 option is enabled by default.

Some ide's use a reset script that perform similar behaviour to adding
this line.

Regards
Spen

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.