Weird I2C behavior - only P1.4 + P1.5 combination works

Hey folks, I've tried bunch of things but can't make TWIM work properly on nrf54l15-DK outside of that pair of pins.

Basically the issue is that it only works correctly if I use P1.4 and P1.5. If I change 4 to 11 - no luck. If I change 5 to 7 or 10, same. As soon as I change it back everything works perfectly.

Here is the overlay

&i2c20 {
    compatible = "nordic,nrf-twim";
    status = "okay";
    pinctrl-0 = <&i2c20_default>;
    // pinctrl-1 = <&i2c20_sleep>;
    pinctrl-names = "default";
    clock-frequency = <I2C_BITRATE_STANDARD>;
    pcf8574: pcf857x@20 {
        compatible = "nxp,pcf857x";
        status = "okay";
        reg = <0x20>;
        gpio-controller;
        #gpio-cells = <2>;
        ngpios = <8>;
    };
};

.....

i2c20_default: i2c20_default {
        group1 {
            psels = <NRF_PSEL(TWIM_SCL, 1, 11)>,
                    <NRF_PSEL(TWIM_SDA, 1, 5)>;
        };
    };
    
....


In conf file I do have 

CONFIG_I2C=y

and that's it. Do I need to do some NRF specific flags for TWIM to work on other pins? I did hear there could be some issues with them.

Maybe pull ups enabled only on certain pins by default or DK v0.9.3 is wired in some weird way?

Any hints will be appreciated!
  • Hello,

    Basically the issue is that it only works correctly if I use P1.4 and P1.5. If I change 4 to 11 - no luck. If I change 5 to 7 or 10, same. As soon as I change it back everything works perfectly.

    Could you clarify which i2c pins you're referring to here? Is SCL, SDA or both? My guess is that some of them are conflicting with uart20 and/or other peripherals not disabled but still in use on the DK. See for instance the board file for the DK here for uart20: https://github.com/nrfconnect/sdk-zephyr/blob/cb89816c0dd67b9833d78bd55a04ff24a8edcc67/boards/nordic/nrf54l15dk/nrf54l15dk_nrf54l_05_10_15-pinctrl.dtsi#L6-L41 

    For reference, this tool (along with the device tree helper inside the VS Code extension) is highly recommended when setting up peripherals https://pinplanner.app/. The pinplanner is created by a colleague of mine, Helmut.

    I also see that there's a reference in the academy course for I2C which showcases i2c21 on the L15DK: https://github.com/NordicDeveloperAcademy/ncs-fund/blob/main/l6/l6_e1_sol/boards/nrf54l15dk_nrf54l15_cpuapp.overlay 

    Could you let me know about the configuration of your pins, and if consulting the 3 resources I've posted here answers your questions?

    Kind regards,
    Andreas

  • Hey  , those are both pins indeed since one of the pins I did mention is clock pin - that one I do pick as SCL.

    uart20 is disabled tho.

    Here is the expanded overlay:

    &uicr {
        nfct-pins-as-gpios;
    };
    
    &nfct {
        status = "disabled";
    };
    
    &uart20 {
        status = "disabled";
    };
    
    &button0 {
        status = "disabled";
    };
    &button1 {
        status = "disabled";
    };
    &button2 {
        status = "disabled";
    };
    &button3 {
        status = "disabled";
    };
    
    &led0 {
        status = "disabled";
    };
    &led1 {
        status = "disabled";
    };
    &led2 {
        status = "disabled";
    };
    &led3 {
        status = "disabled";
    };
    
    &pwm20 {
        status = "disabled";
    };
    
    
    /delete-node/ &mx25r64;
    
    &i2c20 {
        compatible = "nordic,nrf-twim";
        status = "okay";
        pinctrl-0 = <&i2c20_default>;
        // pinctrl-1 = <&i2c20_sleep>;
        pinctrl-names = "default";
        clock-frequency = <I2C_BITRATE_STANDARD>;
        pcf8574: pcf857x@20 {
            compatible = "nxp,pcf857x";
            status = "okay";
            reg = <0x20>;
            gpio-controller;
            #gpio-cells = <2>;
            ngpios = <8>;
        };
    };
    
    &pinctrl {
        i2c20_default: i2c20_default {
            group1 {
                psels = <NRF_PSEL(TWIM_SCL, 1, 11)>,
                        <NRF_PSEL(TWIM_SDA, 1, 10)>;
            };
        };
    };

    I've tried to use pinplanner indeed, but it's incomplete and a lot of edge cases are missing, so it's not really possible to use it as is (while the combination of pins I do use is valid as per docs and working just fine for SPIM00).

  • Hi,

    UART20 is disabled in dts, yes, but it's still physically connected to the debugger on the DK. You're also going to have to disconnect the debugger within the board configurator (unless you've also done this already)

    The virtual serial ports documentation explains how to use the UART pins for other tasks (p0.00-p0.03 and p1.4-p1.7). 

    Similarly, P1.10 is physically connected to LED1 on the 54L15DK (see the backside of the DK for a easily available map). P1.11 is as far as I can see free to use.

    Kind regards,
    Andreas

  • Hmm, why do you mention UART as an issue? As you could see from the post above P1.4 and P1.5 already work perfectly, so UART is not an issue since it already works on UART pins. Issue is that it does not work on other pins besides 4 and 5.

    P1.10 imo should not be a problem since P1.10 is also routed to the pin header? But anyway, when I use P1.11 it does not work either with P1.5 (but if I switch P1.11 back to P1.4 all works)


  • Den Engineer said:
    Hmm, why do you mention UART as an issue? As you could see from the post above P1.4 and P1.5 already work perfectly, so UART is not an issue since it already works on UART pins

    Because it wasn't clear which pins you were referring to that worked or not at the point of asking the question

    Could you examine/upload the generated pincontrol and dts file to see which pins are already in use by other peripherals?

    Kind regards,
    Andreas

Related