NRF5340 I2C Pins

Hi everyone I am currently trying to connect some simple sensors using the I2C interface.

Currently I am working with an nRF5340 and nRFC 1.6.1 SDK

I loaded one of the samples using the FXAS21002 module.

Everything works fine on i2c1 when using the dedicated pins i.e.P1.02 <34> and P1.05 <35>.

For testing I tried using some other pins let's say P1.14 <46> and P1.15 <47> and this is the overlay I am using

&i2c1 {
    compatible = "nordic,nrf-twim";
	status = "okay";

	scl-pin = <46>; //p1.14
	sda-pin = <47>; //p1.15

	// sda-pin = <35>;
	// scl-pin = <34>;

    clock-frequency = <I2C_BITRATE_STANDARD>;  
	
	
	fxas21002@21 {
		compatible = "nxp,fxas21002";
		status = "okay";
		reg = <0x21>;
		label = "FXAS21002";
		
	};
};

and for the project file

CONFIG_STDOUT_CONSOLE=y
CONFIG_LOG=y
CONFIG_I2C=y
#CONFIG_NRFX_TWIM1=y
CONFIG_SENSOR=y
CONFIG_FXAS21002=y
CONFIG_SENSOR_LOG_LEVEL_DBG=y
#CONFIG_FXAS21002_TRIGGER_OWN_THREAD=y
CONFIG_CBPRINTF_FP_SUPPORT=y

CONFIG_I2C_NRFX=y

Is it generally possible to use other gpios for I2C? Reading around the answered question it certainly seems that way.

When I use the default pins from the sample everything works fine, also tried a BME280 sensor, no issues at all.

According to other answers the overlay should do the trick to change/declare the proper pins to be used.

AM I missing something in the settings?

Parents
  • Okay guys sorry about the no communication on the I2C pins, I can get the address sent message from the board.

    Apparently it's the module that is not replying back?

    On the console I am getting the following:

    i2c_nrfx_twim: Error 0x0BAE0001 occurred for message 0

    and after some looking around the error is associated with:

    NRFX_ERROR_DRV_TWI_ERR_ANACK    = (NRFX_ERROR_DRIVERS_BASE_NUM + 1),

    from the following nordic file:

    nrfx_errors.h

    But then again I do not understand why it's functioning properly on the other 2 pins.

    Is the sample only supposed to work on pins 34-35?

    But then again there's the overlay file which overrides the pin settings.

  • Hi,

    Can you double check with the logical analyzer that the nRF5340 sends out the same address in both cases? NRFX_ERROR_DRV_TWI_ERR_ANACK is returned by slave if it doesn't acknowledge the address.

    regards

    Jared 

Reply Children
No Data
Related