i2c RTC on 0x68 can find in system



  • Hi!
    Can you help me to add i2c RTC to system?
    I add DTS string to ./build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/linux-4.14.81/arch/mips/boot/dts/ralink//mt7628a.dtsi

            i2c0: i2c@10000900 {
                            compatible = "mediatek,mt7621-i2c";
                            reg = <0x10000900 0x50>;
                            #address-cells = <1>;
                            #size-cells = <0>;
                            status = "okay";
             };
    

    and to build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/linux-4.14.81/arch/mips/boot/dts/ralink/omega2p.dts

    &i2c0 {
            status = "okay";
    
            rtc@68 {
                    compatible = "st,m41t80";
                    reg = <0x68>;
            };
    

    In kernel modulas enable

    CONFIG_RTC_DRV_M41T80=y
    CONFIG_RTC_DRV_M41T80_WDT=y
    CONFIG_I2C_RALINK=y
    

    Build complite succesfuly without errors but on system i can't find /dev/rtc0 and watchdog
    In system i can see

    root@Omega-61B6:/# i2cdetect -y 0
         0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
    00:          -- -- -- -- -- -- -- -- -- -- -- -- --
    10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
    70: -- -- -- -- -- -- -- --
    root@Omega-61B6:/# i2cdetect -l
    i2c-0   i2c             10000900.i2c                            I2C adapter
    root@Omega-61B6:/#
    


  • I'm interesting in this too and how make kernel_menuconfig works because I heard it doesn't work well - devices are not present after, such as TFTs, I2S codecs, RTCs.

    Please execute the command

    lsmod | grep m41t80


  • I think you should correct DTS from example below if you need watchdog
    .../rtc/rtc-m41t80.txt

    And as last resort you can take my user-space rtc application liburtc as a template to append your chip into.



  • @Modest-Polykarpovich I have made changes as write .../rtc/rtc-m41t80.txt

    &i2c0 {
            status = "okay";
    
            rtc@68 {
                    compatible = "st,m41t80";
                    reg = <0x68>;
                    interrupt-parent = <&UIC0>;
                    interrupts = <0x9 0x8>;
            };
    };
    

    no rows on lsmod | grep m41t80



  • I have compile as module rtc-m41t80
    then find it at

    ./build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/linux-4.14.81/drivers/rtc/rtc-m41t80.ko
    

    and copy to omega and add it. Now a can see it but no /dev/rtc0 ...

    root@Omega-61B6:/lib/modules/4.14.81# lsmod | grep m41t
    rtc_m41t80              8704  0
    root@Omega-61B6:/lib/modules/4.14.81# modprobe rtc_m41t80
    rtc_m41t80 is already loaded
    


  • @Moonshiner said in i2c RTC on 0x68 can find in system:

    and copy to omega and add it. Now a can see it but no /dev/rtc0 ...

    rtc_m41t80 is already loaded
    

    System programming is not for us mere mortals. Leave your ideas and hopefulness, have a cup of beer and take a break.
    You have to know, Omega has limitations with difficult OS, if you need more hardware to operate, look for ESP32, ESP8266 solutions.

    Why you need watchdog that's only need for industrial projects, Omega built for home using. OpenWRT have not industrial standard. You can make external resetter for Omega when it get freeze and flashing LED will stop.

    Don't freeze yourself, move on and make&take simpler tasks.



  • @Modest-Polykarpovich we wont to build industrial product more then 1000 p.
    It will be very unfortunate that I made a mistake in choosing Omega.It's whery like me )
    but from another side i think that many other project build on openwrt and it works normaly in industrial. And now i don't know whats i must thinking...
    If we can't resolve this problem and no support from manufacture i must to resolve it by another way, unfortunately.
    May be we must to change platform to somethink else... orangePi, nanoPi..



  • @Moonshiner said in i2c RTC on 0x68 can find in system:

    May be we must to change platform to somethink else... orangePi, nanoPi..

    Yes that's good Idea, debian's type OS' have *-kernel-headers to compile dynamical kernel modules. The driver's subsystem in Linux is very inconvenient at all as compared with Windows.
    I think you encounter many hardware problems there, like Interrupts, DMA, memory management, kernel-space coding etc. If you no-system coder, don't start to be one.

    OrangePi computers are very fast for a simple projects, I prefer C++ language, programs work too fast )). I choose Omega by the lowest prize and stable OpenWRT OS in. Last time I used to MCUs only, but they are poor for multimedia projects (TFT-diaplays, sound, touchscreen input) or database using (SQLite), also mini-computers allow service tools inside and third-party packages. But they have difficult way to append any hardware driver. In fact a hobbyist can only use system "in-box", I mean that's already not very bad.

    I think Omega should upgrade board Dash to Dash2, with the next hardware on:

    • support some SPI displays (like 2.4"...3.5") and Qt library (package)
    • support set of touchscreen drivers for the displays set
    • sound (the best is codec WM8960 with microphone),
    • rtc
    • Ethernet connector with PoE (external shield).
    • (external shield) USB-hub with 3-4 connectors (one slot must be always free for service using).
    • (external shield) PCI-E controller SATA for 2.5" hard drives.

    There is base powerfull computer board for the most multimedia projects.



  • @Moonshiner, I figured out in part of this and appended kmod-rtc-pcf8563.ko; NXP PCF8563 based address 0x51. First I've got next kernel message, please compare below:

     root@Omega-D913:/# dmesg | grep rtc
    [    0.615614] hctosys: unable to open rtc device (rtc0)
    

    Next I appended device manually:

    echo pcf8563 0x51 > /sys/class/i2c-dev/i2c-0/device/new_device
    

    Then you will see /dev/rtc0 device.

    Next creating default RTC symlink:

    cd /dev
    ln -s rtc0 rtc
    

    and...

    hwclock -r
    Sun Jul  5 19:50:44 2020  0.000000 seconds
    

    It's works!
    But this procedure we must do for each loading.


    Driver works well, we have errors in OMEGA2[P].dts file, something wrong there.



  • @Modest-Polykarpovich I tried but the device did not appear in /dev/

    echo rtc_m41t80 0x68 > /sys/class/i2c-dev/i2c-0/device/new_device
    

    dmesg show

    [  152.302693] i2c i2c-0: new_device: Instantiated device rtc_m41t80 at 0x68
    root@Omega-61B6:/# lsmod | grep 41t8
    rtc_m41t80              8704  0
    root@Omega-61B6:/# i2cdump -y -f -r 0-6 0 0x68 c
         0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
    00: 00 ff ff 7f 07 3f 1f                               ...????
    

Log in to reply
 

Looks like your connection to Community was lost, please wait while we try to reconnect.