Kernel panic using bmi088

Hi,

I’m trying to use the bmi088 kernel driver on a Orin Nano with kernel 5.10.120 (L4T 35.4.1).

The BMI088 is connected to i2c-0 with the accelerometer at 0x19 and gyroscope at 0x68.
INT1 is connected to PAA.00 and INT3 to PAA.01.
My device tree looks like this:

/ {
	i2c@3160000 { /* i2c0 */
		bmi088@68 {
			compatible = "bmi,bmi088";
			status = "okay";
			reg = <0x68>;
			accel_i2c_addr = <0x19>;
			accel_irq_gpio = <&tegra_aon_gpio TEGRA234_AON_GPIO(AA, 0) GPIO_ACTIVE_HIGH>;
			gyro_irq_gpio = <&tegra_aon_gpio TEGRA234_AON_GPIO(AA, 1) GPIO_ACTIVE_HIGH>;
			accel_matrix = [01 00 00 00 01 00 00 00 01];
			gyro_matrix = [01 00 00 00 01 00 00 00 01];
			accel_reg_0x53 = <0x0A>; /* INT1 output active high */
			gyro_reg_0x16 = <0x01>; /* INT3 output active high */
			gyro_reg_0x18 = <0x01>; /* INT3 as data-ready interrupt */
		};
	};
};

with the pinmux config

			can0_dout_paa0 {
				nvidia,pins = "can0_dout_paa0";
				nvidia,function = "rsvd1";
				nvidia,pull = <TEGRA_PIN_PULL_NONE>;
				nvidia,tristate = <TEGRA_PIN_ENABLE>;
				nvidia,enable-input = <TEGRA_PIN_ENABLE>;
			};

			can0_din_paa1 {
				nvidia,pins = "can0_din_paa1";
				nvidia,function = "rsvd1";
				nvidia,pull = <TEGRA_PIN_PULL_NONE>;
				nvidia,tristate = <TEGRA_PIN_ENABLE>;
				nvidia,enable-input = <TEGRA_PIN_ENABLE>;
			};

gpio-defaults:

	gpio@c2f0000 {
		gpio-init-names = "default";
		gpio-init-0 = <&gpio_aon_default>;

		gpio_aon_default: default {
			gpio-input = <
				TEGRA234_AON_GPIO(EE, 4)
				TEGRA234_AON_GPIO(CC, 1)
				TEGRA234_AON_GPIO(CC, 2)
				TEGRA234_AON_GPIO(CC, 3)
				TEGRA234_AON_GPIO(AA, 0)
				TEGRA234_AON_GPIO(AA, 1)
				>;
			gpio-output-low = <
				TEGRA234_AON_GPIO(EE, 2)
				TEGRA234_AON_GPIO(CC, 0)
				TEGRA234_AON_GPIO(AA, 4)
				>;
			gpio-output-high = <
				TEGRA234_AON_GPIO(AA, 5)
				TEGRA234_AON_GPIO(BB, 3)
				>;
		};
	};

The bmi088 driver is properly loaded and reports

kernel: [   19.333464] bmi088 0-0068: iio accelerometer done
kernel: [   19.352378] bmi088 0-0068: iio gyroscope done

I can also see that the gpio config seems to be ok:

cat /sys/kernel/debug/gpio
gpiochip1: GPIOs 316-347, parent: platform/c2f0000.gpio, tegra234-gpio-aon:
 gpio-316 (PAA.00              |accelerometer       ) in  lo IRQ
 gpio-317 (PAA.01              |gyroscope           ) in  lo IRQ

But when I try to run iio_generic_buffer according to BMI088 IMU Driver — Jetson Linux Developer Guide documentation
I enabled all scan elements except in_timestamp_en and when I then run iio_generic_buffer -c 10 --device-name accelerometer -g I get a kernel panic:

