cancel
Showing results for 
Search instead for 
Did you mean: 

[solved] VL53L3CX linux driver, driver loading problem on STM32MP1

BJola.1
Associate II

Hello,

I'm trying to make the linux driver for VL53L3CX work on STM32MP157C-DK2. Already fixed some problems : made it work with new kernel by correcting functions names (timeval => __kernel_old_timeval and i2c_new_device => i2c_new_client_device , that's all), made it compile with bitbake and changed used gpio pins to use it on my board instead of raspberry pi.

The driver now compile. Also with i2cdetect -y 1 I verified that the VL53L3CX is connected and can be detected at adress 29.

But I have that error trying to load the kernel module :

modprobe stmvl53lx

result :

[  545.281289] stmvl53lx_parse_tree: Unable to find boot-reg -22 41
[  545.281366] get_pwren: pwren gpio disable
[  545.291058] cci_read: i2c_transfer :-6, @29 index 0xe5 len 1
[  545.299320] stmvl53lx_reset_release_i2c: boot fail with error -13
[  545.299333] reset_release: reset release fail rc=-5
[  545.310389] ------------[ cut here ]------------
[  545.314976] WARNING: CPU: 0 PID: 1105 at drivers/regulator/core.c:2123 _regulator_put.part.0+0x164/0x16c
[  545.324645] Modules linked in: stmvl53lx(O+) usb_f_rndis aes_arm u_ether aes_generic cmac algif_skcipher libcomposite snd_soc_audio_graph_card snd_soc_simple_card_utils brcmfmac stusb160x typec cfg80211 galcore(O) brcmutil stm32_crc32]
[  545.377256] CPU: 0 PID: 1105 Comm: modprobe Tainted: G        W  O      5.10.10 #1
[  545.384646] Hardware name: STM32 (Device Tree Support)
[  545.389818] [<c0110824>] (unwind_backtrace) from [<c010c4e0>] (show_stack+0x10/0x14)
[  545.397547] [<c010c4e0>] (show_stack) from [<c0b82f3c>] (dump_stack+0xb8/0xcc)
[  545.404774] [<c0b82f3c>] (dump_stack) from [<c01249c0>] (__warn+0xec/0x104)
[  545.411739] [<c01249c0>] (__warn) from [<c0b7e3fc>] (warn_slowpath_fmt+0x64/0xc4)
[  545.419234] [<c0b7e3fc>] (warn_slowpath_fmt) from [<c067023c>] (_regulator_put.part.0+0x164/0x16c)
[  545.428198] [<c067023c>] (_regulator_put.part.0) from [<c067026c>] (regulator_put+0x28/0x38)
[  545.436771] [<c067026c>] (regulator_put) from [<bf285e38>] (stmvl53lx_release_gpios+0x2c/0xc8 [stmvl53lx])
[  545.446451] [<bf285e38>] (stmvl53lx_release_gpios [stmvl53lx]) from [<bf286600>] (stmvl53lx_probe+0xb4/0xd4 [stmvl53lx])
[  545.457263] [<bf286600>] (stmvl53lx_probe [stmvl53lx]) from [<c09242b4>] (i2c_device_probe+0x278/0x2b0)
[  545.466611] [<c09242b4>] (i2c_device_probe) from [<c071d8ec>] (really_probe+0x208/0x4f0)
[  545.474705] [<c071d8ec>] (really_probe) from [<c071dd9c>] (driver_probe_device+0x78/0x16c)
[  545.482976] [<c071dd9c>] (driver_probe_device) from [<c071e0f0>] (device_driver_attach+0x58/0x60)
[  545.491859] [<c071e0f0>] (device_driver_attach) from [<c071e1ac>] (__driver_attach+0xb4/0x154)
[  545.500483] [<c071e1ac>] (__driver_attach) from [<c071b80c>] (bus_for_each_dev+0x78/0xc0)
[  545.508673] [<c071b80c>] (bus_for_each_dev) from [<c071c964>] (bus_add_driver+0x170/0x20c)
[  545.516944] [<c071c964>] (bus_add_driver) from [<c071ecdc>] (driver_register+0x74/0x108)
[  545.525045] [<c071ecdc>] (driver_register) from [<c0924bc0>] (i2c_register_driver+0x3c/0xac)
[  545.533560] [<c0924bc0>] (i2c_register_driver) from [<bf2868f0>] (stmvl53lx_init_i2c+0x34/0x108 [stmvl53lx])
[  545.543397] [<bf2868f0>] (stmvl53lx_init_i2c [stmvl53lx]) from [<c01020c8>] (do_one_initcall+0x58/0x2bc)
[  545.552835] [<c01020c8>] (do_one_initcall) from [<c01c4238>] (do_init_module+0x60/0x258)
[  545.560933] [<c01c4238>] (do_init_module) from [<c01c6490>] (load_module+0x1434/0x1788)
[  545.568945] [<c01c6490>] (load_module) from [<c01c6a6c>] (sys_finit_module+0xd4/0x130)
[  545.576872] [<c01c6a6c>] (sys_finit_module) from [<c0100060>] (ret_fast_syscall+0x0/0x54)
[  545.585050] Exception stack(0xcc0a5fa8 to 0xcc0a5ff0)
[  545.590109] 5fa0:                   00000000 00000000 00000003 0002270c 00000000 00040000
[  545.598297] 5fc0: 00000000 00000000 00000000 0000017b 00034220 00000000 00000000 00000000
[  545.606482] 5fe0: beb06890 beb06880 0001b3c9 410c8bb2
[  545.611777] ---[ end trace c531c4ede0070016 ]---
[  545.616597] stmvl53lx: probe of 1-0029 failed with error -1

