I2C connection with raspberry returns only 0

Hi,

I’m trying to connect a M0 Pro with a rasperry pi zero over I2C

I found this code and it works with a regular Arduino Uno connected with my RPI Zero.
However when uploading this exact code to a Arduino M0 Pro it doesn’t work 100%.
Obviously there is a connection and the devices respond but I get the wrong value back

According to the Arduino code it should return all the time “5”.
Works with the Uno but not the M0

Terminal on RPI connected with Arduino M0 Pro

Arduino answer to RPI: 0
Arduino answer to RPI: 0
Arduino answer to RPI: 0

Terminal on RPI connected with Arduino Uno

Arduino answer to RPI: 5
Arduino answer to RPI: 5
Arduino answer to RPI: 5

Do I need to configure the M0 Pro in another way?

#include <Wire.h>
#define SLAVE_ADDRESS 0x28
#define LED  LED_BUILTIN

int number = 0;

void setup() {
  pinMode(LED, OUTPUT);
  Serial.begin(9600);
  Wire.begin(SLAVE_ADDRESS);
  Wire.onReceive(receiveData);
  Wire.onRequest(sendData);
  Serial.println("Ready!");
}

void loop() {
  delay(100);
}

void receiveData(int byteCount) {
  Serial.print("receiveData");
  while (Wire.available()) {
    number = Wire.read();
    Serial.print("data received: ");
    Serial.println(number);
    if (number == 1) {
      Serial.println(" LED ON");
      digitalWrite(LED, HIGH);
    } else {
      Serial.println(" LED OFF");
      digitalWrite(LED, LOW);
    }
  }
}

void sendData() {
  Wire.write(5);
}

The RPI code

import RPi.GPIO as gpio
import smbus
import time
import sys

bus = smbus.SMBus(1)
address = 0x28

def main():
    gpio.setmode(gpio.BCM)
    gpio.setup(17, gpio.OUT)
    status = False
    while 1:
        gpio.output(17, status)
        status = not status
        bus.write_byte(address, 1 if status else 0)
        print "Arduino answer to RPI:", bus.read_byte(address)
        time.sleep(1)

if __name__ == '__main__':
    try:
        main()
    except KeyboardInterrupt:
        print 'Interrupted'
        gpio.cleanup()
        sys.exit(0)

Seems that the rpi can't act as a slave and that's the problem... With pigpio there's a workaround just in case someone else finds this thread