LIS2MDL code ***help request***

You have a pull-down resistor on the pin, don't you?