[Xiaomi Mi A2 / 6X Questions & Answers] LukeSkyPTBR:
Hi guys, my MI A2 have a edl mode, and i need flash stock rom, but, i have the problems(log file):

[00:00:42]:0 COM9 5,0475537s [00:00:42 COM9]:dump:<?xml version="1.0" encoding="UTF-8" ?>

<data>

<log value="ERROR: Only nop and sig tag can be recevied before authentication."/>

</data><?xml version="1.0" encoding="UTF-8" ?>

<data>

<response value="NAK" />

</data>

[00:25:03]:9 COM9 4,0064887s [00:25:03 COM9]:resdump:<?xml version="1.0" encoding="UTF-8" ?>

<data>

<log value="ERROR: Only nop and sig tag can be recevied before authentication."/>

</data><?xml version="1.0" encoding="UTF-8" ?>

<data>

<response value="NAK" />

</data>

[00:26:1

3]:9 COM9 74,0407942s Elemento raiz inexistente.
[00:29:02]:9 COM9 0,5908906s [00:29:02 COM9]:System.IO.IOException: Recurso solicitado em uso.

em System.IO.Ports.InternalResources.WinIOError(Int32 errorCode, String str)
em System.IO.Ports.SerialStream..ctor(String portName, Int32 baudRate, Parity parity, Int32 dataBits, StopBits stopBits, Int32 readTimeout, Int32 writeTimeout, Handshake handshake, Boolean dtrEnable, Boolean rtsEnable, Boolean discardNull, Byte parityReplace)
em System.IO.Ports.SerialPort.Open()
em XiaoMiFlash.code.bl.SerialPortDevice.registerPort(SerialPort port)
em XiaoMiFlash.code.bl.SerialPortDevice.XiaomiFlash() em System.IO.Ports.InternalResources.WinIOError(Int32 errorCode, String str)
em System.IO.Ports.SerialStream..ctor(String portName, Int32 baudRate, Parity parity, Int32 dataBits, StopBits stopBits, Int32 readTimeout, Int32 writeTimeout, Handshake handshake, Boolean dtrEnable, Boolean rtsEnable, Boolean discardNull, Byte parityReplace)
em System.IO.Ports.SerialPort.Open()
em XiaoMiFlash.code.bl.SerialPortDevice.registerPort(SerialPort port)
em XiaoMiFlash.code.bl.SerialPortDevice.XiaomiFlash()
[00:30:56]:8 COM8 9,9252977s [00:30:56 COM8]:resdump:<?xml version="1.0" encoding="UTF-8" ?>
<data>
<log value="ERROR: SDCC Error 3 (3)"/>
</data><?xml version="1.0" encoding="UTF-8" ?>
<data>
<log value="ERROR: Write Failed sector 512, size 97"/>
</data><?xml version="1.0" encoding="UTF-8" ?>
<data>
<log value="ERROR: Failed to write 1 slot 0, partition 512, start_sector 97 num_sectors 0, error 3"/>
</data><?xml version="1.0" encoding="UTF-8" ?>
<data>
<log value="Finished programming start_sector 609 and TotalSectorsToProgram 97"/>
</data><?xml version="1.0" encoding="UTF-8" ?>
<data>
<response value="NAK" rawmode="false" />
</data>

[00:34:39]:8 COM8 9,5074713s [00:34:39 COM8]:resdump:<?xml version="1.0" encoding="UTF-8" ?>
<data>
<log value="ERROR: SDCC Error 3 (3)"/>
</data><?xml version="1.0" encoding="UTF-8" ?>
<data>
<log value="ERROR: Write Failed sector 512, size 97"/>
</data><?xml version="1.0" encoding="UTF-8" ?>
<data>
<log value="ERROR: Failed to write 1 slot 0, partition 512, start_sector 97 num_sectors 0, error 3"/>
</data><?xml version="1.0" encoding="UTF-8" ?>
<data>
<log value="Finished programming start_sector 609 and TotalSectorsToProgram 97"/>
</data><?xml version="1.0" encoding="UTF-8" ?>
<data>
<response value="NAK" rawmode="false" />
</data>

The main error is: SDCC error 3, failed to write. I did not understand it.