Mpu6050 default driver, interrupt PIN

Hi, I’m connecting the MPU6050 to the milkv duo board. I get the following

# dmesg | grep mpu
[    0.805674] inv-mpu6050-i2c 0-0068: mounting matrix not found: using identity...
[    0.813447] inv-mpu6050-i2c 0-0068: Could not find IRQ 0
[    0.819145] inv-mpu6050-i2c: probe of 0-0068 failed with error -22
# i2cdetect -ry 0
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- 56 -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --

I’m connecting the Interrupt pin to GPIOA26 and using the following dts:

&i2c0 {
       status = "okay";
       clock-frequency = <100000>;
       mpu6050@68 {
		compatible = "invensense,mpu6050";
		reg = <0x68>;
		interrupt-parent = <&gpio0>;
		interrupts = <26 IRQ_TYPE_EDGE_RISING>;
	};
};

What is the correct values for interrupt-parent and interrupts?

I changed to the following:

interrupt-parent = <&plic0>;
interrupts = <60 26 IRQ_TYPE_EDGE_RISING>;

Now I get the following:

# dmesg | grep mpu
[    0.804931] inv-mpu6050-i2c 0-0068: mounting matrix not found: using identity...
[    1.202076] inv-mpu6050-i2c 0-0068: trigger probe fail -22
[    1.207923] inv-mpu6050-i2c: probe of 0-0068 failed with error -22
1 Like

This is going to help me out some day…

1 Like

I now changed to:

interrupt-parent = <&porta>;
interrupts = <14 IRQ_TYPE_EDGE_RISING>;

Now I get a kernel panic. I think this is a PINMUX problem. Maybe the GPIOA14 is not set as gpio pin?

1 Like

I am also struggling with interrupt handling.

# Not working normally, do not copy-paste

&i2c0 {
   status = "okay";
   clock-frequency = <100000>;

    touchscreen@38 {
            compatible = "focaltech,ft6236";
            reg = <0x38>;

            interrupt-parent = <&porta>;
            interrupts = <22 IRQ_TYPE_EDGE_FALLING>;
            interrupt-controller; /* Magic word */

            touchscreen-size-x = <480>;
            touchscreen-size-y = <320>;
            status = "okay";

            reset-gpios = <&porta 15  GPIO_ACTIVE_LOW>;

            };
};

Before adding the magic word, the driver was unable to find IRQ, as in your case.

Now the driver is satisfied, but still cannot process GPIO interrupts :frowning: The touch screen is generating low level pulses at its INT output, of course.

I am stuck now. It would be nice to see a message from you if your driver starts working.

Also, I do not like GPIOA14, since after assigning the pin as GPIO in u-boot, it somehow reverts back to other function. That is why I switched to GPIOA22.

1 Like

This is what I have done on Duo to be able to upload fip.bin and boot.sd files:

cd /media
mkdir boot
mount /dev/mmcblk0p1 /media/boot
echo /dev/mmcblk0p1 /media/boot vfat defaults 0 0 >> /etc/fstab

Now the boot partition is mounted at /media/boot and I can send the files:

sshpass -p "milkv" scp -O ~/WORK/MILKV_2024_01/duo-buildroot-sdk/install/soc_cv1800b_milkv_duo_sd/fip.bin  root@192.168.42.1:/media/


sshpass -p "milkv" scp -O ~/WORK/MILKV_2024_01/duo-buildroot-sdk/install/soc_cv1800b_milkv_duo_sd/rawimages/boot.sd  root@192.168.42.1:/media/boot

The files are generated by executing the following commands at the host, instead of “build_all”:

build_uboot
build_fsbl
build_kernel

After uploading, I just reboot the Duo:

sync
reboot

Notice the boot.sd file is the one from the rawimages folder, not from its parent folder.

1 Like

thanks for your response.I’m using the milkv-duo-buildroot repo instead of duo-buildroot-sdk as the SDK version produces nearly 1G sdcard image and I was unfamiliar with it’s custom build system… Unfortunately the cvi_pinmux application used here Milk-V Duo 引脚复用配置工具 cvi_pinmux is not included in the repo I’m using and I was also unable to download it manually. So I was not able to confirm if the pinmux was in GPIO state or alternate function as this could have been the issue I’m facing. I was unable to progress further. As I’m relatively new to embedded Linux all this complexity with this board and I have switched to another ARM board to continue my experiments.

The app is currently called duo-pinmux .

yes but it’s only available in duo-buildroot-sdk not in GitHub - milkv-duo/milkv-duo-buildroot: Which is preparing for the mainline

I have a program that sets the pinmux by writing the pinmux registers if your not sure your setting the pinmux. You may want to take a look GitHub - taspenwall/PWM-test: Working on driveing ws2812 with the duo.

3 Likes

Just found the solution for the interrupt problem today, please see

ntn888, maybe you will return back to RISC-V :slight_smile:

1 Like