New "cycleTargetPowerPostDwenUpdate" target config param to control the automatic cycling of target power, after updating the target's DWEN fuse bit

This commit is contained in:
Nav
2022-03-16 17:21:12 +00:00
parent 55013dfc4a
commit 80e5678ddf
2 changed files with 11 additions and 1 deletions

View File

@@ -81,6 +81,12 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
}
}
if (targetConfig.jsonObject.contains("cycleTargetPowerPostDwenUpdate")) {
this->cycleTargetPowerPostDwenUpdate = targetConfig.jsonObject.value(
"cycleTargetPowerPostDwenUpdate"
).toBool();
}
this->avr8DebugInterface->configure(targetConfig);
if (this->avrIspInterface != nullptr) {
@@ -154,12 +160,15 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
this->writeDwenFuseBit(true);
// If the debug tool provides a TargetPowerManagementInterface, attempt to cycle the target power
if (this->targetPowerManagementInterface != nullptr) {
if (this->targetPowerManagementInterface != nullptr && this->cycleTargetPowerPostDwenUpdate) {
Logger::info("Cycling target power");
Logger::debug("Disabling target power");
this->targetPowerManagementInterface->disableTargetPower();
Logger::debug("Holding power off for ~250 ms");
std::this_thread::sleep_for(std::chrono::milliseconds(250));
Logger::debug("Enabling target power");
this->targetPowerManagementInterface->enableTargetPower();
}

View File

@@ -139,6 +139,7 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
std::map<TargetMemoryType, TargetMemoryDescriptor> targetMemoryDescriptorsByType;
bool updateDwenFuseBit = false;
bool cycleTargetPowerPostDwenUpdate = true;
/**
* Users are required to set their desired physical interface in their Bloom configuration. This would take