- ESP32_Flasher: Return new status "2" when connected, but nRF is locked (#327)

- OEPL-Flasher: Print "locked" message when flasher returns status 2
- ESP32_Flasher: Initialize idCode to zero as failed read attempts will not set it
- ESP32_Flasher: Print returned idCode when showDebug is enabled
This commit is contained in:
Stefan Krupop
2024-05-27 23:11:44 +02:00
committed by GitHub
parent 45849851af
commit 6a636b5b54
4 changed files with 7 additions and 2 deletions

View File

@@ -18,7 +18,7 @@ class swd {
bool DP_Write(unsigned addr, uint32_t data);
bool DP_Read(unsigned addr, uint32_t &data);
uint32_t idCode;
uint32_t idCode = 0;
protected:
void swd_Begin();

View File

@@ -182,6 +182,7 @@ bool nrfswd::init() {
isLocked = true;
}
} else {
if (showDebug) Serial0.printf("No nRF core ID found, got 0x%lx\n", temp);
isConnected = false;
isLocked = true;
}

View File

@@ -513,7 +513,7 @@ void processFlasherCommand(struct flasherCommand* cmd) {
nrfflasherp = new nrfswd(FLASHER_EXT_MISO, FLASHER_EXT_CLK);
nrfflasherp->showDebug = false;
nrfflasherp->init();
temp_buff[0] = (nrfflasherp->isConnected && !nrfflasherp->isLocked);
temp_buff[0] = nrfflasherp->isConnected ? (nrfflasherp->isLocked ? 2 : 1) : 0;
sendFlasherAnswer(CMD_SELECT_NRF82511, temp_buff, 1);
currentFlasherOffset = 0;
selectedController = CONTROLLER_NRF82511;

View File

@@ -380,6 +380,10 @@ def main():
if (answer[0] == 1):
print("Connection established to microcontroller")
elif (answer[0] == 2):
print("Established connection to the microcontroller, but it is locked. Exiting.")
send_cmd(CMD_SET_POWER, bytearray([0]))
exit(0)
else:
print("Failed to establish a connection to the microcontroller")
send_cmd(CMD_SET_POWER, bytearray([0]))