Hi,
I have been using Thingy52 devices for experiments for quite a while now. I would like now to use Zephyr therefore I played with various sensor samples provided with Zephyr, they all worked out of the box, expect the MPU6050 did not with the following error :
[00000222] <err> i2c_nrfx_twim: Error 195952641 occurred for message 0
I am very aware that the Thingy52 comes with invensense MPU9250 and not MPU6050 but I do believe the basic registers should be the same. Also within Thingy52 the MPU9250 is connected to the i2C through a GPIO expander.
To run the MPU6050 sample on Thingy52 I did the following:
- update the zephyr/board/arm/thingy52_nrf52832/thingy52_nrf52832.dts (I could have used overaly but I was not sure …) to include the following at the end of the file
compatible = "nordic,nrf-twim";
status = "okay";
clock-frequency = <I2C_BITRATE_FAST>;
sda-pin = <7>;
scl-pin = <8>;
compatible = "invensense,mpu6050";
reg = <0x68>;
status = "okay";
label = "MPU6050";
int-gpios = <&gpio0 06 GPIO_ACTIVE_HIGH>;
};
};
- update the prf.conf to include :
CONFIG_SENSOR=y
CONFIG_MPU6050=y
CONFIG_MPU6050_TRIGGER_NONE=y
CONFIG_I2C_2=y
CONFIG_I2C_2_NRF_TWIM=y
CONFIG_LOG_DEFAULT_LEVEL=2
CONFIG_LOG_BACKEND_RTT=y
CONFIG_LOG_BACKEND_RTT_MODE_DROP=y
CONFIG_LOG_MODE_NO_OVERFLOW=y
CONFIG_LOG_PRINTK=y
CONFIG_LOG_PRINTK_MAX_STRING_LENGTH=256
CONFIG_LOG_BUFFER_SIZE=4096
CONFIG_LOG_BACKEND_RTT_MESSAGE_SIZE=256
CONFIG_LOG_STRDUP_BUF_COUNT=64
CONFIG_LOG_STRDUP_MAX_STRING=64
CONFIG_LOG_BACKEND_SHOW_COLOR=n
CONFIG_LOG_BACKEND_FORMAT_TIMESTAMP=n
CONFIG_LOG_PROCESS_THREAD_STACK_SIZE=1024
CONFIG_USE_SEGGER_RTT=y
CONFIG_SEGGER_RTT_BUFFER_SIZE_UP=4096
CONFIG_RTT_CONSOLE=y
CONFIG_UART_CONSOLE=n