MPU6050 Arduino Due Problem

Hi,

I made a code using arduino mega. It’s ok but when I try on arduino due I have a problem.

Below the code where I made a average (bias) of gyro and accel.

The problem is Gyro_raw_error_x average. See this

Arduino Mega
Gyro_raw_error_x = -3

Arduino Due
Gyro_raw_error_x = -2000

Other average values are very similar, but GyroX is not.

for(int j=0; j<=samples; j++)
    {
      Wire.beginTransmission(0x68);
      Wire.write(0x3B);                       //Ask for the 0x3B register- correspond to AcX
      Wire.endTransmission(false);
      Wire.requestFrom(0x68,12,1); 
      
      Acc_rawX=(Wire.read()<<8|Wire.read())/4096.0 ; 
      Acc_rawY=(Wire.read()<<8|Wire.read())/4096.0 ;
      Acc_rawZ=(Wire.read()<<8|Wire.read())/4096.0 ;
      temp=Wire.read()<<8|Wire.read(); 
      Gyr_rawX=Wire.read()<<8|Wire.read();     
      Gyr_rawY=Wire.read()<<8|Wire.read();

      Acc_angle_error_x = Acc_angle_error_x + ((atan((Acc_rawY)/sqrt(pow((Acc_rawX),2) + pow((Acc_rawZ),2)))*rad_to_deg));
      Acc_angle_error_y = Acc_angle_error_y + ((atan(-1*(Acc_rawX)/sqrt(pow((Acc_rawY),2) + pow((Acc_rawZ),2)))*rad_to_deg)); 

      Gyro_raw_error_x = Gyro_raw_error_x + (Gyr_rawX/32.8); 
      Gyro_raw_error_y = Gyro_raw_error_y + (Gyr_rawY/32.8);      

    }


Acc_angle_error_x = Acc_angle_error_x/samples;
Acc_angle_error_y = Acc_angle_error_y/samples;
Gyro_raw_error_x = Gyro_raw_error_x/samples;
Gyro_raw_error_y = Gyro_raw_error_y/samples;

Please do not double post.