[  731.200579] Unable to handle kernel NULL pointer dereference at vir8
[  731.209670] Mem abort info:
[  731.212586]   ESR = 0x96000004
[  731.215745]   EC = 0x25: DABT (current EL), IL = 32 bits
[  731.221213]   SET = 0, FnV = 0
[  731.224363]   EA = 0, S1PTW = 0
[  731.227604] Data abort info:
[  731.230565]   ISV = 0, ISS = 0x00000004
[  731.234515]   CM = 0, WnR = 0
[  731.237565] user pgtable: 4k pages, 48-bit VAs, pgdp=00000001311eb000
[  731.244207] [0000000000000028] pgd=0000000000000000, p4d=0000000000000000
[  731.251215] Internal error: Oops: 96000004 [#1] PREEMPT SMP
[  731.256963] Modules linked in: xt_MASQUERADE nf_conntrack_netlink nfnetlink iptable_nat nf_nat br_netk
[  731.257058]  nf_defrag_ipv6 nf_defrag_ipv4 libcrc32c ip6table_filter ip6_tables nvmap iptable_filter ]
[  731.362042] CPU: 3 PID: 10357 Comm: iio_generic_buf Not tainted 5.10.120-tegra #1
[  731.369710] Hardware name: Unknown NVIDIA Orin Nano Developer Kit/NVIDIA Orin Nano Developer Kit, BIO3
[  731.381402] pstate: 60400009 (nZCv daif +PAN -UAO -TCO BTYPE=--)
[  731.387574] pc : _raw_spin_lock+0x44/0x90
[  731.391683] lr : _raw_spin_lock+0x1c/0x90
[  731.395795] sp : ffff8000153939d0
[  731.399194] x29: ffff8000153939d0 x28: 0000000000000001
[  731.404635] x27: ffffa7285a72a910 x26: ffffa7285a729290
[  731.410086] x25: ffffa7285a72a8b0 x24: ffffa7285a7290c0
[  731.415538] x23: ffffa7285a72a8d0 x22: 0000000000000060
[  731.420979] x21: 0000000000000018 x20: ffffa7285a728ee8
[  731.426423] x19: 0000000000000028 x18: 0000000000000001
[  731.431876] x17: 0000000000000000 x16: ffffa728595c8750
[  731.437331] x15: ffff62f2ea058570 x14: ffffffffffffffff
[  731.442777] x13: ffff62f2f1a41188 x12: 0000000000000010
[  731.448218] x11: 0101010101010101 x10: 7f7f7f7f7f7f7f7f
[  731.453665] x9 : 6d6475645e6c746d x8 : 7f7f7f7f7f7f7f7f
[  731.459119] x7 : fefefefefeff7273 x6 : 0000808080808080
[  731.464565] x5 : 8080808080800000 x4 : 0000000000000000
[  731.470006] x3 : 0000000000000000 x2 : 0000000000000001
[  731.475452] x1 : 0000000000000000 x0 : 0000000000000028
[  731.480902] Call trace:
[  731.483415]  _raw_spin_lock+0x44/0x90
[  731.487170]  __gte_register_event+0x150/0x340
[  731.491638]  tegra_gte_register_event+0x8c/0xe0
[  731.496292]  bmi_gte_init+0x58/0x70 [bmi088]
[  731.500668]  bmi_enable+0x5c/0x3e0 [bmi088]
[  731.504954]  bmi_iio_buffer_postenable+0x50/0xb8 [bmi088]
[  731.510493]  __iio_update_buffers+0x598/0x830
[  731.514958]  iio_buffer_store_enable+0x90/0x100
[  731.519603]  dev_attr_store+0x48/0x60
[  731.523353]  sysfs_kf_write+0x60/0x70
[  731.527100]  kernfs_fop_write_iter+0x12c/0x1c0
[  731.531651]  new_sync_write+0xfc/0x1a0
[  731.535498]  vfs_write+0x25c/0x390
[  731.538981]  ksys_write+0x7c/0x110
[  731.542466]  __arm64_sys_write+0x28/0x40
[  731.546485]  el0_svc_common.constprop.0+0x80/0x1d0
[  731.551401]  do_el0_svc+0x38/0xb0
[  731.554811]  el0_svc+0x1c/0x30
[  731.557942]  el0_sync_handler+0xa8/0xb0
[  731.561871]  el0_sync+0x16c/0x180
[  731.565268] Code: 52800001 aa1303e0 52800022 2a0103e3 (88e37e62)
[  731.571520] ---[ end trace 386a7cde7cd53105 ]---
[  731.581243] Kernel panic - not syncing: Oops: Fatal exception
[  731.587138] SMP: stopping secondary CPUs
[  731.591162] Kernel Offset: 0x2728487a0000 from 0xffff800010000000
[  731.597404] PHYS_OFFSET: 0xffff9d0e40000000
[  731.601687] CPU features: 0x08040006,4a80aa38
[  731.606151] Memory Limit: none
[  731.614239] ---[ end Kernel panic - not syncing: Oops: Fatal exception ]---

Any pointer are much appreciated!

Hi flixr,

Are you using the devkit or custom board for Orin Nano?
What’s your Jetpack version in use?

Could you use IRQ_TYPE_LEVEL_LOW instead of GPIO_ACTIVE_HIGH here?

Please share the full serial console log for further check.

Hi KevinFFF,

thanks for the quick response.
It’s a custom carrier board and I’m using L4T 35.4.1 (using L4T directly without the JetPack host stuff, but would be equivalent JetPack 5.1.2).

I tried with IRQ_TYPE_LEVEL_LOW, but it yields the same result.

Please find the console log attached.
console_log.txt (93.2 KB)

[ 1070.226550]  tegra_gte_register_event+0x8c/0xe0

The kernel panic seems caused from here.
You could add more debug prints in bmi_gte_init().

Please share the result of the following command on your board.

$ ls /sys/bus/iio/devices/iio:device0/scan_elements/ 

Please share block diagram of your connection for BMI088.
and also the device tree you are using for further check.

The scan_elements are there:

$ ls /sys/bus/iio/devices/iio:device0/scan_elements/ 
in_accel_x_en     in_accel_y_en     in_accel_z_en     in_timestamp_en
in_accel_x_index  in_accel_y_index  in_accel_z_index  in_timestamp_index
in_accel_x_type   in_accel_y_type   in_accel_z_type   in_timestamp_type

Attached the dts and schematics.


bmi088_som_schematic

kernel_tegra234-p3767-0003-p3768-0000-a0.dts.txt (418.0 KB)

Could you please tell me what kind of debug print you would like me to add?

if (!ngi[id].gte) {
	ngi[id].gte = tegra_gte_register_event(gte_nd, ngi[id].gpio);
	if (!ngi[id].gte)
		ret = -ENODEV;
}

You could print id and ngi[id].gpio here.

Could you also try to enable the following node in device tree?

	gte@c1e0000 {
		compatible = "nvidia,tegra234-gte-aon";
		reg = <0x00 0xc1e0000 0x00 0x10000>;
		interrupts = <0x00 0x0d 0x04>;
		nvidia,int-threshold = <0x01>;
		nvidia,num-slices = <0x03>;
		nvidia,gpio-controller = <0x51>;
-		status = "disabled";
+		status = "okay";
		phandle = <0x467>;
	};

Thanks!

Works after enabling GTE for AON gpios via

gte@c1e0000
{
  status = "okay";
}

Would be good if this info could be added to the BMI088 docs :-)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.