Cannot send data via i2c to master raspberry pi

You forgot to declare all global variables that are modified in interrupt context "volatile". Without that declaration the compiler may optimize the complete variable away. So although the command byte is received in the write request, the code in the following read request will not see it.