EmbeddedRelated.com
Forums

Xternal crystal

Started by sammsp430 April 9, 2004
hi all,
  have mounted an external 8 Mhz crystal,but it doenst seem to be 
working.the MCLK gives me the default DCO clk which is apprx 
750Khz,and the external crytal isnt activated,i dont see any 
oscillations.


#include "msp430x13x.h"
            ORG     0F000h                  

RESET       mov.w   #300h,SP                
            mov.w   #WDTPW+WDTHOLD,&WDTCTL 
            BIC #OSCOFF,SR
            bic.b   #XT2OFF,&BCSCTL1           
            bis.b   #XTS,&BCSCTL1           
            bic.b   #OFIFG,&IFG1            
            mov.w   #0FFh,R15               
back        dec.w   R15                    
            jnz    back
            
            bis.b   #BIT7,&BCSCTL2   
                 
            bis.b   #001h,&P5DIR           
            bis.b   #0FFh,&P5SEL        
                                         
                                                                 
Mainloop    bis.b   #002h,&P1OUT            
            bic.b   #002h,&P1OUT            
            jmp     Mainloop              
                                                    
 

            ORG     0FFFEh                  
            DW      RESET                    
            END     


Beginning Microcontrollers with the MSP430

Maybe you can try something like the following routine (read the
user's manual pages 7-15 and 7-16)

BIS.B #XTS,&BCSCTL1 ; Set XTS bit to select LFXT1 oscillator

BIC #OSCOFF,SR ; Turn on LFXT1 oscillator

BIC.B #XT2Off,&BCSCTL1 ; Reset XT2Off to turn on LFXT1

L1 BIC.B #OFIFG,&IFG1 ; Clear OscFault flag

MOV #0FFFh,R15 ; Move delay value to register

L2 DEC R15 ; Decrement delay value

JNZ L2 ; Repeat until zero

BIT.B #OFIFG,&IFG1 ; Test OscFault flag

JNZ L1 ; Repeat if necessary

It seem that you miss the part written in bold text in your previous routine.

Best Regards

Vito

  ----- Original Message ----- 
  From: sammsp430 
  To: msp430@msp4... 
  Sent: Friday, April 09, 2004 12:42 PM
  Subject: [msp430] Xternal crystal


  hi all,
    have mounted an external 8 Mhz crystal,but it doenst seem to be 
  working.the MCLK gives me the default DCO clk which is apprx 
  750Khz,and the external crytal isnt activated,i dont see any 
  oscillations.


  #include "msp430x13x.h"
              ORG     0F000h                  

  RESET       mov.w   #300h,SP                
              mov.w   #WDTPW+WDTHOLD,&WDTCTL 
              BIC #OSCOFF,SR
              bic.b   #XT2OFF,&BCSCTL1           
              bis.b   #XTS,&BCSCTL1           
              bic.b   #OFIFG,&IFG1            
              mov.w   #0FFh,R15               
  back        dec.w   R15                    
              jnz    back
              
              bis.b   #BIT7,&BCSCTL2   
                   
              bis.b   #001h,&P5DIR           
              bis.b   #0FFh,&P5SEL        
                                           
                                                                   
  Mainloop    bis.b   #002h,&P1OUT            
              bic.b   #002h,&P1OUT            
              jmp     Mainloop              
                                                      


              ORG     0FFFEh                  
              DW      RESET                    
              END     



  .





------
  . 






Ooops.. I see that the bold text is formatted in plain text.. the last two
lines of my routine were written in bold.
You forget to test the OFIFG after starting the oscillator.
Regards
  ----- Original Message ----- 
  From: Vito Russo 
  To: msp430@msp4... 
  Sent: Tuesday, April 13, 2004 9:26 AM
  Subject: Re: [msp430] Xternal crystal


  Maybe you can try something like the following routine (read the user's
manual pages 7-15 and 7-16)

  BIS.B #XTS,&BCSCTL1 ; Set XTS bit to select LFXT1 oscillator

  BIC #OSCOFF,SR ; Turn on LFXT1 oscillator

  BIC.B #XT2Off,&BCSCTL1 ; Reset XT2Off to turn on LFXT1

  L1 BIC.B #OFIFG,&IFG1 ; Clear OscFault flag

  MOV #0FFFh,R15 ; Move delay value to register

  L2 DEC R15 ; Decrement delay value

  JNZ L2 ; Repeat until zero

  BIT.B #OFIFG,&IFG1 ; Test OscFault flag

  JNZ L1 ; Repeat if necessary

  It seem that you miss the part written in bold text in your previous routine.

  Best Regards

  Vito

    ----- Original Message ----- 
    From: sammsp430 
    To: msp430@msp4... 
    Sent: Friday, April 09, 2004 12:42 PM
    Subject: [msp430] Xternal crystal


    hi all,
      have mounted an external 8 Mhz crystal,but it doenst seem to be 
    working.the MCLK gives me the default DCO clk which is apprx 
    750Khz,and the external crytal isnt activated,i dont see any 
    oscillations.


    #include "msp430x13x.h"
                ORG     0F000h                  

    RESET       mov.w   #300h,SP                
                mov.w   #WDTPW+WDTHOLD,&WDTCTL 
                BIC #OSCOFF,SR
                bic.b   #XT2OFF,&BCSCTL1           
                bis.b   #XTS,&BCSCTL1           
                bic.b   #OFIFG,&IFG1            
                mov.w   #0FFh,R15               
    back        dec.w   R15                    
                jnz    back
                
                bis.b   #BIT7,&BCSCTL2   
                     
                bis.b   #001h,&P5DIR           
                bis.b   #0FFh,&P5SEL        
                                             
                                                                     
    Mainloop    bis.b   #002h,&P1OUT            
                bic.b   #002h,&P1OUT            
                jmp     Mainloop              
                                                        


                ORG     0FFFEh                  
                DW      RESET                    
                END     



    .





  ------
    . 



  



  .





------
  .