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.

AM3354: RTC control register issue in U-boot

Part Number: AM3354

I have a strange problem. I am trying to get the RTC clock running but it does not always start. On some boards it starts fine, no others it does not. I examined the registers in u-boot and found that the initial values(after reset) where different between different boards. how can this be?

In order to better understand what happens, i removed the RTC initialization code from u-boot and booted to a prompt. This is what I got. 

Board 1: 

=> md 44e3e040 1 ; md 44e3e044 1 ; md 44e3e054 1
44e3e040: 00000040 @...
44e3e044: 00000000 ....
44e3e054: 00000010 ....

As you can see, the RTC_CTRL_REG(44e3e040) register as bit 6 set to 1 which is RTC_DISABLE. And according to the documentation , clearing this bit result in unexpected behaviour, RTC_CTRL_REG should be 0 on reset.

Board 2: 

Using the same bootloader as for board 1 I get

=> md 44e3e040 1 ; md 44e3e044 1 ; md 44e3e054 1
44e3e040: 00000000 ....
44e3e044: 00000000 ....
44e3e054: 00000010 ....

This is as expected.  All values according to the specs. 

I would appreciate any comments that could help me understand this. 

I use U-Boot 2017.01 with some patches

CPU  : AM335X-GP rev 2.1

BR

Andreas

  • Part Number: AM3354

    The RTC clock behaves strange. On some boards, everything works fine. but on some boards, the RTC clock does not start properly during startup. I does however seem to start if I juggle the RTC_CTRL_REG register a bit. 

    The RTC in not initialized at startup as we can see.

    => md 44e3e040 1 ; md 44e3e044 1 ; md 44e3e054 1
    44e3e040: 00000000 ....
    44e3e044: 00000000 ....
    44e3e054: 00000010 ....

    Now, select internal clock and  RUN=1

    => mw 44e3e054 0x40; mw 44e3e040 1;
    => md 44e3e040 1 ; md 44e3e044 1 ; md 44e3e054 1
    44e3e040: 00000001 ....
    44e3e044: 00000000 ....
    44e3e054: 00000040 @...

    As we cal see, the RTC_STATUS_REG (44e3e044) is 0 which means the RTC os not running

    Fiddle with the RTC_CTRL_REG :
    => mw 44e3e054 50 ; mw 44e3e054 0x40
    => md 44e3e040 1 ; md 44e3e044 1 ; md 44e3e054 1
    44e3e040: 00000001 ....
    44e3e044: 00000002 ....
    44e3e054: 00000040 @...

    And now RTC is running! RTC_STATUS_REG = 2

    I must be missing something, if someone could give me some useful info about this I would appreciate it.

    BR
    Andreas

  • Hello Andreas,

    By default, the BBB is configured as follows:

    When I read the register "RTC_OSC_REG", it returns the value of 0x48 (external clock). I am wondering if you could please share your setup and any software changes relevant to the RTC.

    Regards,

    Krunal

  • Hello Krunal

    Yes, you are right. The BBB uses an external 32Khz crystal as clock source for the RTC. 

    However, in hour design, we we use internal PRCM clock as input the the RTC module. We have followed the design guidlines in the documentaition for how you shall connect the pins for that to work. The reason you get 0x48 in RTC_OSC_REG is because you have selected the exterrnal clock as source. I have 0x40 because I have the internal clock source selcted. I do not have access to the schematic today, I can get back to you about that.

  • Hello Andreas,

    I am wondering if you have any updates with regards to your RTC issues.

    Regards,
    Krunal