This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrfx_twim_init 0bad0005

Hi all,

I want to use TWIM1 on NRF5340, and I initialize it as follows:

nrfx_twim_t i2c_instance = NRFX_TWIM_INSTANCE(1);
nrfx_twim_config_t i2c_config = NRFX_TWIM_DEFAULT_CONFIG(I2C_SCL_PIN, I2C_SDA_PIN);
......

err = nrfx_twim_init(&i2c_instance, &i2c_config, i2c_handler, NULL);
    if (err != NRFX_SUCCESS) {
            LOG_ERR("nrfx_gpiote_init error: %08x", err);
            return EXIT_FAILURE;
        }

But the return value of err is 0x0bad0005,

I guess may be TWIM1 is occupied by zephyr, because in zephyr.dts:

i2c1: i2c@9000 {
				#address-cells = < 0x1 >;
				#size-cells = < 0x0 >;
				reg = < 0x9000 0x1000 >;
				clock-frequency = < 0x186a0 >;
				interrupts = < 0x9 0x1 >;
				status = "okay";
				label = "I2C_1";
				compatible = "nordic,nrf-twim";
				sda-pin = < 0x22 >;
				scl-pin = < 0x23 >;
			};

So how to disable i2c1 in zephry? Or maybe there is another reason for this issue?

Please give me some advice, thank you!

Related