Zephyr (nrf Connect SDK) device tree configuration problem with I2C pins

Hello everyone!

I am developing a prototype custom board with an nrf52840 dongle and some sensors. The first sensor is a bme280 over I2C and there is an example in the sdk. I tested this example before with a nrf52840dk with default configuration and works really well, but on the dongle some necessery pins are missing. I decided to change the sda and scl lines to other gpios which are P0.13 and P0.15, but I only got error which is:
[00:00:00.759,094] <err> i2c_nrfx_twim: Error on I2C line occurred for message 0

If I understand well, this error throwed by the nrfx driver, when semaphore-take timeout occured. I checked with a logic anlyser and the lines ware dead only i could see logical 0 value. So I changed the lines to other ports which are P0.22 and P0.24 which were assigned to uart0 rx and cts pins. I checked these lines with logic analyser again and the communication was good, I saw the scl signals and the address of the bme sensor. I got also an error message, but I think it is only the not found error: (on the board the lines connected to the P0.13 and P0.15)
[00:00:00.269,622] <err> i2c_nrfx_twim: Error 0x0BAE0001 occurred for message 0

I checked the hardver there is no short circuit between the communication lines and the power lines and the pull ups are external resistors with value 4.7k. I changed the dts configuration to the uart tx and rts line and the fault also occured but there the values were  always logical 1.

Overlay file:

&i2c1 {
	status = "okay";
	sda-pin = < 13 >;
	scl-pin = < 15 >;
	compatible = "nordic,nrf-twi";
	bme280@76 {
		status = "okay";
		compatible = "bosch,bme280";
		reg = <0x76>;
		label = "BME280_I2C";
	};
};

&spi1 {
	status = "disabled";
};

&uart0 {
	status = "disabled";
	tx-pin = < 20 >;
	rts-pin = < 17 >;
};
 

configuration file (project.conf)

CONFIG_GPIO=y
CONFIG_SENSOR=y
CONFIG_BME280=y

CONFIG_RTT_CONSOLE=y
CONFIG_USE_SEGGER_RTT=y
CONFIG_BOARD_HAS_NRF5_BOOTLOADER=n

CONFIG_I2C=y
CONFIG_I2C_NRFX=y
CONFIG_NRFX_TWI=y
CONFIG_NRFX_TWI1=y

The code is same as the sensors/bme280 example. 

The log message in the two different cases:
First: P0.13 and P0.15
Second: P0.22 and P0.24

00> [00:00:00.259,002] <dbg> BME280.bme280_chip_init: initializing "BME280_I2C" on bus "I2C_1"
00> [00:00:00.759,094] <err> i2c_nrfx_twim: Error on I2C line occurred for message 0
00> [00:00:00.759,124] <dbg> BME280.bme280_chip_init: ID read failed: -5
00> *** Booting Zephyr OS build v2.6.99-ncs1-1  ***
00> 
00> Error: Device "BME280_I2C" is not ready; check the driver initialization logs for errors.
00> 
00> [00:00:00.269,439] <dbg> BME280.bme280_chip_init: initializing "BME280_I2C" on bus "I2C_1"
00> [00:00:00.269,622] <err> i2c_nrfx_twim: Error 0x0BAE0001 occurred for message 0
00> [00:00:00.269,622] <dbg> BME280.bme280_chip_init: ID read failed: -5
00> *** Booting Zephyr OS build v2.6.99-ncs1-1  ***
00> 
00> Error: Device "BME280_I2C" is not ready; check the driver initialization logs for errors.
00> 


I was debugging this code but I did not figure out more and now I have no idea why this isn't working.

Thank you very much!
Regards,
Mark

Parents Reply Children
No Data
Related