i2c+timer+work keeps getting -22 or -128 and keep crashing

Hi,

I am using i2c to get sensor data. At first the client write a value to the service. In the service on write callback it trigger's a timer, in the timer, it submit a work. In the work handler, it reads data and then notify the client.

but the notify keeps returning -22 or -128, the bluetooth is connected, and the notify data is correct.

When the client disconnect, the chip crashed and auto restarted.

How should I fix this?

Thanks,

Related