jilnk handle nack
@@ -11,7 +11,7 @@ use crate::{
architecture::arm::{DapError, PortType, Register},
architecture::{
arm::{
- communication_interface::ArmProbeInterface, dp::Ctrl, swo::SwoConfig,
+ communication_interface::ArmProbeInterface, dp::Ctrl, dp::DPIDR, swo::SwoConfig,
ArmCommunicationInterface, SwoAccess,
},
riscv::communication_interface::RiscvCommunicationInterface,
@@ -773,6 +773,10 @@ impl DAPAccess for JLink {
// Get the ack.
let ack = result_sequence.split_off(3).collect::<Vec<_>>();
+
+ if ack[0] && ack[1] && ack[2] {
+ return Err(DapError::NoAcknowledge.into());
+ }
if ack[1] {
// If ack[1] is set the host must retry the request. So let's do that right away!
retries += 1;
@@ -784,11 +788,12 @@ impl DAPAccess for JLink {
// To get a clue about the actual fault we read the ctrl register,
// which will have the fault status flags set.
+
let response =
DAPAccess::read_register(self, PortType::DebugPort, Ctrl::ADDRESS as u16)?;
let ctrl = Ctrl::from(response);
- log::error!(
- "Reading DAP register failed. Ctrl/Stat register value is: {:#?}",
+ log::trace!(
+ "Writing DAP register failed. Ctrl/Stat register value is: {:#?}",
ctrl
);
@@ -921,6 +926,10 @@ impl DAPAccess for JLink {
// Get the ack.
let ack = result_sequence.by_ref().take(3).collect::<Vec<_>>();
+
+ if ack[0] && ack[1] && ack[2] {
+ return Err(DapError::NoAcknowledge.into());
+ }
if ack[1] {
// If ack[1] is set the host must retry the request. So let's do that right away!
retries += 1;
@@ -932,6 +941,7 @@ impl DAPAccess for JLink {
// To get a clue about the actual fault we read the ctrl register,
// which will have the fault status flags set.
+
let response =
DAPAccess::read_register(self, PortType::DebugPort, Ctrl::ADDRESS as u16)?;
let ctrl = Ctrl::from(response);
