I found the problem, but I don't understand it. The datasheet says that when reading a register, the first byte sent is a dummy byte that should be discarded. But apparently this is only true for the accelerometer and not for the gyroscope. After not discarding the first read byte from the gyroscope it works.
... View more