Help with BMI088 driver

I am trying to make use of the BMI088 driver with our board and am running into some problem getting things set up.
I’ve got modules setup as listed here and the BMI088 module is showing up with lsmod. I have the following in my DTS

bmi088@69 {
    compatible = "bmi,bmi088";
    accel_i2c_addr = <0x18>;
    status = "okay";
    reg = <0x68>;
    accel_irq_gpio = <&tegra_main_gpio TEGRA194_MAIN_GPIO(S, 4) GPIO_ACTIVE_HIGH>;
    gyro_irq_gpio = <&tegra_main_gpio TEGRA194_MAIN_GPIO(Q, 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];
};

how ever i see no devices listed in /sys/bus/iio/devices/ starting to run out of ideas of what to check to see what is wrong. The only bmi related thing showing up for me with sudo dmsg is [ 46.433103] Modules linked in: lzo_rle lzo_compress zram loop realtek aes_ce_blk crypto_simd cryptd aes_ce_cipher ghash_ce sha2_ce sha256_arm64 sha1_ce snd_soc_spdif_tx nvgpu ina3221 pwm_fan max77620_thermal tegra_bpmp_thermal bmi088 userspace_alert kfifo_buf ar1335 spi_tegra114 nvmap 8021q garp mrp ramoops reed_solomon ip_tables x_tables

hello graham.clarke,

may I confirm which Jetpack release version you’re working with, please check release tag, $ cat /etc/nv_tegra_release for confirmation.
please also note that, this node, bmi088@69 must be added as a child of the i2c@c250000 node in device tree.

We are using jetpack R35 rev 1
i2c@c250000 seems like the first of the problems I was having, in my case i needed i2c@3160000 though instead. but with that change I am now seeing the IIO devices populate. Now attempting to successfully test them to confirm stuff is working correctly!

update gave the iio_generic_buffer tool a try and hit a crash issue
ran the following
root@er-mbu:/home/ubuntu/iio# echo 0 > /sys/bus/iio/devices/iio:device0/scan_elements/in_timestamp_en
root@er-mbu:/home/ubuntu/iio# echo 0 > /sys/bus/iio/devices/iio:device1/scan_elements/in_timestamp_en
root@er-mbu:/home/ubuntu/iio# ./iio_generic_buffer -a -c 10 --device-name accelerometer -g

