[SOLVED] I2C slow

Discussion in 'UDOO NEO' started by Gorgo, Jun 5, 2017.

  1. jas-mx

    jas-mx Active Member

    Joined:
    Dec 31, 2013
    Messages:
    407
    Likes Received:
    118
    Gorgo likes this.
  2. Gorgo

    Gorgo UDOOer

    Joined:
    Nov 9, 2016
    Messages:
    159
    Likes Received:
    17
  3. jas-mx

    jas-mx Active Member

    Joined:
    Dec 31, 2013
    Messages:
    407
    Likes Received:
    118
    In the dts i2c-1 (i2c@021a4000) is still active (status = "okay";) , needs to be disabled. You can disable it manually by changing following in imx6sx-udoo-neo-externalpins.dtsi in your kernel source tree:

    Code:
    &i2c2 {
    status = "disabled";
    };
    
    Then compile imx6sx-udoo-neo-full-hdmi-m4.dtb in the kernel source tree and copy to the overlay directory on your sd card.
     
  4. Gorgo

    Gorgo UDOOer

    Joined:
    Nov 9, 2016
    Messages:
    159
    Likes Received:
    17
    Does it mean that my device tree editor is broken? :( Why?
    In order to change my imx6sx-udoo-neo-externalpins.dtsi, should I recompile all the kernel following THIS?
    So, Changing ~/udoo-dev/linux_kernel/arch/arm/boot/dts/imx6sx-udoo-neo-externalpins.dtsi and then:

    Code:
    ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make zImage -j5
    ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make dtbs -j5
    ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make modules -j5
    cp arch/arm/boot/dts/*.dtb $BOOT_PARTITION/dts-overlay
    Do you confirm?
     
  5. jas-mx

    jas-mx Active Member

    Joined:
    Dec 31, 2013
    Messages:
    407
    Likes Received:
    118
    I don't use device tree editor so I don't.

    You need to do something like this:

    Code:
    ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make dtbs 
    cp arch/arm/boot/dts/imx6sx-udoo-neo-full-hdmi-m4.dtb $BOOT_PARTITION/dts-overlay
     
  6. Gorgo

    Gorgo UDOOer

    Joined:
    Nov 9, 2016
    Messages:
    159
    Likes Received:
    17
    Ok, current status:
    - /dev/i2c-1 doesn't exist now. Correct.
    - Sketch starts everytime without hangs. Perfect
    - I added a delay(2000) between Wire.begin() and bmp.begin(). Without it, it fails getting the starting value and it doesn't detect the sensor. Okay
    - UART6 stops working. Bad I suspect that overwriting the dbs, changed something from @ektor5 's fix (https://www.udoo.org/forum/threads/a9-uart6-and-udoobuntu.3196/page-3#post-25705) or I should reactive it from the dts.
    How? My device tree editor shows the previous settings (UART6 and UART1 enabled). I tried to re-set them, save and reboot, but uart6 is not working (ttymxc5 is missing).
     
  7. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    So a preliminary conclusion could be that detaching I2C-2 from A9 through the device tree editor is not working?
     
  8. jas-mx

    jas-mx Active Member

    Joined:
    Dec 31, 2013
    Messages:
    407
    Likes Received:
    118
    Just enable uart6 in the same dts (imx6sx-udoo-neo-externalpins.dtsi) , eg:

    Code:
    &uart6 {
    ...
    status = "okay";
    } 
     
  9. Gorgo

    Gorgo UDOOer

    Joined:
    Nov 9, 2016
    Messages:
    159
    Likes Received:
    17
    Now /dev/ttymxc5 is up but I can't get data from it.
    Should I fix the kernel with the old .c fix we used to do or should I use ektor5's fix again?
     
  10. jas-mx

    jas-mx Active Member

    Joined:
    Dec 31, 2013
    Messages:
    407
    Likes Received:
    118
    I can't diagnose your problem as there could be numerous reasons for it to occur and I don't know about your kernel fix or environment setup.
     
  11. Gorgo

    Gorgo UDOOer

    Joined:
    Nov 9, 2016
    Messages:
    159
    Likes Received:
    17
    Ok, after some further checks with @ektor5, we blamed the device editor as we said in this topic too.
    The i2c problem was due to the presence of the i2c-2 in M4 and A9 in the same time.

    I flashed a new image, edited the device tree editor removing the i2c-2 and everything worked. No more hangs on Wire library on M4.
    Udoo Team also released a new image (Udoobuntu 2.1.3) with the UART6 patch inside!! :D
    Actually he told me to update+upgrade a new image and everything is working now.
     
    waltervl likes this.

Share This Page