Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

This application note describes how to connect an I2C device to the J1 MicroE Click Connector and enabled the device support in the Linux kernel. The DS1339 Real-Time Clock chip is used to demonstrate this capability.

  1. Connect a DS1339 sensor to the J1 MicroE Click Connector as follows:

    • J1B.9 - GND

    • J1B.12 - SCL

    • J1B.13 - SDA

    • J1A.7 - VCC

  2. Boot the board and check that an I2C device (0x68) is found on Bus I2C2:

    / # i2cdetect -y 2
         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: -- -- -- -- -- -- -- --
  3. Check out the STM32MP1 kernel source code as described in Application Note Building Linux Kernel.

  4. Add a device node description for the DS1339 sensor to the I2C2 node of the device tree (arch/arm/boot/dts/stm32mp157x-bsb.dtsi):

    &i2c2 {                                                                                                                                                                                                    
            pinctrl-names = "default", "sleep";                                                                                                                                                                
            pinctrl-0 = <&i2c2_pins_a>;                                                                                                                                                                        
            pinctrl-1 = <&i2c2_sleep_pins_a>;                                                                                                                                                                  
            i2c-scl-rising-time-ns = <185>;                                                                                                                                                                    
            i2c-scl-falling-time-ns = <20>;                                                                                                                                                                    
            /delete-property/dmas;                                                                                                                                                                             
            /delete-property/dma-names;                                                                                                                                                                        
            status = "okay";                                                                                                                                                                                   
            clock-frequency = <1000000>;                                                                                                                                                                       
    
            ds1339: rtc@68 {                                                                                                                                                                                   
                   compatible = "dallas,ds1339";                                                                                                                                                              
                   reg = <0x68>;                                                                                                                                                                              
                   trickle-resistor-ohms = <250>;                                                                                                                                                             
                   trickle-diode-disable;                                                                                                                                                                     
            };                                                                                                                                                                                                           
    };
  5. Rebuild and update the kernel on the board.

  6. The DS1339 Real-Time Clock chip should be visible as the /dev/rtc1 device in the system.

  • No labels