This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

recognize clock of target

Hi

we can change value of xtal from configure flash tools in Keil

when i start programing i want to make function that recognize xtal and use it for other purpose

how can i do this ?

thx

Parents Reply Children
  • You don't "set" the crystal frequency in the flash.

    The crystal frequency isn't programmable. It's a hard parameter of the crystal. If you buy a 15MHz crystal, then it is stamped on the outside that it is a 15MHz crystal, and if the crystal oscillator isn't broken (and the crystal load parameters etc are correct) the oscillator will then oscillate at 15MHz.

    So why do you enter a crystal speed when programming? For the simple reason that the boot loader in the chip needs to know the crystal speed so it can compute the correct settings for the baudrate generator, and for the delays needed when programming the flash.

    The processor can make a very rough estimate of the crystal by using the internal RC oscillator. But to measure a crystal with reasonable precision, you need another crystal of at least the precision you want to measure the first crystal. If the RC oscillator has 0.5% precision, then it can't be used to get a baudrate better than 0.5% since it can't measure the crystal frequency better than 0.5%.