Jump to content

Arjan van Vught

Members
  • Posts

    13
  • Joined

  • Last visited

Posts posted by Arjan van Vught

  1. 1 hour ago, gounthar said:

    But if I was to design a very simple hat, what would be needed ? 

    Thanks. 

    This topic is about the missing RTC crystal on the OPi board. And therefore we cannot use the RTC in the SoC.

     

    When you would like to build an expansion board then for examples; check the dataset for: DS3231 or Google for: rtc i2c board 

  2. 24 minutes ago, gounthar said:

    What would we need besides a crystal to get a RTC hat to work with the Orange Pi Zero?
    Thanks.

    When there is a crystal placed on the OPi board itself,  then there is no need for a hat.

    Of course, we also need a proper battery connector -> removing the WiFi chip for making some space.

  3. 15 minutes ago, martinayotte said:

    .. drifts are seen only on H3 but not on H5 ...

    Also, the H3 RTC drift is late/slow compared to H2+ of the OPiZero previously tested which were ahead/fast.

    That's a shame as I am using the Orange Pi Zero LTS 256MB and the Orange Pi One boards only. I will try to contact Steven and ask if it is doable getting the external 32768 crystal on the(se) H2+/H3 boards.

  4. See the remarkable output below. Many observations and some questions:

    • The internal RTC seems to be useless with the internal OSC.
    • The internal RTC gets updated; once every ? seconds. From which source?
    • What is the source for the date command? Specific which ARM Counter or with SoC Timer?
    • This test is with an Internet connection; hence the system clock gets updated with the NTP Client. Interesting to know what happens with no Internet connection.
    Quote

    pi@orangepizero:~$ sudo ./rtc_test.sh

    17:00:39

    17:00:21

    ==============

    17:02:47

    17:02:21

    ==============

    17:04:55

    17:04:21

    ==============

    17:07:04

    17:06:21

    ==============

    17:08:25

    17:08:21

    ==============

    17:10:34

    17:10:21

    ==============

    17:12:42

    17:12:21

    ==============

    17:14:51

    17:14:21

    ==============

     

    pi@orangepizero:~$ cat ./rtc_test.sh 
    while true
    do
            ./devmem2 0x01f00014 | tail -n 1 |rev|cut -f1 -d' '|rev | ./convert
            echo `date +"%H:%M:%S"`
            echo ==============
            sleep 120
    done
    /*
     * convert.c
     */
    
    #include <stdio.h>
    #include <stdlib.h>
    
    #define TIME_GET_SEC_VALUE(x)			((x) & 0x0000003f)
    #define TIME_GET_MIN_VALUE(x)			(((x) & 0x00003f00) >> 8 )
    #define TIME_GET_HOUR_VALUE(x)			(((x) & 0x001f0000) >> 16)
    
    int main(void) {
    	unsigned num;
    	fscanf(stdin, "%x", &num);
    	printf("%.2d:%.2d:%.2d\n", TIME_GET_HOUR_VALUE(num), TIME_GET_MIN_VALUE(num), TIME_GET_SEC_VALUE(num));
    	return EXIT_SUCCESS;
    }

     

  5. 4 minutes ago, martinayotte said:

    hat is not really a good way to test, since your loop is a bit more than 1 second due to execution of previous lines.

    Therefore I am also showing the seconds from the date command. I will do another test. However, the apt update/upgrade I just did, it broke the startup. 

  6. Simple test

    pi@orangepizero:~$ cat ./rtc_test.sh
    while true
    do
            ./dev2mem 0x01f00014 | tail -n 1
            echo `date +"%S"`
            sleep 1
    done

     

    pi@orangepizero:~$ sudo ./rtc_test.sh

    Value at address 0x1F00014 (0xb6ff7014): 0xF162D

    22

    Value at address 0x1F00014 (0xb6f63014): 0xF162E

    23

    Value at address 0x1F00014 (0xb6f09014): 0xF162F

    24

    Value at address 0x1F00014 (0xb6f4a014): 0xF1630

    25

    Value at address 0x1F00014 (0xb6f9f014): 0xF1632

    26

    Value at address 0x1F00014 (0xb6f0a014): 0xF1633

    27

    Value at address 0x1F00014 (0xb6ffb014): 0xF1634

    28

    Value at address 0x1F00014 (0xb6f8b014): 0xF1635

    29

    ^C

     

    Skipping a second here. 

     

    Quote

    pi@orangepizero:~$ cat /etc/armbian-release

    # PLEASE DO NOT EDIT THIS FILE

    BOARD=orangepizero

    BOARD_NAME="Orange Pi Zero"

    BOARDFAMILY=sun8i

    BUILD_REPOSITORY_URL=https://github.com/armbian/rkbin

    BUILD_REPOSITORY_COMMIT=3e533c9

    DISTRIBUTION_CODENAME=buster

    DISTRIBUTION_STATUS=supported

    VERSION=20.02.1

    LINUXFAMILY=sunxi

    BRANCH=current

    ARCH=arm

    IMAGE_TYPE=stable

    BOARD_TYPE=conf

    INITRD_ARCH=arm

    KERNEL_IMAGE_TYPE=Image

     

  7. 8 minutes ago, martinayotte said:

    but "devmem2 0x01f00004" (the LOSC_AUTO_SWT_STA_REG) report 0x4, where LOSC_SRC_SEL_STA status bit is 0 meaning InternalOSC.

    So the check here https://github.com/armbian/linux/blob/sun8i/drivers/rtc/rtc-sunxi.c#L512 is basically wrong. The CTRL tells what has been set, and then AUTO_STA really tells the status.

     

    And the RTC goes into default internal with prescaler 0xF -> 16 MHz / 32 / 15 that is about 33KHz. Which is slightly faster than the desired 32768 Hz. 

  8. 4 minutes ago, martinayotte said:

    RTC is by default set to run with internal OSC, so no need for external one.

    The internal clock (which is about 16MHz) does not give an accurate reference. So I did not try to use that option.

    I will check your source code for the configuration.

     

    6 minutes ago, martinayotte said:

    How did you check that ?

    Just reading the register directly and printing the value when the seconds have changed.

  9. Dear forum,

     

    When looking at the Orange Pi Zero schematic V1.1, the OSC-RTC box is empty. Does this mean that there is no crystal for the internal RTC? The internal RTC cannot be used at all?

     

    When just checking the time register, the RTC is running too fast.

     

    Thanks, Arjan

×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines