I2C not working after update to 2.1.2 (nrf9160dk)

After updating my SDK from 2.0.0 to 2.1.2 the I2C line just gives me the error of:

i2c_nrfx_twim: Error on I2C line occurred for message 0.

I have tried setting up a logic level measurement on it and it does not detect any i2c communication coming from the pins.

The setup:

I am using a NRF9160DK.

From the nrf9160dk_nrf9160_ns.overlay:

&i2c3 {
	clock-frequency = < I2C_BITRATE_STANDARD >;
	status = "okay";
	compatible = "nordic,nrf-twim";
	pinctrl-0 = <&i2c3_default>;
	pinctrl-1 = <&i2c3_sleep>;
	pinctrl-names = "default", "sleep";
};

 &pinctrl {
    i2c3_default: i2c3_default {
		group1 {
            psels = <NRF_PSEL(TWIM_SDA, 0, 30)>,
					<NRF_PSEL(TWIM_SCL, 0, 31)>;
        };
    };

	i2c3_sleep: i2c3_sleep {
		group1 {
            psels = <NRF_PSEL(TWIM_SDA, 0, 30)>,
					<NRF_PSEL(TWIM_SCL, 0, 31)>;
			low-power-enable;
        };
    };
};

From the prj.conf:

# UART interface
CONFIG_SERIAL=y
CONFIG_UART_INTERRUPT_DRIVEN=y

# Use GPIO
CONFIG_GPIO=y
CONFIG_GPIO_NRFX=y
CONFIG_NRFX_GPIOTE=y

# USE I2C
CONFIG_I2C=y
CONFIG_I2C_NRFX=y

# Pin control
CONFIG_PINCTRL=y

The i2c setup:

#define CC_I2C_DEVICE DEVICE_DT_GET_OR_NULL(DT_NODELABEL(i2c3))    //!< The GPIO label.

//! Set up the device for the I2C master.
static const struct device* i2c_master = NULL;

//! Set up the received message buffer.
static uint8_t received_message[CC_I2C_RECEIVE_SIZE];

bool i2c_init_master(void) {

    // Bind the I2C to device.
    i2c_master = CC_I2C_DEVICE;

    // Was the binding a failure?
    if(0 == device_is_ready(i2c_master)) {

        // Inform user of error.
        LOG_ERR("error binding");

        return false;
    }

    return true;
}

The i2c send and read:

void i2c_send_data(const uint16_t station_address, const uint8_t* data_to_device) {

    // Set up the return code variable.
    uint8_t return_code;

    // Write to the I2C device.
    return_code = i2c_write(i2c_master, data_to_device, strlen(data_to_device), station_address);

    // Could the data be send?
    if(CC_FUNCTION_SUCCESS != return_code) {

        // Inform user.
        LOG_ERR("Sent failure");
    }
}

char* i2c_read_data(const uint16_t station_address, const uint32_t return_data_size) {

    // Set up the return code variable.
    uint8_t return_code;

    // Read from I2C device.
    return_code = i2c_read(i2c_master, received_message, return_data_size, station_address);

    // Could the instruction be sent and a instruction be received?
    if(CC_FUNCTION_SUCCESS == return_code) {

        // Return received message.
        return received_message;
    }

    // There was an error in receiving data.
    else {

        // Inform user there was an error.
        LOG_ERR("Unable to receive data, %i", return_code);

        // Return with null.
        return NULL;
    }
}

Everything compiles and runs fine until 2.0.2. at 2.1.0. the error happens.

What have I tried?

- Using i2c1, i2c2 and i2c3.(i2c0 conflicts with uart0)

- Setting up i2c devices and using i2c_dt_spec_get and the sending and reading from i2c_read_dt.

- Creating a custom board, with dts, dtsi, yaml files. 

- Turning other coms off.

- Replacing the new nrf9160dk_nrf9160.dts file folder with one from 2.0.2.

- Setting bias, pull-up in the overlay.

- Deleting the build folder.

- Using other pins for the sda & scl. 

- Using 2 other nrf9160dk kits.

- Using 2 other gpio expanders to communicate with.

- I have tried to look at the device state, address, enable. They are all filled out and looks enabled.

Related