An electronic device comprising: a connector to which an external device is connected; a voltage conversion circuit electronically connected to the connector; a charging and discharging circuit (132, 630) electronically connected to the voltage conversion circuit; a battery electronically connected to the charging and discharging circuit (132, 630); and at least one processor electronically connected to the connector, the voltage conversion circuit, and the charging and discharging circuit (132, 630), wherein, when the external device is a power supply device, the at least one processor is configured to: control the voltage conversion circuit to bypass a supply voltage supplied from the external device or to boost the supply voltage, and control the charging and discharging circuit (132, 630) to step down the bypassed or boosted voltage supplied from the voltage conversion circuit and to supply the stepped down voltage to the battery; and wherein, when the external device is a power consumption device, the at least one processor is configured to: control the charging and discharging circuit (132, 630) to bypass a battery voltage of the battery such that the battery voltage is supplied to the voltage conversion circuit, and control the voltage conversion circuit to convert the battery voltage of the battery and to supply the converted voltage to the external device. a connector to which an external device is connected; a voltage conversion circuit electronically connected to the connector; a charging and discharging circuit (132, 630) electronically connected to the voltage conversion circuit; a battery electronically connected to the charging and discharging circuit (132, 630); and at least one processor electronically connected to the connector, the voltage conversion circuit, and the charging and discharging circuit (132, 630), wherein, when the external device is a power supply device, the at least one processor is configured to: control the voltage conversion circuit to bypass a supply voltage supplied from the external device or to boost the supply voltage, and control the charging and discharging circuit (132, 630) to step down the bypassed or boosted voltage supplied from the voltage conversion circuit and to supply the stepped down voltage to the battery; and control the voltage conversion circuit to bypass a supply voltage supplied from the external device or to boost the supply voltage, and control the charging and discharging circuit (132, 630) to step down the bypassed or boosted voltage supplied from the voltage conversion circuit and to supply the stepped down voltage to the battery; and wherein, when the external device is a power consumption device, the at least one processor is configured to: control the charging and discharging circuit (132, 630) to bypass a battery voltage of the battery such that the battery voltage is supplied to the voltage conversion circuit, and control the voltage conversion circuit to convert the battery voltage of the battery and to supply the converted voltage to the external device. control the charging and discharging circuit (132, 630) to bypass a battery voltage of the battery such that the battery voltage is supplied to the voltage conversion circuit, and control the voltage conversion circuit to convert the battery voltage of the battery and to supply the converted voltage to the external device.