Does any one knows if this particular MCU has built in Trim Value for a specific Bus Frequency? Say a frequency of 4.9152Mhz? If not, has someone calculated a trim value? Your help will be very much appreciated.
Hello, and welcome to the forum.
After intial power-up the untrimmed internal reference frequency will lie somewhere within the range 25 kHz to 41.7 kHz. At this point the ICSTRM register will contain the value 0x80. The reference would then need to be trimmed to a specific operating frequency, within the range 31.25 kHz to 39.0625 kHz, by manipulating the value within ICSTRM.
An unprogrammed device from the factory will have a calibration value programmed to address 0xFFAF, that will produce a specific reference frequency when loaded into ICSTRM. I am somewhat uncertain about the particular calibration frequency, but it may possibly be 32.768 kHz. Perhaps others may be able to verify this.
Also when flash is programmed via BDM, the programmer has the capability to calibrate the trim value, and program the flash location.
If the trimmed reference frequency were to be 32.768 kHz, the DCO output frequency within the ICS module would be 33.55 MHz, giving a maximum bus frequency of 16.78 MHz, or a sub-multiple as the BDIV setting is increased.
Hello and welcome to the fora, Super_Guwapo.
The internal clock source is factory callibrated for 31.25kHz. The BDM/software should calibrate to the same frequency. Assuming you transfer this value over to the working register and with the default POR clock setup this will give a bus clock of 16MHz. Changing the BDIV setting from 01 to 11 will result in a 4MHz bus clock. From here you will need to use the TRIM register to offset the internal reference clock to provide your 4.9152MHz. The reference clock frequency required for this is 38.4kHz. To achieve this will require a very low value for the trim register. It may be that on some devices this frequency is not achievable if the untrimmed frequency is too far on the low side.
A minor correction -
With a reference frequency of 31.25 kHz, the DCO output frequency will be 32 MHz. With the default POR setting of 01 for BDIV, this will actually give a bus frequency of 8 MHz (rather than 16 MHz) because of the additional divide by 2 stage. For a 16 MHz bus, the BDIV setting would need to be 00.
I went back to my scratchings for this and I clearly have 32Mhz / 4 = 16. Woops!
So the BDIV value required is 10 to get to 4MHz and then fiddle the TRIM to get to 4.9152.
Thanks for that.
Hi Peg and Mac,
Thank you very much for your response, both of you have given me a good starting point to do calculations on my desired frequency. I suppose I have to perform some mathematical calculation to derive my frequency. The reason I choose 4.9152Mhz is I can derive a perfect Baud rate for the SCI. These frequency is going to give a Baud rate of 9600, 19200 and so on with zero tolerance. Again thank you so much guys, keep up the good work.
It may be simpler to stick with a trimmed 8.0 MHz or 4.0 MHz bus frequency, and utilize the standard calibration. The SCI baud rate can still be very close to the nominal requirement. For example, with an 8.0 MHz bus and a baud rate of 19200, the baud division factor would be 8000000 / (16*19200), very close to 26. With this division factor, the baud rate error will be 0.16 percent, which is insignificant compared with the likely variation of the internal reference due to temperature and voltage changes. The SCI module should continue to work with a baud rate mismatch of up to 4 percent.
I think I will go for it using 8Mz clock (4Mhz Bus). If I set the divider to 13, I will get a Baud rate of 19230.7 which is only
30hz away and still very much within the acceptable tolerance of SCI system. I only opted to use the frequency of 4.9152Mhz because I use a crystal with that frequency in my other projects. This one is no crystal at all to save space on my PCB. When I feel bored one day, I will still calculate the exact trim value to derive the 4.9152mhz frequency internally.
I am only new in this forum, but I found it very helpful, especially if someone like you provide useful information to solve a problem. I hope one day I will be able to help someone else as a payback.
Thanks and regards,
When you said that the factory trim frequency for the ICS module was 31.25 kHz, was this specifically for the 'EL32, or for the ICS associated with another device, such as the 'QG8?
I notice that the datasheet for the 'EL32 makes no mention of the factory trim frequency. However I have discovered that, where the datasheet for other devices does state a factory trimmed frequency, the frequency may differ, depending on the device. For the devices that contain an ICS module where the factory trim setting is specifically stated, there seems to be three possibilities:
31.25 kHz for FL16, QD4, QG8, SH8 and SV16.
32.768 kHz for QB8 and QE series.
39.0625 kHz for SE8.
The frequency is not specified for the EL32 and SG8 devices. But I don't think that we can guess what the setting might be, in view of this inconsistency, which seems to defy any logical reasoning. The only way to be sure would be to indirectly measure the bus frequency, perhaps by setting a TPM channel for PWM output and accurately measuring the period of the output waveform.
It is right there in the specs. Appendix A.9 Row 1
You are absolutely correct, it is in appendix A, but still I think I am facing a little experimentation in my project. The specs says it is factory trimmed to 31.25Khz at 5V supply, unfortunately I am using a 3.3V power supply. I am hoping that the variation will not be too great to shift the SCI baud rate far from the center. It will be good if dropping the supply voltage creates an increase in frequency.
Simply re-calibrate the trim value during the programming process, and it will then apply to your actual operating voltage, and to the specific board layout. The trim frequency should be the same value as the factory trim.
How is the process to re-calibrate the trim value during the programing process? I do not have idea. I must make some code, it just a programmer option??
Thank you very much.
I downloaded the latest datasheet. I was previously referring to an earlier one which did not mention the factory trim frequency. It still begs the question why different trim frequencies for different devices?
Retrieving data ...