Help with AP8 (OSC-CRISTAL)

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

Help with AP8 (OSC-CRISTAL)

1,345 次查看
alecelario
Contributor I
Hello, i have an AP8 and this work perfect with the internal oscilator, but a need use the cristal oscilator. I make a routine to configurate pctl,pmsh,pmsl,pmrs,pmds and pbwc register but doesn´t work. The routine is:
  mov     #%00111001,config1     
  mov     #%00000001,config2     
  mov     #%00000001,pctl               ;programo P=$0, E=$0   
  mov     #%00000001,pmsh            ;programo N=$F5 con pmsh y pmsl
   mov     #%11101001,pmsl             ;programo N=$F5 con pmsh y pmsl
  mov     #%01000000,pmrs             ;programo L=$40
  mov     #%00000001,pmds            ;R=$1
   bset    5,pctl                                ;enciendo el PLL con el bit PLLON=1
  bset    7,pbwc          ;pongo en modo automático en PLL con el bit AUTO=1  
waitPLL:
   brclr 6,pbwc,waitPLL  ;salta a waitPLL si el bit LOCK=0
                                  ;( frecuencia  incorrecta o variable)
   bset  4,pctl                ;sino sigue y engancha a frecuencia del PLL
           
 Los parámtros P,N,L,E son para Fbus=2MHz,    GCMVCLK=GCMPCLK=8MHz
 
What is the problem?
      
标签 (1)
0 项奖励
回复
2 回复数

328 次查看
rocco
Senior Contributor II
Hi, Alecelario:

Just a guess:

Is this the first time you have written to Config1 or Config2? Could other initialization code have written to the previously?

Config1 and Config2 are "Write-once" registers. If they have been previously written since reset, any further writes will be ignored.
0 项奖励
回复

328 次查看
peg
Senior Contributor IV
Hi Alecelario,
 
Firstly, this is a non-A AP8?
 
What frequency is your crystal?
 
You have not shown the value in the MOR register.
 
The value in CONFIG2 for bits 3:4 you show as 0:0, this is for internal oscillator.
1:0 is crystal.
 
Regards
Peg
 
0 项奖励
回复