Porting nRF52840DK code to custom board issues!

Greetings,

I recently started working with the NCS and successfully modified the peripheral_uart sample to read data form an I2C sensor and send it via BLE

I wanted to make a brand new project using this code for the development phase of our newest FW for our product so I created an new application and then copied and pasted the source files as well as the CMakeLists.txt, prj.config, app.overlay files to the new directory. 

The build (with nRF52840DK_nRF52840 board configuration as in the first sample I used) was successful and everything looked normal.

The next step was to create the custom board of our product which also had a successful build.

After modifying the .dts to include the i2c (same as in my first attempt) and adding the pinctrl.dtsi file by adding the following code:

.dts file snippet added

&i2c0 {
	compatible = "nordic,nrf-twi";
	status = "okay";
	pinctrl-0 = <&i2c0_default>;
	pinctrl-1 = <&i2c0_sleep>;
	pinctrl-names = "default", "sleep";
};

xxxxxx-pinctrl.dtsi

	i2c0_default: i2c0_default {
		group1 {
			psels = <NRF_PSEL(TWIM_SDA, 0, 6)>,
				<NRF_PSEL(TWIM_SCL, 0, 5)>;
				/* bias-pull-up; */ //Vital for I2C to work properly
		};
	};

	i2c0_sleep: i2c0_sleep {
		group1 {
			psels = <NRF_PSEL(TWIM_SDA, 0, 6)>,
				<NRF_PSEL(TWIM_SCL, 0, 5)>;
				/* bias-pull-up; */
			low-power-enable;
		};
	};

The building process halted with the error:

C:\ncs\v2.1.0\zephyr\include\zephyr\toolchain\gcc.h:77:36: error: static assertion failed: "/soc/i2c@40003000 defined without required pin configuration"
   77 | #define BUILD_ASSERT(EXPR, MSG...) _Static_assert(EXPR, "" MSG)
      |                                    ^~~~~~~~~~~~~~
c:\ncs\v2.1.0\zephyr\soc\arm\nordic_nrf\common\soc_nrf_common.h:218:2: note: in expansion of macro 'BUILD_ASSERT'
  218 |  BUILD_ASSERT((IS_ENABLED(CONFIG_PINCTRL) &&   \
      |  ^~~~~~~~~~~~
C:\ncs\v2.1.0\zephyr\drivers\i2c\i2c_nrfx_twi.c:297:2: note: in expansion of macro 'NRF_DT_CHECK_PIN_ASSIGNMENTS'
  297 |  NRF_DT_CHECK_PIN_ASSIGNMENTS(I2C(idx), 1, scl_pin, sda_pin);        \
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\ncs\v2.1.0\zephyr\drivers\i2c\i2c_nrfx_twi.c:342:1: note: in expansion of macro 'I2C_NRFX_TWI_DEVICE'
  342 | I2C_NRFX_TWI_DEVICE(0);
      | ^~~~~~~~~~~~~~~~~~~
C:\ncs\v2.1.0\zephyr\include\zephyr\toolchain\gcc.h:77:36: error: static assertion failed: "/soc/i2c@40003000 has pinctrl states defined although PINCTRL is not enabled"

Do I need to somehow enable PINCTRL as the message says ?

How is this done?

Thank you very much for your time,

Best regards,

Stavros

Parents Reply Children
No Data
Related