I am using matlab just for getting the data and plotting that data. I am doing all the calculations on STM32 Discovery board. I am also using complementary filter and the formula that I am using for calculation roll and pitch is "atan2(ACC_z, ACC_x)" and "atan2(sqrt(ACC_z*ACC_z + ACC_x*ACC_x),-ACC_y)" respectively. Now I have also attached the excel file. Major error can be seen on 3, 4 and 5 degree in 12g configuration as instead of 3, 4 or 5 degree I am getting 356, 357, 358 or 359 degrees.
What I am suspecting is that the accelerometer values given by sensor are not correct. If this is the problem then can my sensor be damaged or faulty?