NRF5340 : Issue in Configuring Non-blocking I2C in Zephyr OS

I'm using the nRF Connect SDK on nrf5340dk and encountering issues when trying to use the non-blocking (asynchronous) I2C API.

i am particularly getting this error -ENOSYS while using this function : i2c_transfer_cb_dt()

When I switch from the blocking API to the non-blocking one, it starts giving errors or unexpected behavior. Could someone please help me understand the correct way to use non-blocking I2C in the SDK?

7851.nrf5340dk_nrf5340_cpuapp.overlay

  • Are there specific configurations or prerequisites required?

  • Any example of correct usage would be really helpful.

Thanks in advance!

  • Hi!

    What NCS version are you using? I think it's only supported in the latest versions

    Might need to add this:

    CONFIG_RTIO=y
    CONFIG_I2C_RTIO=y

  • Hi!

       me too;

       NCS 3.4.0  nrf52840DK

     i2c_transfer_cb_dt()  point NULL 

    config

    CONFIG_USB_DEVICE_STACK_NEXT=y
    CONFIG_CDC_ACM_SERIAL_INITIALIZE_AT_BOOT=n
    CONFIG_USBD_HID_SUPPORT=y

    CONFIG_LOG=y
    CONFIG_USBD_LOG_LEVEL_WRN=y
    CONFIG_USBD_HID_LOG_LEVEL_WRN=y
    CONFIG_UDC_DRIVER_LOG_LEVEL_WRN=y
    CONFIG_SAMPLE_USBD_PID=0x0007

    CONFIG_GPIO=y
    CONFIG_INPUT=y

    CONFIG_I2C=y
    CONFIG_I2C_NRFX=y

    CONFIG_I2C_CALLBACK=y

    CONFIG_RTIO=y
    CONFIG_I2C_RTIO=y

     * Copyright (c) 2023 Nordic Semiconductor ASA
     *
     * SPDX-License-Identifier: Apache-2.0
     */
    &spi1 {
            status = "disabled";
    };

    / {
            hid_dev_0: hid_dev_0 {
                    compatible = "zephyr,hid-device";
                    label = "HID0";
                    protocol-code = "none";
                    in-polling-period-us = <1000>;
                    in-report-size = <64>;
            };

            zephyr,user {
                    //label = "tp_int";
                    tp-int-gpios = <&gpio0 30 GPIO_PULL_UP>;   /* 改用标准属性名 gpios */
            };
    };

    &i2c0 {
            clock-frequency = <DT_FREQ_K(400)>;
            compatible = "nordic,nrf-twim";
            easydma-maxcnt-bits = <16>;
            touchpad: touchpad_amira@2c {
                    compatible = "zephyr,i2c-device";
                    reg = <0x2c>;
            };
    };

    api->transfer_cb == NULL!!!
     could you help me!
    Thinks_——_
Related