How to input external clock using function generator

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to input external clock using function generator

2,970 Views
chinosse
Contributor I

Hello everyone.

I am using HCS08M9S08SH8 microcontroller.

This time, I would like to use function generator(I use Tektronix AFG 3022B) as a clock input signal to EXTAL pin.

However,I can not find any documents explaining about this technique.

Could someone tell me how can i conect function generator to this microcontroller directory and how to initialize for this external clock in assembler?

Thank you very much.

Labels (1)
0 Kudos
6 Replies

1,590 Views
bigmac
Specialist III

Hello, and welcome to the forum.

 

You do not mention your reason for wishing to use the function generator?

 

The main issue will be to provide sufficient protection of the EXTAL input pin from excessive voltage swings from the generator.  You will also need to consider the possibility of static discharge into the pin, and its suppression.  To prevent damage to the MCU, this may require additional buffering and protection circuitry.  This becomes even more important if the function generator has a variable outpur level, or is capable of negative output swings using front panel controls.

 

Yet another issue may be the possibility of front panel frequency adjustment, accidental or otherwise, causing the maximum allowable bus frequency to be exceeded.

 

If you do not wish to use the internal reference, or an external crystal reference, a much safer alternative would be to use a packaged oscillator that provides a CMOS compatible output, permanently connected to the EXTAL pin.

 

On the basis that you have considered these protection issues, you will need to decide the frequency range to be used  - low range 32-38.4kHz, or high range 1-5MHz. You will also need to decide the operating mode for the ICS module, FEE, FBE or FBELP.  Further information about these issues may be obtained from the device datasheet, Chapter 10: Internal clock source, and also Appendix A.8.  The setup for the various ICS control register is also described wthin Chapter 10.

 

You might also download Application Note AN3499 "Clock options on the HC9S08 family".

 

Regards,

Mac

 

0 Kudos

1,591 Views
chinosse
Contributor I

Hello bigmac.

Thank you for writing me back so soon.

 

The reason for using FG as an external clock is that it uses in an experiment of a university.

 

I understand that it is necessary to protect an Extal pin.

But, An external clock was not able to be applied although the data sheet was seen.

Would you tell me the source code in the assembler for applying an external clock?

 

 

Thank you

0 Kudos

1,591 Views
bigmac
Specialist III

Hello,

 

As I said previously, a definative answer will require knowledge of the freqency range you intend using, the bus frequency you require to achieve, and whether or not the FLL is to be used (FEE mode), or bypassed (FBE mode).

 

Regards,

Mac

 

0 Kudos

1,591 Views
chinosse
Contributor I

Hello mac

Thank you for your reply

 

I'm sorry

I'm going to use bypassed (FBE mode).

 

Thank you for making the time to this matter.

0 Kudos

1,591 Views
bigmac
Specialist III

Hello,

 

Using FBE mode, the external reference clock frequency is limited to 5.00MHz, and the maximum bus frequency will be 2.50MHz (for BDIV = %000).  The FLL  The DCO output is still used for the BDM clock, so RDIV stil requires to be correctly initialised.

 

          MOV  #%00000000,ICSC2
;                  ||||||||
;                  |||||||+- EREFSTEN  Optional
;                  ||||||+-- ERCLKEN   Optional
;                  |||||+--- EREFS     External clock source
;                  ||||+---- LP        FLL enabled for bypass mode
;                  |||+----- HGO       Don't care
;                  ||+------ RANGE     High frequency range
;                  ++------- BDIV      Divide by 1

          MOV  #%10111000,ICSC1
;                  ||||||||
;                  |||||||+- IREFSTEN
;                  ||||||+-- IRCLKEN
;                  |||||+--- IREFS     No internal reference clock
;                  ||+++---- RDIV      Divide by 128
;                  ++------- CLKS      External reference clock

 

Regards,

Mac

 

 

0 Kudos

1,591 Views
chinosse
Contributor I

Hello bigmac

Thank you for writing me back,and Sorry for the reply.

The external clock was able to be applied in code I asked him to teach.

 

thank you big mac.

 

 

0 Kudos