This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi,
In our AM3352 (SYS/BIOS) based application we want to use CLK_M_OSC accurate timing.
is there any way to change the Dmtimer clock source to CLK_M_OSC in the bootloader?
The bootloader stops working if we add the below code in order to change the
clock source to CLK_M_OSC.
HWREG(SOC_CM_DPLL_REGS + CM_DPLL_CLKSEL_TIMER2_CLK) &=
~(CM_DPLL_CLKSEL_TIMER2_CLK_CLKSEL);
while((HWREG(SOC_CM_DPLL_REGS + CM_DPLL_CLKSEL_TIMER2_CLK) &
CM_DPLL_CLKSEL_TIMER2_CLK_CLKSEL) !=
CM_DPLL_CLKSEL_TIMER2_CLK_CLKSEL_CLK_M_OSC);
The bootloader works properly if we remove above code but the timing accuracy is bad
which I believe 32KHz will be used instead of CLK_M_OSC.
Please let me know if there is any reference or any way to change the Dmtimer clock
source in the Bootloader.
Best Regards
Kummi
Kummi,
Please look at the DMtimer2ModuleClkConfig function for reference code to set the clock source to CLK_M_OSC.
HEre is the code that you can try :
/* Clear CLKSEL field of CM_DPLL_CLKSEL_TIMER2_CLK register. */ HWREG(SOC_CM_DPLL_REGS + CM_DPLL_CLKSEL_TIMER2_CLK) &= ~(CM_DPLL_CLKSEL_TIMER2_CLK_CLKSEL); /* Writing to the CLKSEL field of CM_DPLL_CLKSEL_TIMER2_CLK register. */ HWREG(SOC_CM_DPLL_REGS + CM_DPLL_CLKSEL_TIMER2_CLK) |= CM_DPLL_CLKSEL_TIMER2_CLK_CLKSEL_CLK_M_OSC; /* Waiting for the CLKSEL field to reflect the written value. */ while((HWREG(SOC_CM_DPLL_REGS + CM_DPLL_CLKSEL_TIMER2_CLK) & CM_DPLL_CLKSEL_TIMER2_CLK_CLKSEL) != CM_DPLL_CLKSEL_TIMER2_CLK_CLKSEL_CLK_M_OSC);
If this doesn`t work, please read the CLKSEL_TIMER2_CLK register value from Memory browser, and let us know. I am assuming you have unlocked KICK registers and all lock mechanisms that could prevent writes to that register.
Regards,
Rahul
Hi Rahul,
Thank you so much for the information.
I will come back with the CLKSEL_TIMER2_CLK register value,
currently debugging a different application.
Meanwhile, I couldn't find the details about unlocking the KICK registers.
The manual says the KICK registers are for RTC.
Please let me know if there is any reference code for unlocking the registers.
The starterware sample code(like dmtimerCounter.c) don't have code meant for unlocking.
int main(void)
{
DMTimer2ModuleClkConfig();
......
Best Regards
Kummi
Hi Rahul,
Thank you.
One clarification.
As you mentioned KICK registers are for RTC,
but my question is about DMTimer.
Is it required to unlock KICK registers for DMTimer also?
Best Regards
Kummi