Skip to content

Commit

Permalink
- ESP32_Flasher: Return new status "2" when connected, but nRF is loc…
Browse files Browse the repository at this point in the history
…ked (#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
  • Loading branch information
StefanKrupop committed May 27, 2024
1 parent 4584985 commit 6a636b5
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Tag_Flasher/ESP32_Flasher/include/swd.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions Tag_Flasher/ESP32_Flasher/src/swd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion Tag_Flasher/ESP32_Flasher/src/usbflasher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions Tag_Flasher/OEPL-Flasher.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]))
Expand Down

0 comments on commit 6a636b5

Please sign in to comment.