Edge2 Gsensor functionalities

I have followed the example to retrieve Gsensor measurements provided here and it works properly.

However, I am not sure about how I can change the acceleration range or the sampling frequency of the sensor. Could you indicate me how to do that?

Also, which are the default values of the sensor? I have not been able to find that information. I guess that default acceleration range is 2g, could you confirm this?

Thanks!

Hello @julieta_prieto

You can check the refresh rate configuration for the accelerometer from the device tree entry, it’s applied as the delay between refresh, to calculate the delay divide 1000 by the refresh rate, eg. if you need 60hz rate, 1000 / 60 → ~16 millisec

&i2c3 {
	status = "okay";

	gs_kxtj3: gs_kxtj3@e {
		compatible = "gs_kxtj3";
		reg = <0x0e>;
		irq-gpio = <&gpio1 RK_PB0 IRQ_TYPE_EDGE_RISING>;
		irq_enable = <0>;
--		poll_delay_ms = <30>;
++		poll_delay_ms = <16>;
		type = <SENSOR_TYPE_ACCEL>;
		layout = <0>;
		status = "okay";
	};

However, the acceleration range is set in the driver, If you need to run the accelerometer with more flexibility, it’s recommended you disable the device tree entry for the accelerometer and revert to using a userspace i2c driver, the i2c address would be 0x0e in that case.

Regards.