An image forming apparatus including an image forming unit configured to form an image on a recording medium, the image forming apparatus comprising:
- a power source to be connected to an external power source and configured to be supplied with power from the external power source;
- a motor configured to drive a load;
- a driving circuital to which a winding of the motor is connected, the driving circuit being configured to supply driving current to the winding based on power supplied from the power source;
- a first switching element configured to be switched between a first state in which the power is supplied from the power source to the driving circuit and a second state in which the power is not supplied from the power source to the driving circuit;
- a first controller configured to operate with power supplied from the power source and configured to switch a state of the first switching element between the first state and the second state;
- a second switching element configured to be switched between a third state in which the power is supplied from the power source to the first controller through the second switching element and a fourth state in which the power is not supplied from the power source to the first controller through the second switching element;
- a detector configured to detect driving current flowing through the winding;
- and
- a second controller configured to control the driving circuit,
- wherein the image forming apparatus includes a first power mode, as a power mode, in which the power is supplied from the power source to both the first controller and the driving circuit, and includes a second power mode, as the power mode, in which the power is supplied from the power source to the first controller and is not supplied from the power source to the driving circuit, the first controller switching the state of the first switching element from the second state to the first state in a case where the power mode is switched from the second power mode to the first power mode,
- wherein the second controller is configured to:
- set a control value corresponding to a type of the motor connected to the driving circuit based on the driving current detected by the detector;
- determine a rotational phase of a rotor of the motor based on the driving current detected by the detector and the set control value;
- and
- set a target value of current to be supplied to the winding so as to decrease a deviation between the determined rotational phase and an instructed phase representing a target phase of the rotor of the motor,
- wherein the second controller includes a first mode in which the second controller controls the driving circuit so that the driving circuit supplies predetermined current to the winding to set the control value, and a second mode in which the second controller controls the driving circuit so that the driving circuit supplies driving current corresponding to the set target value to the winding,
- wherein the second controller is configured to set the control value based on the driving current detected by the detector in the first mode,
- wherein the second controller is configured to execute the first mode, in a case where the power is supplied from the power source to the first controller caused by switching of the second switching element from the fourth state to the third state and the first controller switches the state of the first switching element from the second state to the first state in response to the power being supplied to the first controller, and
- wherein the second controller is configured not to execute the first mode even if the first controller switches the state of the first switching element from the second state to the first state in response to the power mode being switched from the second power mode to the first power mode, in a case where the power mode is switched from the second power mode to the first power mode.