Problem configuring TWI (I2C) interface

Hello,

I'm trying to configure the TWIM for a nRF52832 microcontroller. I have created the following *overlay file:

&i2c1 {										/* a */
	compatible = "nordic,nrf-twim";			/* b */
	status = "okay";						/* c */
	clock-frequency = <100000>;				/* d */

	twis_device1:nRF52832@40004000 {				/* e */
		// device compatible				/* f */
		label = "i2c nRF52832 addr 0x28";	/* g */
       	reg = <0x40004000>;						/* h */
   	};
};	

I have the following error in line "e" ('twis_device1:nRF52832@40004000'):

Node nRF52832 should have "compatible" property
Node should only occur on the undefined bus.
/soc/i2c@40004000/nRF52832@40004000/

And after a build I get the following error:

/ncs/central_uart/build/zephyr/include/generated/devicetree_generated.h:12568:37: error: 'DT_N_S_soc_S_i2c_40004000_P_sda_pin' undeclared (first use in this function); did you mean 'DT_N_S_soc_S_i2c_40004000_P_status'?
12568 | #define DT_N_NODELABEL_i2c1         DT_N_S_soc_S_i2c_40004000

Could you please explain me what I'm not configuring correctly and how to solve it? Thanks for your attention.

Parents Reply Children
  • At the moment I am not able to reproduce the error you are seeing.

    Could you try adding this to the overlay?

    &spi1 {
        status = "disabled";
    };

    If that does not work, could you please show me the prj.conf file? Do you have CONFIG_I2C=y ?

    Which board are you building for, and are you able to reproduce this error on the hello_world sample?

  • I still have the same error. Below the prj.conf file:

    #
    # Copyright (c) 2018 Nordic Semiconductor
    #
    # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
    #
    
    # Enable the UART driver
    CONFIG_UART_ASYNC_API=y
    CONFIG_NRFX_UARTE0=y
    CONFIG_SERIAL=y
    CONFIG_CONSOLE=y
    CONFIG_UART_CONSOLE=y
    
    # Enable the BLE stack with GATT Client configuration
    CONFIG_BT=y
    CONFIG_BT_CENTRAL=y
    CONFIG_BT_SMP=y
    CONFIG_BT_GATT_CLIENT=y
    
    # Enable the BLE modules from NCS
    CONFIG_BT_NUS_CLIENT=y
    CONFIG_BT_SCAN=y
    CONFIG_BT_SCAN_FILTER_ENABLE=y
    CONFIG_BT_SCAN_UUID_CNT=1
    CONFIG_BT_SCAN_ADDRESS_CNT=1
    CONFIG_BT_GATT_DM=y
    CONFIG_HEAP_MEM_POOL_SIZE=2048
    CONFIG_BT_MAX_PAIRED=1
    CONFIG_BT_MAX_CONN=1
    
    # This example requires more workqueue stack
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
    
    # Enable bonding
    CONFIG_BT_SETTINGS=y
    CONFIG_FLASH=y
    CONFIG_FLASH_PAGE_LAYOUT=y
    CONFIG_FLASH_MAP=y
    CONFIG_NVS=y
    CONFIG_SETTINGS=y
    
    # Enable use of the non-minimal C functionality (stdio.h).
    CONFIG_NEWLIB_LIBC=y
    
    # Config logger
    CONFIG_LOG=y
    CONFIG_USE_SEGGER_RTT=y
    CONFIG_LOG_BACKEND_RTT=y
    CONFIG_LOG_BACKEND_UART=y
    CONFIG_LOG_PRINTK=n
    CONFIG_BT_DEBUG_LOG=y
    CONFIG_BT_GATT_DM_DATA_PRINT=y
    
    CONFIG_ASSERT=y
    
    # Config I2C
    CONFIG_GPIO=y
    CONFIG_I2C=y
    CONFIG_I2C_NRFX=y
    
    CONFIG_SHELL=y
    CONFIG_I2C_SHELL=y

    I'm building the project for an nRF52832.

  • Hello,

    I come back to this subject as I still have problems to configure the I2C interface. Is there any parameter I'm missing?

Related