This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to use I2C with Thingy91 to get the sensor data from MPU9250 data?

Hi There,

So I get the Data from MPU9250 to nRF9160 DK with This Example  zephyr/tree/master/samples/sensor/mpu6050 

just want to know how to do it with Thingy91 I try with TP9 and TP10 define in overlay file but shows this error.

Š*** Booting Zephyr OS build v2.4.0-ncs1-1710-g5a7b4eb71047  ***


Failed to find sensor MPU6050

This is the Overlay file

/*
 * Copyright (c) 2019 Nordic Semiconductor ASA
 *
 * SPDX-License-Identifier: Apache-2.0
 */

&i2c2 {
	compatible = "nordic,nrf-twim";
	status = "okay";
	scl-pin = <9>;
	sda-pin = <10>;
	mpu6050@68 {
		compatible = "invensense,mpu6050";
		reg = <0x68>;
		status = "okay";
		label = "MPU6050";
		int-gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>;
	};
};

Parents
  • Hi,

    Try adding this to the overlay:

    &spi3 {
    	adxl362@0 {
    		status = "disabled";
    		/delete-property/ int1-gpios;
    	};
    };

    If that doesn't work, try using P0.12 instead of P0.09.

    Also, which version of NCS are you using?

  • Hi ,

    Thanks for the reply,

    I tried like adding above line into thingy91_nrf9160ns.overlay and also try with pin 12 instead of 9 but error facing is Failed to find sensor mpu6050.

    and I tried with both version like NCS 1.6.0 and NCS 1.44.9 

    I just want to get data from my MPU sensor to thingy91.

    Thanks & Regards
    Jaydip Kavaiya

  • Hi again, and thank you for your patience.

    Could you add these to your prj.conf file?

    CONFIG_LOG=y
    CONFIG_LOG_DEFAULT_LEVEL=4

    Does it show any new error messages?

  • Hi ,

    Thanks for the reply.

    So tried to Adding this line to prj.config file and get this error,

    and also again I confirm my connection and overlay file with you

    /*
     * Copyright (c) 2019 Nordic Semiconductor ASA
     *
     * SPDX-License-Identifier: Apache-2.0
     */
    
    
    &i2c2 {
    	compatible = "nordic,nrf-twim";
    	status = "okay";
    	scl-pin = <12>;
    	sda-pin = <10>;
    	mpu6050@68 {
    		compatible = "invensense,mpu6050";
    		reg = <0x68>;
    		status = "okay";
    		label = "MPU6050";
    		int-gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>;
    	};
    };
    
    &spi3 {
    	adxl362@0 {
    		status = "disabled";
    		/delete-property/ int1-gpios;
    	};
    };
    

    thingy91_nrf9160ns.overlay

    and prj.conf file is

    #
    # Copyright (c) 2019 Nordic Semiconductor ASA
    #
    # SPDX-License-Identifier: Apache-2.0
    #
    
    CONFIG_LOG=y
    CONFIG_LOG_DEFAULT_LEVEL=4
    CONFIG_I2C=y
    CONFIG_SENSOR=y
    CONFIG_MPU6050=y
    CONFIG_MPU6050_TRIGGER_NONE=y
    CONFIG_CBPRINTF_FP_SUPPORT=y
    
    

    and this the error I got 

    Thanks
    Jaydip

    2021-08-23T17:32:04.777Z DEBUG modem << *** Booting Zephyr OS build v2.6.0-rc1-ncs1  ***
    2021-08-23T17:32:05.361Z DEBUG modem << Flash regionsDomainPermissions
    2021-08-23T17:32:05.398Z DEBUG modem << 00 01 0x00000 0x10000 Securerwxl
    2021-08-23T17:32:05.402Z DEBUG modem << 02 31 0x10000 0x100000 Non-Securerwxl
    2021-08-23T17:32:05.404Z DEBUG modem << Non-secure callable region 0 placed in flash region 1 with size 32.
    2021-08-23T17:32:05.550Z DEBUG modem << SRAM regionDomainPermissions
    2021-08-23T17:32:05.616Z DEBUG modem << 00 07 0x00000 0x10000 Securerwxl
    2021-08-23T17:32:05.620Z DEBUG modem << 08 31 0x10000 0x40000 Non-Securerwxl
    2021-08-23T17:32:05.623Z DEBUG modem << PeripheralDomainStatus
    2021-08-23T17:32:05.625Z DEBUG modem << 00 NRF_P0               Non-SecureOK
    2021-08-23T17:32:05.627Z DEBUG modem << 01 NRF_CLOCK            Non-SecureOK
    2021-08-23T17:32:05.630Z DEBUG modem << 02 NRF_RTC0             Non-SecureOK
    2021-08-23T17:32:05.633Z DEBUG modem << 03 NRF_RTC1             Non-SecureOK
    2021-08-23T17:32:05.634Z DEBUG modem << 04 NRF_NVMC             Non-SecureOK
    2021-08-23T17:32:05.636Z DEBUG modem << 05 NRF_UARTE1           Non-SecureOK
    2021-08-23T17:32:05.637Z DEBUG modem << 06 NRF_UARTE2           SecureSKIP
    2021-08-23T17:32:05.640Z DEBUG modem << 07 NRF_TWIM2            Non-SecureOK
    2021-08-23T17:32:05.642Z DEBUG modem << 08 NRF_SPIM3            Non-SecureOK
    2021-08-23T17:32:05.643Z DEBUG modem << 09 NRF_TIMER0           Non-SecureOK
    2021-08-23T17:32:05.645Z DEBUG modem << 10 NRF_TIMER1           Non-SecureOK
    2021-08-23T17:32:05.647Z DEBUG modem << 11 NRF_TIMER2           Non-SecureOK
    2021-08-23T17:32:05.656Z DEBUG modem << 12 NRF_SAADC            Non-SecureOK
    2021-08-23T17:32:05.657Z DEBUG modem << 13 NRF_PWM0             Non-SecureOK
    2021-08-23T17:32:05.658Z DEBUG modem << 14 NRF_PWM1             Non-SecureOK
    2021-08-23T17:32:05.661Z DEBUG modem << 15 NRF_PWM2             Non-SecureOK
    2021-08-23T17:32:05.662Z DEBUG modem << 16 NRF_PWM3             Non-SecureOK
    2021-08-23T17:32:05.663Z DEBUG modem << 17 NRF_WDT              Non-SecureOK
    2021-08-23T17:32:05.664Z DEBUG modem << 18 NRF_IPC              Non-SecureOK
    2021-08-23T17:32:05.666Z DEBUG modem << 19 NRF_VMC              Non-SecureOK
    2021-08-23T17:32:05.668Z DEBUG modem << 20 NRF_FPU              Non-SecureOK
    2021-08-23T17:32:05.669Z DEBUG modem << 21 NRF_EGU1             Non-SecureOK
    2021-08-23T17:32:05.672Z DEBUG modem << 22 NRF_EGU2             Non-SecureOK
    2021-08-23T17:32:05.674Z DEBUG modem << 23 NRF_DPPIC            Non-SecureOK
    2021-08-23T17:32:05.712Z DEBUG modem << 24 NRF_REGULATORS       Non-SecureOK
    2021-08-23T17:32:05.714Z DEBUG modem << 25 NRF_PDM              Non-SecureOK
    2021-08-23T17:32:05.716Z DEBUG modem << 26 NRF_I2S              Non-SecureOK
    2021-08-23T17:32:05.718Z DEBUG modem << 27 NRF_GPIOTE1          Non-SecureOK
    2021-08-23T17:32:05.720Z DEBUG modem << SPM: NS image at 0x10000
    2021-08-23T17:32:05.721Z DEBUG modem << SPM: NS MSP at 0x20010d80
    2021-08-23T17:32:05.723Z DEBUG modem << SPM: NS reset vector at 0x132e5
    2021-08-23T17:32:05.725Z DEBUG modem << SPM: prepare to jump to Non-Secure image.
    2021-08-23T17:32:05.726Z DEBUG modem << *** Booting Zephyr OS build v2.6.0-rc1-ncs1  ***
    2021-08-23T17:32:05.728Z DEBUG modem << Failed to find sensor MPU6050
    2021-08-23T17:32:05.729Z DEBUG modem << [00:00:00.000,122] [1;31m<err> i2c_nrfx_twim: Error 0x0BAE0001 occurred for message 0[0m
    2021-08-23T17:32:05.730Z DEBUG modem << [00:00:00.000,152] [1;31m<err> MPU6050: Failed to read chip ID.[0m
    

Reply
  • Hi ,

    Thanks for the reply.

    So tried to Adding this line to prj.config file and get this error,

    and also again I confirm my connection and overlay file with you

    /*
     * Copyright (c) 2019 Nordic Semiconductor ASA
     *
     * SPDX-License-Identifier: Apache-2.0
     */
    
    
    &i2c2 {
    	compatible = "nordic,nrf-twim";
    	status = "okay";
    	scl-pin = <12>;
    	sda-pin = <10>;
    	mpu6050@68 {
    		compatible = "invensense,mpu6050";
    		reg = <0x68>;
    		status = "okay";
    		label = "MPU6050";
    		int-gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>;
    	};
    };
    
    &spi3 {
    	adxl362@0 {
    		status = "disabled";
    		/delete-property/ int1-gpios;
    	};
    };
    

    thingy91_nrf9160ns.overlay

    and prj.conf file is

    #
    # Copyright (c) 2019 Nordic Semiconductor ASA
    #
    # SPDX-License-Identifier: Apache-2.0
    #
    
    CONFIG_LOG=y
    CONFIG_LOG_DEFAULT_LEVEL=4
    CONFIG_I2C=y
    CONFIG_SENSOR=y
    CONFIG_MPU6050=y
    CONFIG_MPU6050_TRIGGER_NONE=y
    CONFIG_CBPRINTF_FP_SUPPORT=y
    
    

    and this the error I got 

    Thanks
    Jaydip

    2021-08-23T17:32:04.777Z DEBUG modem << *** Booting Zephyr OS build v2.6.0-rc1-ncs1  ***
    2021-08-23T17:32:05.361Z DEBUG modem << Flash regionsDomainPermissions
    2021-08-23T17:32:05.398Z DEBUG modem << 00 01 0x00000 0x10000 Securerwxl
    2021-08-23T17:32:05.402Z DEBUG modem << 02 31 0x10000 0x100000 Non-Securerwxl
    2021-08-23T17:32:05.404Z DEBUG modem << Non-secure callable region 0 placed in flash region 1 with size 32.
    2021-08-23T17:32:05.550Z DEBUG modem << SRAM regionDomainPermissions
    2021-08-23T17:32:05.616Z DEBUG modem << 00 07 0x00000 0x10000 Securerwxl
    2021-08-23T17:32:05.620Z DEBUG modem << 08 31 0x10000 0x40000 Non-Securerwxl
    2021-08-23T17:32:05.623Z DEBUG modem << PeripheralDomainStatus
    2021-08-23T17:32:05.625Z DEBUG modem << 00 NRF_P0               Non-SecureOK
    2021-08-23T17:32:05.627Z DEBUG modem << 01 NRF_CLOCK            Non-SecureOK
    2021-08-23T17:32:05.630Z DEBUG modem << 02 NRF_RTC0             Non-SecureOK
    2021-08-23T17:32:05.633Z DEBUG modem << 03 NRF_RTC1             Non-SecureOK
    2021-08-23T17:32:05.634Z DEBUG modem << 04 NRF_NVMC             Non-SecureOK
    2021-08-23T17:32:05.636Z DEBUG modem << 05 NRF_UARTE1           Non-SecureOK
    2021-08-23T17:32:05.637Z DEBUG modem << 06 NRF_UARTE2           SecureSKIP
    2021-08-23T17:32:05.640Z DEBUG modem << 07 NRF_TWIM2            Non-SecureOK
    2021-08-23T17:32:05.642Z DEBUG modem << 08 NRF_SPIM3            Non-SecureOK
    2021-08-23T17:32:05.643Z DEBUG modem << 09 NRF_TIMER0           Non-SecureOK
    2021-08-23T17:32:05.645Z DEBUG modem << 10 NRF_TIMER1           Non-SecureOK
    2021-08-23T17:32:05.647Z DEBUG modem << 11 NRF_TIMER2           Non-SecureOK
    2021-08-23T17:32:05.656Z DEBUG modem << 12 NRF_SAADC            Non-SecureOK
    2021-08-23T17:32:05.657Z DEBUG modem << 13 NRF_PWM0             Non-SecureOK
    2021-08-23T17:32:05.658Z DEBUG modem << 14 NRF_PWM1             Non-SecureOK
    2021-08-23T17:32:05.661Z DEBUG modem << 15 NRF_PWM2             Non-SecureOK
    2021-08-23T17:32:05.662Z DEBUG modem << 16 NRF_PWM3             Non-SecureOK
    2021-08-23T17:32:05.663Z DEBUG modem << 17 NRF_WDT              Non-SecureOK
    2021-08-23T17:32:05.664Z DEBUG modem << 18 NRF_IPC              Non-SecureOK
    2021-08-23T17:32:05.666Z DEBUG modem << 19 NRF_VMC              Non-SecureOK
    2021-08-23T17:32:05.668Z DEBUG modem << 20 NRF_FPU              Non-SecureOK
    2021-08-23T17:32:05.669Z DEBUG modem << 21 NRF_EGU1             Non-SecureOK
    2021-08-23T17:32:05.672Z DEBUG modem << 22 NRF_EGU2             Non-SecureOK
    2021-08-23T17:32:05.674Z DEBUG modem << 23 NRF_DPPIC            Non-SecureOK
    2021-08-23T17:32:05.712Z DEBUG modem << 24 NRF_REGULATORS       Non-SecureOK
    2021-08-23T17:32:05.714Z DEBUG modem << 25 NRF_PDM              Non-SecureOK
    2021-08-23T17:32:05.716Z DEBUG modem << 26 NRF_I2S              Non-SecureOK
    2021-08-23T17:32:05.718Z DEBUG modem << 27 NRF_GPIOTE1          Non-SecureOK
    2021-08-23T17:32:05.720Z DEBUG modem << SPM: NS image at 0x10000
    2021-08-23T17:32:05.721Z DEBUG modem << SPM: NS MSP at 0x20010d80
    2021-08-23T17:32:05.723Z DEBUG modem << SPM: NS reset vector at 0x132e5
    2021-08-23T17:32:05.725Z DEBUG modem << SPM: prepare to jump to Non-Secure image.
    2021-08-23T17:32:05.726Z DEBUG modem << *** Booting Zephyr OS build v2.6.0-rc1-ncs1  ***
    2021-08-23T17:32:05.728Z DEBUG modem << Failed to find sensor MPU6050
    2021-08-23T17:32:05.729Z DEBUG modem << [00:00:00.000,122] [1;31m<err> i2c_nrfx_twim: Error 0x0BAE0001 occurred for message 0[0m
    2021-08-23T17:32:05.730Z DEBUG modem << [00:00:00.000,152] [1;31m<err> MPU6050: Failed to read chip ID.[0m
    

Children
Related