Do anyone have an advice to help me in my research ? Where does that error come from ?

Thank you in advance

1 ACCEPTED SOLUTION

Accepted Solutions
Christophe Guibout
ST Employee

Hi @BJola.1​ ,

The WARNING message in _regulator_put is caused by stmvl53lx_release_gpios called when stmvl53lx_setup fails (in stmvl53lx_probe).

But before that, an error has been returned by VL53LX_WaitDeviceBooted because chip didn't succeed to boot after reset.

[  545.299320] stmvl53lx_reset_release_i2c: boot fail with error -13

Error -13 means VL53LX_ERROR_CONTROL_INTERFACE which is an error reported from IO functions.

Could you please share the device tree part related to stmvl53lx (especially xsdn-gpio pin) ?

Do you think you need to configure boot-reg ?

BR,

Christophe

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

View solution in original post

4 REPLIES 4
PatrickF
ST Employee

Hi,

I'm not expert in SW, so take my answer with care.

Found some info about proximity sensors in https://wiki.st.com/stm32mpu/wiki/IIO_overview

and https://github.com/STMicroelectronics/linux/blob/v5.10-stm32mp/Documentation/devicetree/bindings/iio/proximity/vl53l0x.txt

(which is not exactly same reference, but hope it will help)

Regards.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
Christophe Guibout
ST Employee

Hi @BJola.1​ ,

The WARNING message in _regulator_put is caused by stmvl53lx_release_gpios called when stmvl53lx_setup fails (in stmvl53lx_probe).

But before that, an error has been returned by VL53LX_WaitDeviceBooted because chip didn't succeed to boot after reset.

[  545.299320] stmvl53lx_reset_release_i2c: boot fail with error -13

Error -13 means VL53LX_ERROR_CONTROL_INTERFACE which is an error reported from IO functions.

Could you please share the device tree part related to stmvl53lx (especially xsdn-gpio pin) ?

Do you think you need to configure boot-reg ?

BR,

Christophe

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
BJola.1
Associate II

Hi !

Sorry, I wasn't able to answer last week.

Here is the dedicated par of my device tree :

&i2c5 {
    status = "okay";
    i2c-scl-rising-time-ns = <185>;
    i2c-scl-falling-time-ns = <20>;
 
    dmas = <&mdma1 36 0x0 0x40008 0x0 0x0 0>,
           <&mdma1 37 0x0 0x40002 0x0 0x0 0>;
    dma-names = "rx", "tx";
 
    stmvl53lx: stmvl53lx@29 {
		compatible = "st,stmvl53lx";
		reg = <0x29>;
		xsdn-gpio = <19>;
		pwren-gpio = <12>;
		intr-gpio = <16>;
	};
};

dmas seems to come from a previous test. When I supress it, it seems to work.

I suppose the boot failed due to bad dma configuration.

Thank you for your help.

In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.