We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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
When you start programming you don't know anything about the target which is the reason why there is an input field for you to tell the boot loader what the crystal freqnecy is.
Exactly why do you think you have a need to be able to auto-detect the crystal frequency
I want to recognize xtal that is set in flash/configure flash tools/target in keil
my purpose is not about practical and after programming to IC.
Pardon??
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%.