I tired the following code just to fully turn on and off the motor (powered from the same power supply) and it works fine.
I dont know why when i feed the mosfet with pwm signal it will cause the mcu to reset...
void setup()
{
pinMode (11,OUTPUT);
}
void loop()
{
digitalWrite (11, HIGH);
delay(2000);
digitalWrite (11, LOW);
delay(2000);
}