Accel timeout using drone kit with px4

I am using pixhawk cube running PX4 1.10.1 with a companion processor which is running dronekit. In the companion processor, I have put few active listeners for few of the parameters and corresponding callback functions and if there is any change in a parameter, corresponding callback function is executed.
In one of the callback functions, I am writing to a parameter of the PX4 as
But most of the time , this is resulting in either “accel0 timeout” or “mag0 timeout”.
Can someone help out in resolving this?