i.MX31: question about CFG_HZ and CKIL
Hi all,
in the i.MX31 processor reference manual they mention a 32 kHz clock as input for several timers and controllers. Sometimes it's called ipg_clk_32k. But the documentation does not clearly state, that this clock actually is the CKIL.
As far as I could derive from the ADS schematics the CKIL is feeded with 32768 Hz instead of 32000 Hz. On our board we use 32768 Hz either.
If CKIL is the above mentioned 32 kHz clock, the resulting deviation in the timers is "only" about 2.4% as long as CFG_HZ in mx31ads.h is 32000 Hz. Although it works with the current definition, I'd like to know your opinions, whether it is necessary to adjust this value.
Thank you for comments.
Best Regards,
Jens
Quoted 7 lines · Jens Gehrlein
in the i.MX31 processor reference manual they mention a 32 kHz clock as input for several timers and controllers. Sometimes it's called
ipg_clk_32k. But the documentation does not clearly state, that this clock actually is the CKIL.As far as I could derive from the ADS schematics the CKIL is feeded with 32768 Hz instead of 32000 Hz. On our board we use 32768 Hz either.
MCIMX31RM Rev 2.3, section 3.4.4.1.1:
<quote>
The i.MX31 and i.MX31L processors can use either a 32 kHz, 32.768 kHz or a 38.4 kHz crystal as the external low frequency source. Throughout this chapter, the low frequency crystal is referred to as the 32 kHz crystal, even though this can refer to the 32.768 or 38.4 kHz values. </quote>
So, so far it is allowed to use a 32768 crystal.
Quoted 4 lines
If CKIL is the above mentioned 32 kHz clock, the resulting deviation in the timers is "only" about 2.4% as long as
CFG_HZinmx31ads.his 32000 Hz. Although it works with the current definition, I'd like to know your opinions, whether it is necessary to adjust this value.
Further, it depends on the CLKSS signal, which on i.MX31ADS is connected to JP22, whether CKIL is used as the reference clock. Unless you override this choise later in software.
In any case, I think, you are right. I'll submit a patch for mx31ads shortly, then you'll see what you could change for your platform too.
Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
Quoted 5 lines · In message <[email protected]> you wrote:
If CKIL is the above mentioned 32 kHz clock, the resulting deviation in the timers is "only" about 2.4% as long as
CFG_HZinmx31ads.his 32000 Hz. Although it works with the current definition, I'd like to know your opinions, whether it is necessary to adjust this value.
Note that CFG_HZ is not really configurable, even if the name suggests so. In reality, CFG_HZ is a constant with the value 1000.
There are some broken boards which don't handle this correctly, but at least that's what you should set.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de The goal of science is to build better mousetraps. The goal of nature is to build better mice.
Hi Wolfgang, Guennadi,
Quoted 11 lines · Wolfgang Denk
Quoted 4 lines · In message <[email protected]> you wrote:
If CKIL is the above mentioned 32 kHz clock, the resulting deviation in the timers is "only" about 2.4% as long as
CFG_HZinmx31ads.his 32000 Hz. Although it works with the current definition, I'd like to know your opinions, whether it is necessary to adjust this value.Note that
CFG_HZis not really configurable, even if the name suggests so. In reality,CFG_HZis a constant with the value 1000.There are some broken boards which don't handle this correctly, but at least that's what you should set.
So, as far as I understood the function get_timer() must also return a value that is counted up 1000 times per second. But according to cpu/arm1136/mx31/interrupt.c this is not the case. GPTCNT is updated with 32000 or 32768 Hz, and this counter register's value is currently returned by get_timer() (minus base, passed by the caller).
If CFG_HZ should be set to 1000 than cpu/arm1136/mx31/interrupt.c should be fixed, i.e. the prescaler had to be adjusted from 1 to approx. 33. Do you agree or did I understand this timer stuff completely wrong?
Best regards,
Jens
Quoted 4 lines · In message <[email protected]> you wrote:
If
CFG_HZshould be set to 1000 thancpu/arm1136/mx31/interrupt.cshould be fixed, i.e. the prescaler had to be adjusted from 1 to approx. 33. Do you agree or did I understand this timer stuff completely wrong?
Yes.
It makes little sense to have 32 kHz interrupts on a system that uses polling drivers only.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Committee, n.: A group of men who individually can do nothing but as a group decide that nothing can be done. - Fred Allen