which results in the system crashing with the following terminal output.
[ 283.551689] Unable to handle kernel paging request at virtual address ffffdca403845db8
[ 283.552038] Mem abort info:
[ 283.552155] ESR = 0x96000004
[ 283.553291] EC = 0x25: DABT (current EL), IL = 32 bits
[ 283.554547] SET = 0, FnV = 0
[ 283.555701] EA = 0, S1PTW = 0
[ 283.556853] Data abort info:
[ 283.558019] ISV = 0, ISS = 0x00000004
[ 283.559451] CM = 0, WnR = 0
[ 283.560441] swapper pgtable: 4k pages, 48-bit VAs, pgdp=00000001c9118000
[ 283.561395] [ffffdca403845db8] pgd=0000000000000000, p4d=0000000000000000
[ 283.562347] Internal error: Oops: 96000004 [#1] PREEMPT SMP
[ 283.563205] Modules linked in: lzo_rle lzo_compress zram loop realtek nvgpu aes_ce_blk crypto_simd cryptd aes_ce_cipher ghash_ce sha2_ce sha256_arm64 sha1_ce snd_soc_spdif_tx pwm_fan max77620_thermal ina3221 tegra_bpmp_thermal userspace_alert bmi088 ar1335 kfifo_buf spi_tegra114 nvmap 8021q garp mrp ramoops reed_solomon ip_tables x_tables
[ 283.566692] CPU: 3 PID: 2872 Comm: iio_generic_buf Tainted: G W 5.10.104-er-g54eaadcba #1
[ 283.567914] Hardware name: Unknown NVIDIA Jetson Xavier NX Developer Kit/NVIDIA Jetson Xavier NX Developer Kit, BIOS 202210.0-Unknown 02/28/2023
[ 283.569205] pstate: 20400009 (nzCv daif +PAN -UAO -TCO BTYPE=–)
[ 283.573114] pc : __gte_register_event+0x98/0x340
[ 283.578095] lr : __gte_register_event+0x24/0x340
[ 283.582378] sp : ffff8000171739f0
[ 283.586047] x29: ffff8000171739f0 x28: ffff3debcb282b80
[ 283.591304] x27: 0000000000000000 x26: ffffdc1f53566510
[ 283.597073] x25: ffff3debcb282b80 x24: 0000000000000001
[ 283.602588] x23: 00000084b02df8a0 x22: 0000000000000000
[ 283.607840] x21: 00000000c10042de x20: ffffdc1f53566168
[ 283.613609] x19: ffffdca403845db0 x18: 0000000000000000
[ 283.618863] x17: 0000000000000000 x16: ffffdc1f5241d320
[ 283.624461] x15: 0000aaaaf6c29720 x14: 0000000000000000
[ 283.629715] x13: 0000000000000000 x12: 0000000000000018
[ 283.635400] x11: 0101010101010101 x10: ff7f7f7f7f7f7f7f
[ 283.640657] x9 : 92fefeff0efefeff x8 : 7f7f7f7f7f7f7f7f
[ 283.646340] x7 : 01fefefeff6d6e60 x6 : 0000008080808000
[ 283.651760] x5 : 0080808080000000 x4 : 00000000ff68985e
[ 283.656927] x3 : ffffdc1f535f71a0 x2 : 000000000000000c
[ 283.662524] x1 : 0000000000000076 x0 : 00000000ffffdc1f
[ 283.667862] Call trace:
[ 283.670319] __gte_register_event+0x98/0x340
[ 283.674345] tegra_gte_register_event+0x8c/0xe0
[ 283.679156] bmi_gte_init+0x5c/0x74 [bmi088]
[ 283.683358] bmi_enable+0xa4/0x398 [bmi088]
[ 283.687399] bmi_iio_buffer_postenable+0xa8/0xb8 [bmi088]
[ 283.692721] __iio_update_buffers+0x598/0x830
[ 283.697007] iio_buffer_store_enable+0x90/0x100
[ 283.701557] dev_attr_store+0x48/0x60
[ 283.705489] sysfs_kf_write+0x60/0x70
[ 283.708999] kernfs_fop_write_iter+0x12c/0x1c0
[ 283.713028] new_sync_write+0xfc/0x1a0
[ 283.716786] vfs_write+0x25c/0x390
[ 283.720194] ksys_write+0x7c/0x110
[ 283.723431] __arm64_sys_write+0x28/0x40
[ 283.727201] el0_svc_common.constprop.0+0x80/0x1d0
[ 283.732439] do_el0_svc+0x38/0xb0
[ 283.735246] el0_svc+0x1c/0x30
[ 283.738396] el0_sync_handler+0xa8/0xb0
[ 283.742414] el0_sync+0x16c/0x180
[ 283.745397] Code: a9046bf9 9bb77eb7 f941d69a 8b170353 (f9400660)
[ 283.751783] —[ end trace cec3cac1c9150d84 ]—
[ 283.756241] Kernel panic - not syncing: Oops: Fatal exception
[ 283.761947] SMP: stopping secondary CPUs
[ 283.766062] Kernel Offset: 0x5c1f41620000 from 0xffff800010000000
[ 283.771901] PHYS_OFFSET: 0xffffc21580000000
[ 283.776106] CPU features: 0x8240002,03802a30
[ 283.780563] Memory Limit: none
[ 283.783804] —[ end Kernel panic - not syncing: Oops: Fatal exception ]—

hello graham.clarke,

this is quite old release version,
is it possible for moving forward to the latest JP-5.1.4/r35.6.0 for verification?

We are investigating updating to 5.1.4 currently but that is likely to be a little ways out still.

Just a bit of a bump/update.

Changing my device tree to use this

i2c@3160000 {
    bmi088@69  {
        compatible = "bmi,bmi088";
        accel_i2c_addr = <0x18>;
        status = "okay";
        reg = <0x68>;
        accel_irq_gpio = <&tegra_main_gpio TEGRA194_MAIN_GPIO(S, 4) GPIO_ACTIVE_HIGH>;
        gyro_irq_gpio = <&tegra_main_gpio TEGRA194_MAIN_GPIO(Q, 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];
    };
};

Results in me seeing the 2 IIO devices. However when I disable the timestamp channel and then run
./iio_generic_buffer -a -c 10 --device-name accelerometer -g as described here. I started to see kernel panic that i posted above. Since then I have tried adding the following to the device tree.

gte@3aa0000 {
status = “okay”;
};

gte@c1e0000 {
status = “okay”;
};

gpio@c2f0000 {
/delete-property/ use-timestamp;
};

Doing this and then running the following commands from the super user
root@er-mbu:/home/ubuntu/iio# echo 0 > /sys/bus/iio/devices/iio:device0/scan_elements/in_timestamp_en
root@er-mbu:/home/ubuntu/iio# ./iio_generic_buffer -a -c 10 --device-name accelerometer -g

has changed the kernel panic to this

[ 496.542366] tegra_gte c1e0000.gte: Invalid event id:118 and GTE event offset: 118
[ 496.969495] Unable to handle kernel paging request at virtual address ffffffffffffffe2
[ 496.969820] Mem abort info:
[ 496.969938] ESR = 0x96000004
[ 496.970047] EC = 0x25: DABT (current EL), IL = 32 bits
[ 496.970213] SET = 0, FnV = 0
[ 496.970320] EA = 0, S1PTW = 0
[ 496.970425] Data abort info:
[ 496.970524] ISV = 0, ISS = 0x00000004
[ 496.970658] CM = 0, WnR = 0
[ 496.970765] swapper pgtable: 4k pages, 48-bit VAs, pgdp=0000000192448000
[ 496.971004] [ffffffffffffffe2] pgd=0000000000000000, p4d=0000000000000000
[ 496.971197] Internal error: Oops: 96000004 [#1] PREEMPT SMP
[ 496.971378] Modules linked in: lzo_rle lzo_compress zram realtek loop aes_ce_blk crypto_simd nvgpu cryptd aes_ce_cipher ghash_ce sha2_ce sha256_arm64 sha1_ce snd_soc_spdif_tx pwm_fan ina3221 max77620_thermal tegra_bpmp_thermal userspace_alert ar1335 bmi088 kfifo_buf spi_tegra114 nvmap 8021q garp mrp ramoops reed_solomon ip_tables x_tables
[ 496.972202] CPU: 0 PID: 380 Comm: irq/225-acceler Tainted: G W 5.10.104-er-g54eaadcba #1
[ 496.972503] Hardware name: Unknown NVIDIA Jetson Xavier NX Developer Kit/NVIDIA Jetson Xavier NX Developer Kit, BIOS 202210.0-Unknown 02/28/2023
[ 496.984921] pstate: a0c00009 (NzCv daif +PAN +UAO -TCO BTYPE=–)
[ 496.990620] pc : tegra_gte_retrieve_event+0x50/0x140
[ 496.995601] lr : tegra_gte_retrieve_event+0x2c/0x140
[ 497.000413] sp : ffff80001274bc80
[ 497.003824] x29: ffff80001274bc80 x28: ffff15a948b14880
[ 497.009666] x27: ffff15a948b14880 x26: 00000000000000b8
[ 497.014863] x25: ffffffffffffff4a x24: 0000000000000000
[ 497.020623] x23: ffffffffffffff62 x22: ffff15a948b14880
[ 497.026134] x21: ffff15a948b14880 x20: ffff80001274bd58
[ 497.031386] x19: ffffffffffffffea x18: 0000000000000000
[ 497.037162] x17: 0000000000000000 x16: ffffd497cbb4cdd0
[ 497.042669] x15: 0000fffff3286be8 x14: 0000000000000000
[ 497.048180] x13: 0000000000004370 x12: 0000000000000000
[ 497.053353] x11: 0000000000000040 x10: ffffd497cca52250
[ 497.059119] x9 : 00000062a215530c x8 : 00000003cf95ee56
[ 497.064633] x7 : 0018701a80000000 x6 : 0000000000000017
[ 497.069888] x5 : 00000000085ede20 x4 : 0000000010000000
[ 497.075311] x3 : ffffffff9bde27d9 x2 : ffffd497caf0e090
[ 497.080653] x1 : 0000000000000000 x0 : ffffd497caf0e090
[ 497.086245] Call trace:
[ 497.088447] tegra_gte_retrieve_event+0x50/0x140
[ 497.093258] bmi_irq_thread+0x94/0x280 [bmi088]
[ 497.097547] irq_thread_fn+0x34/0xa0
[ 497.101472] irq_thread+0x158/0x250
[ 497.104716] kthread+0x148/0x170
[ 497.108129] ret_from_fork+0x10/0x24
[ 497.111890] Code: 54000760 f90023f9 d1022277 d1028279 (f85f8260)
[ 497.117759] —[ end trace 8bba20925e357bb7 ]—
[ 497.122560] Kernel panic - not syncing: Oops: Fatal exception
[ 497.128158] SMP: stopping secondary CPUs
[ 497.131676] Kernel Offset: 0x5497bad50000 from 0xffff800010000000
[ 497.137786] PHYS_OFFSET: 0xffffea5800000000
[ 497.142071] CPU features: 0x8240002,03802a30
[ 497.146355] Memory Limit: none
[ 497.149511] —[ end Kernel panic - not syncing: Oops: Fatal exception ]—

Any further help would be greatly appreciated.

hello graham.clarke,

there’re some documentation erroneous, could you please check r35.6.0 developer guide for the steps.
for instance, BMI088 IMU Driver.

as mentioned by developer guide,
re-cap as below…
The data-ready interrupts must be connected to Jetson Always On (AON) GPIOs, which have hardware timestamp capability to record the accurate time of the interrupt occurrences.

however, it seems you’re used Main GPIOs instead of AON GPIOs in the code snippets.

could you please change the pin to AON GPIOs for testing,
besides, please share all your step in details to reproduce the same on AGX Xavier developer kit.

Sorry for the long wait.

Moving the interrupts to a different bank is difficult at this point due to board design. Can you give me some details about why the time stamp function the driver is using is specifically limited to the AON GPIOs and is not available on the main GIPOs?

it’s also mentioned by developer guide, GTE only provide hardware timestamping for state changes of specific signals.

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