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.

RTOS/AM3352: Trouble accessing RTC registers

Part Number: AM3352

Tool/software: TI-RTOS

yeah me again...

So we have a new custom board and i cannot seem to access the RTC registers

I am trying to use TI RTOS and some custom code to boot this thing

i know i need to turn on the functional clocks in order to access the registers. i see in the integration section of the RTC in the tech manual that the functional clocks are PD_RTC_RTC32KCLK (which doesn't show up anywhere else in the document when you do a search so it's hard to track down) and CLK_32K_RTC

my problem begins with 2 parts and i don't know which is causing which.  when i look at my crystal when i power on my board (no code is loaded in the board) i get no signal.  when i try to enable the clocks using the call:

enableModule(CM_RTC_RTC_CLKCTRL,
CM_RTC_CLKSTCTRL,
CM_RTC_CLKSTCTRL_CLKACTIVITY_L4_RTC_GCLK);

which calls this routine:

void enableModule(volatile U32 *clkCtrlReg, volatile U32 *clkStCtrlReg, U32 clkActMask)
{
/* Enable the module */
*clkCtrlReg = PRCM_MODULEMODE_ENABLE;
/* Check for module enable status */
while(PRCM_MODULEMODE_ENABLE != (*clkCtrlReg & PRCM_MODULEMODE_MASK));
/* Check clock activity - ungated */
while(clkActMask != (*clkStCtrlReg & clkActMask));
/* Check idle status value - should be in functional state */
while((PRCM_MODULE_IDLEST_FUNC << PRCM_IDLE_ST_SHIFT) != (*clkCtrlReg & PRCM_IDLE_ST_MASK));
}

it gets caught up in the last while loop:

while((PRCM_MODULE_IDLEST_FUNC << PRCM_IDLE_ST_SHIFT) != (*clkCtrlReg & PRCM_IDLE_ST_MASK));

and i don't know if the code gets caught up because there is no signal or if there is no signal because the clock isn't enabled. or maybe i am enabling the wrong one first.

so i cannot see or access the RTC registers. when i look at the CM_RTC_CLKSTCTRL register i see the clocks are active and the module is in SW_WKUP. when i look at CM_RTC_CLKCTRL it is in a Trans state and never leaves

my gel file is based on the beagle bone black gel file, and when i emulate on the beagle bone black board using the same code, using the same emulator (i added a jtag header), but with the beagle bone black gel file i get the RTC registers just fine. when i compare our hardware schematics against the beagle bone they are very similar. 

i am thinking that since the beagle bone black board had code on it, it initializes the RTC clocks before i get a chance to emulate on it, and by the time i run my code on it, everything has already been enabled so it seems fine. so i am thinking i am missing something that allows the RTC clock to operate but i cannot figure out what that is

  • The RTOS team have been notified. They will respond here.
  • Is this issue related to the issue that you posted in Nov2016?
    e2e.ti.com/.../555507
  • in a sense yes it is. we have a new board that corrected an issue with the RTC (applying 3.3v to a 1.8v pin) but the same problem remains so fixing the voltage level at that pin didn't fix what we were hoping it would. i am back to thinking maybe it's a software issue since out RTC circuitry looks a lot like the beagle bone black and i know that works.
  • it appears that my core m4 clock (200MHz) is gated (ST_HSDIVIDER_CLKOUT1) is gated, but the GATE_CTRL is set to CLK_AUTOGATE, i theorize that this is why i can't access my registers.

    my values are (with a 19.2MHz part)
    N = 38
    M = 2031

    M4 = 10
    M5 = 8
    M6 = 4

    are there any problems with these values? is there a reason why this clock is gated when i am obviously trying to use it? what do i have to do to ungate the clock? in the clock tree tool it always just shows up as ungated

  • It is best to try to test this with the steps shown in section '20.3.4 Use Cases' of the TRM, but it looks like you can't even get past step1.  Once you enable the clocks to the RTC module, you should at least be able to open up a memory window and see the contents on the RTC module.  Since you can't, i'm wondering if you have a issue powering the RTC module on your board.  

    Take a look at the RTC section of the schematic checklist

    and see if you have everything connected correctly.  The table describes the relevant signals for RTC and how they are connected (based on your use case). 

    Regards,

    James

  • thank you for verifying i did not miss something in software.

    it looks like we were using the wrong column in the schematic checklist. we did not connect the cap line to Vcore, once that connection was made i was able to activate the clocks without issue and i can see the registers now. thank you